[cairo] Exclusive OR (XOR) fillRect drawing

Dov Grobgeld dov.grobgeld at gmail.com
Thu Aug 26 03:12:29 PDT 2010


No, since cairo is an abstraction layer that works with both vector and
raster graphics, the concept of pixels does not necessarily exist. Whether
it is possible to probe the color at a certain coordinate is a different
question, that perhaps someone else will be able to answer. But even if it
exists it will most likely my be highly inefficient.

Regards,
Dov


On Thu, Aug 26, 2010 at 09:11, Prasanta Sadhukhan <psadhukhan at gmail.com>wrote:

> Thanks Benjamin for your input
> I actually would be working on cairo 1.8 so probably this will not help
>
> Can anyone suggest if we can do something like this?
>
> rgb = cairo_get_pixel(x,y) where x,y is the coordinate on screen
> cairo_set_pixel(x,y, rgb ^ xorcolor)
>
> or something similar
>
> Thx in advance
>
>
> On Wed, Aug 25, 2010 at 6:12 PM, Benjamin Otte <otte at redhat.com> wrote:
>
>> You cannot do XOR with Cairo. What you can get (and I suspect that's
>> what you want) is INVERT.
>>
>> To get the effect of INVERT, you'd do:
>> cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE);
>> cairo_set_source_rgb (cr, 1, 1, 1);
>>
>> Note that this requires Cairo 1.9 snapshots.
>>
>> Benjamin
>>
>>
>> On Wed, 2010-08-25 at 17:02 +0530, Prasanta Sadhukhan wrote:
>> > Hi
>> >
>> > I am a newbie to cairo. I saw in some of the discussion that cairo
>> > does not support bitwise XOR drawing (like drawing same shape on same
>> > area will make it disappear)
>> > Can anyone please suggest as to how can I perform XOR drawing of
>> > draw/fill shape ex fillrect with cairo APIs?
>> >
>> > I have some legacy programs that need to use XOR based drawing like
>> > blinking of cursor under a line
>> > Thx in advance
>> >
>> > --
>> > cairo mailing list
>> > cairo at cairographics.org
>> > http://lists.cairographics.org/mailman/listinfo/cairo
>>
>>
>>
>
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20100826/a89963ef/attachment.html>


More information about the cairo mailing list