Re: How convert xpixel to rgb ?



GONZALOMZ wrote:
> well, i get the xpixel with gdk_image_get_pixel() and i need this 
> pixel in rgb, how convert it ?.

This is difficult to do in the general case. The xpixel value is quite 
close to the hardware and turning it to RGB needs lots of analysis. The 
code needs to work for 8, 15, 16, 24 and 32 bit xpixels, with and 
without colormaps, in various byte orderings etc. etc.

Even if you do manage to get a reliable RGB from the xpixel, what if 
that xpixel was drawn by gdk_draw_rgb_image()? It might well be 
dithered, so the RGB you get back will probably not be the same as the 
RGB you sent to the display for that pixel.

If it's at all possible, you should use another technique. Having said 
that, I sort-of remember a utility function somewhere that attempted to 
do this. But I wouldn't use it :-)

John



========================================================== 
Aelbert Cuyp 13 February - 12 May 2002 

For information and tickets: 
http://www.nationalgallery.org.uk/exhibitions/cuyp/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]