[cairo] Exclusive OR (XOR) fillRect drawing

Benjamin Otte otte at redhat.com
Wed Aug 25 05:42:28 PDT 2010

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.


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

More information about the cairo mailing list