Page 1 of 1

[solved]How to realize color palette ?

Posted: Thu Nov 18, 2010 03:05
by spracle
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?

Re: How to realize color palette ?

Posted: Sat Nov 20, 2010 06:22
by Kulik
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.

Re: How to realize color palette ?

Posted: Sun Nov 21, 2010 09:22
by CrazyEddie
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.

Re: How to realize color palette ?

Posted: Wed Nov 24, 2010 02:38
by spracle
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?

Re: How to realize color palette ?

Posted: Wed Nov 24, 2010 11:57
by CrazyEddie
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.

Re: How to realize color palette ?

Posted: Tue Dec 28, 2010 09:32
by spracle
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 :)