[cairo] Getting wrong cairo pixel color.

Monil Parmar monil.parmar at gmail.com
Mon Mar 28 02:28:16 PDT 2011


Iam using cairo in my application to set and get the color.
Values which Iam getting for particular pixel is not exactly same which we
are setting, it is nearabout of that value.
I made a sample in which, For example if we are setting the (r=10, b=20,
g=30, a=40) to the pixel,  when I tried to get the color value from that
Iam getting following values in return (r=6, b=19, g=26, a=40).
I tried few other ways (sample is attached) but result is same.
Issue seems to be due to division / multiplication / conversion between
Double -> int -> store in int value.
I Found a open source link where it states that, The result comes due to the
different conversions of
color for it's representation:  double -> 4 uint16 (cairo) -> 1 uint32
following is the link:
Is any one having any update on this issue. Or there is any other way to get
the exact value of color.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20110328/ab35c854/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cairo-pixel.c
Type: text/x-csrc
Size: 3081 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20110328/ab35c854/attachment.c>

More information about the cairo mailing list