Drawing on the Other window surface

Discussion regarding the development of CEGUI itself - as opposed to questions about CEGUI usage that should be in the help forums.

Moderators: CEGUI MVP, CEGUI Team

User avatar
ritz
Quite a regular
Quite a regular
Posts: 49
Joined: Wed Jan 12, 2005 12:06

Drawing on the Other window surface

Postby ritz » Fri Nov 26, 2004 09:33

Hello

I need to create a GUI widget which should provide an API for drawing an image on the surface of the other window.

Can anybody tell me whether it is feasible or not i.e. Is it possible for a widget to draw some image on any other window.


rgds,
Ritz

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Drawing on the Other window surface

Postby CrazyEddie » Fri Nov 26, 2004 14:17

There's a couple of approches you might take:

1) Build a "draw list" that the target window would process in order to perform the required drawing. This list could be populated by making calls to some other widget/API.

2) Hook the target window EventRenderingStarted event and perform some kind of rendering there.

Really it depends on what exactly you're looking to achieve.

CE.

User avatar
ritz
Quite a regular
Quite a regular
Posts: 49
Joined: Wed Jan 12, 2005 12:06

Drawing on the Other window surface

Postby ritz » Sat Nov 27, 2004 11:00

Hello Crazy,

Thanks for responding.

As i have already mentioned i need to provide an API from a widget which should be able to draw on the surface of the other window.

Can you please send me some more details about prepearing draw list for target window.

Rgds,
Ritu

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Drawing on the Other window surface

Postby CrazyEddie » Sun Nov 28, 2004 10:13

It's application specific. Depending on what you want to draw and how you intend to draw it, the approach will be different; my suggestion was just a "top-level" suggestion of one possible approach.

Basically, you just maintain a list of some kind that contains enough information for the required rendering to be performed at a later time. As I said above, what you store in this list and how you finally process it to do the rendering is up to you and the app that you're writing.

CE.

User avatar
ritz
Quite a regular
Quite a regular
Posts: 49
Joined: Wed Jan 12, 2005 12:06

Drawing on the Other window surface

Postby ritz » Mon Nov 29, 2004 03:47

Hello

I want to draw an icon(folder icon) on other widget's window.

Basically I will provide an API like RenderImage from my widget. When this api will be called from container applciation it should be able to draw draw an icon on the surface of the other window.


a) I need to decide on the feasibility point ? Whether it is possible or not?
b) Can you please help me out by telling how i can do this?

rgds,
Ritz

User avatar
krithigal
Not too shy to talk
Not too shy to talk
Posts: 40
Joined: Wed Jan 12, 2005 12:06

Drawing on the Other window surface

Postby krithigal » Mon Nov 29, 2004 09:48

Hello ,

As per my previous posting i need to provide an API in my widget which should be able to draw a static image on the surface of the other window.

I had tried following approach

I modified Tab control code and added my function RenderImage into the control. Code is as follows:

void TabControl::RenderImage(Window *wnd)
{
if (wnd)
{
StaticImage* si = (StaticImage*)WindowManager::getSingleton().createWindow((utf8*)"TaharezLook/StaticImage", (utf8*)"fond");
wnd->addChildWindow(si);
CEGUI::Texture* myTexture = System::getSingleton().getRenderer()->createTexture((utf8*)"Connexion.jpg");
CEGUI::Imageset* pImageSet = ImagesetManager::getSingleton().createImageset((utf8*)"backdrop", myTexture);
pImageSet->defineImage((utf8*)"background", Point(0.0f, 0.0f),Size(25,25),Point(0.0f,0.0f));

si->setPosition(Point(0.2f, 0.2f));
si->setSize(Size(0.4f, 0.4f));
si->setImage((utf8*)"backdrop",(utf8*)"background");
si->setFrameEnabled(false);
si->setBackgroundEnabled(true);
si->setAlwaysOnTop(true);
si->setAlpha(0.9f);
si->setEnabled(false);
}

}


I tried calling this function as

WindowManager& winMgr = WindowManager::getSingleton();
Window* root = winMgr.getWindow((utf8*)"root_wnd");


