Re: how to get the color of a pixel(x,y) on the window?



Dear Chunlong84,

> I use gtkmm on Windows platform,and have tried three method ,but the
> three methods return three different result,and none of them is
> correct,wh?

> (1)
>  gushort red=(pixel& 0xFF000000)>>16;
>  gushort green=(pixel& 0x00FF0000)>>8;
>  gushort blue =(pixel& 0x0000FF00);

> (2)
>  gushort red=p[0]<<8;
>  gushort green=p[1]<<8;
>  gushort blue=p[2]<<8;

> (3)
>  gushort red=p[0]<<8;
>  gushort green=p[1]<<8;
>  gushort blue=p[2]<<8;

I don't know the first thing about images in GTK. But it seems strange to 
me that your values for red, green and blue are always multiples 
of 0x100 and range from 0x0 to 0xffff. Should they not range from 0x0 to 
0xff?

My question to the list is: is this correct, and why?

Mark

---------------------------------------------------------------
Mark Roberts, hardcore C++-Programmierer, Musiker, Schauspieler
05121 511455
www.rapid-arts-movement.de


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