Page 1 of 1

How to resolve the color of the pixel hoverd by the mouse ?

Posted: Thu Feb 28, 2008 11:11 pm
by paddy
Hi there :)

I'm working on a little dialog which lets u select a color. I have a window, and a texture (rainbow colors) placed in it.

Is there any simple way to get the color of the pixel in that displayed texture which is hovered by the mouse cursor ?!

greets
paddy

Posted: Fri Feb 29, 2008 12:10 am
by arras
You could lock() texture and access pixels directly. With some simple math you can access pixels given their 2D coordinates.

Or you can use IImage instead of ITexture. There you can find getPixel() function which returns color of pixel.