FrameWindow* fwnd2 = (FrameWindow*)winMgr.createWindow((utf8*)"TaharezLook/FrameWindow", (utf8*)"Demo7/Window2");
root->addChildWindow(fwnd2);
fwnd2->setMinimumSize(Size(0.2f, 0.2f));
fwnd2->setMaximumSize(Size(0.8f, 0.8f));
fwnd2->setPosition(Point(0.1, 0.1f));
fwnd2->setSize(Size(0.4f, 0.4f));
fwnd2->setText((utf8*)"Demo 7 - Window 2");
fwnd2->setCloseButtonEnabled(false);

TabControl* tab1 = (TabControl*)winMgr.createWindow((utf8*)"TaharezLook/TabControl", (utf8*)"Demo7/Tab");
root->addChildWindow(tab1);
tab1->setMinimumSize(Size(0.2f, 0.2f));
tab1->setMaximumSize(Size(0.8f, 0.8f));
tab1->setPosition(Point(0.4, 0.1f));
tab1->setSize(Size(0.5f, 0.5f));
tab1->setText((utf8*)"Demo 7 - Window 2");
tab1->RenderImage(fwnd2);

FrameWindow* fwnd1 = (FrameWindow*)winMgr.createWindow((utf8*)"TaharezLook/FrameWindow", (utf8*)"Demo7/Tab1");
tab1->addTab(fwnd1);
fwnd1->setMinimumSize(Size(0.2f, 0.2f));
fwnd1->setMaximumSize(Size(0.8f, 0.8f));
fwnd1->setPosition(Point(0.1f, 0.1f));
fwnd1->setSize(Size(0.3f, 0.3f));
fwnd1->setText((utf8*)"Demo 7 - Tab1");
fwnd1->setCloseButtonEnabled(false);


FrameWindow* fwnd3 = (FrameWindow*)winMgr.createWindow((utf8*)"TaharezLook/FrameWindow", (utf8*)"Demo7/Tab2");
tab1->addTab(fwnd3);
fwnd3->setMinimumSize(Size(0.2f, 0.2f));
fwnd3->setMaximumSize(Size(0.8f, 0.8f));
fwnd3->setPosition(Point(0.1f, 0.1f));
fwnd3->setSize(Size(0.3f, 0.3f));
fwnd3->setText((utf8*)"Demo 7 - Tab2");
fwnd3->setCloseButtonEnabled(false);

and able to get the image drawn on the surface of fwnd2 .


Please let me know whether this is a correct way of doing the things.


Thanks and Rgds,
Ritz

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Drawing on the Other window surface

Postby CrazyEddie » Mon Nov 29, 2004 10:00

Yes, this is certainly a valid mechanism by which to achieve what you need; especially if you do not know which specific type of window you will be rendering to (some alternative ideas I had would require you to sub-class the target window, though in doing this you could only render to specific window types).

On a separate note, it seems you are running two forum accounts. I'd prefer users to have only one account, so let me know which account you want deleted ;) If you do not identify which account I should delete by the end of the week, I'll just pick one at random.

CE.

User avatar
ritz
Quite a regular
Quite a regular
Posts: 49
Joined: Wed Jan 12, 2005 12:06

Drawing on the Other window surface

Postby ritz » Tue Nov 30, 2004 04:24

Hello,

Thanks for replying.

I do not have two accounts. My account id is Ritz. Krithigal is one of colleague id. Yesterday I was sitting on her PC. By mistake I have added my query from her account. Please do not delete any of the account.

Rgds,
Ritz

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Drawing on the Other window surface

Postby CrazyEddie » Tue Nov 30, 2004 11:24

Okay, I understand.

I'll leave both accounts active ;)

CE.

User avatar
ritz
Quite a regular
Quite a regular
Posts: 49
Joined: Wed Jan 12, 2005 12:06

Drawing on the Other window surface

Postby ritz » Wed Dec 01, 2004 03:48

Thanks a Lot,
Ritz


Return to “CEGUI Library Development Discussion”

Who is online

Users browsing this forum: No registered users and 6 guests