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
Drawing on the Other window surface
Moderators: CEGUI MVP, CEGUI Team
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Drawing on the Other window surface
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.
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.
Drawing on the Other window surface
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
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
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Drawing on the Other window surface
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.
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.
Drawing on the Other window surface
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
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
Drawing on the Other window surface
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
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
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Drawing on the Other window surface
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.
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.
Drawing on the Other window surface
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
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
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Drawing on the Other window surface
Okay, I understand.
I'll leave both accounts active
CE.
I'll leave both accounts active
CE.
Drawing on the Other window surface
Thanks a Lot,
Ritz
Ritz
Return to “CEGUI Library Development Discussion”
Who is online
Users browsing this forum: No registered users and 6 guests