[solved]How to realize color palette ?

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
spracle
Not too shy to talk
Not too shy to talk
Posts: 34
Joined: Tue Aug 24, 2010 07:29

[solved]How to realize color palette ?

Postby spracle » Thu Nov 18, 2010 03:05

I think, we should use staticImage,and set an colour picture as its image;
when click the staticImage, we can getMousePostion(x,y);
As the picture's size is the same to the staticImage's size,so we can treat (x,y) as the picture's coordinate.

The problem is how can we get the colourValue at the point(x,y) in an picture?

Or anyone has a better solution?
Last edited by spracle on Tue Dec 28, 2010 09:32, edited 1 time in total.

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: How to realize color palette ?

Postby Kulik » Sat Nov 20, 2010 06:22

Yeah you can't quite do that, I already asked for it some time ago and IIRC nothing changed regarding that. The problem is that textures are held in GPU memory, not RAM. You would have to read back the texture buffer and that's terribly expensive. The other solution is to go for a shadow buffered texture. Either way CEGUI has no way to know which textures you are going to need this on. I actually went for a manual custom texture solution implemented with a shadowed Ogre::Texture.

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

Re: How to realize color palette ?

Postby CrazyEddie » Sun Nov 21, 2010 09:22

This is achievable with some renderers in CEGUI 0.7.2 or better, and basically involves the technique to which Kulik refers (so in actual fact, if you can do it more directly, then you should probably prefer that route). Anyway, the technique involves rendering the widget to a texture (usually via the AutoRenderingSurface surface property), dumping the content to a buffer and sampling the buffer. The technique is described more fully here: http://www.cegui.org.uk/wiki/index.php/ ... EGUI_0.7.x where I discuss using the technique for non-rectangular hit-testing of windows.

HTH

CE.

User avatar
spracle
Not too shy to talk
Not too shy to talk
Posts: 34
Joined: Tue Aug 24, 2010 07:29

Re: How to realize color palette ?

Postby spracle » Wed Nov 24, 2010 02:38

Out for several days..

Thanks,CE and Kulik.You guys are really helpful~

I decided to use secondary buffer in system RAM that contains a copy of the rendered texture,and performance may well not be a big problem.

one more question: why "Direct3D9Texture::saveToMemory" is Unimplemented?

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

Re: How to realize color palette ?

Postby CrazyEddie » Wed Nov 24, 2010 11:57

spracle wrote:one more question: why "Direct3D9Texture::saveToMemory" is Unimplemented?

I think mainly because I never got around to implementing it yet. I will see if I can look into getting that done.

CE.

User avatar
spracle
Not too shy to talk
Not too shy to talk
Posts: 34
Joined: Tue Aug 24, 2010 07:29

Re: How to realize color palette ?

Postby spracle » Tue Dec 28, 2010 09:32

CrazyEddie wrote:The technique is described more fully here: http://www.cegui.org.uk/wiki/index.php/ ... EGUI_0.7.x where I discuss using the technique for non-rectangular hit-testing of windows.


Got it in this way :)


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 5 guests