[cairo] How to draw a inverted area?

Magicloud Magiclouds magicloud.magiclouds at gmail.com
Mon Jun 7 19:08:10 PDT 2010


Ah, thanks.

On Mon, Jun 7, 2010 at 11:14 PM, Carlos Garcia Campos
<carlosgc at gnome.org> wrote:
> Excerpts from Magicloud Magiclouds's message of lun jun 07 13:44:21 +0200 2010:
>> I cannot find that operator. I think you meant cairo_operator_t?
>
> Yes, you need cairo >= 1.9.2
>
>> typedef enum _cairo_operator {
>>     CAIRO_OPERATOR_CLEAR,
>>
>>     CAIRO_OPERATOR_SOURCE,
>>     CAIRO_OPERATOR_OVER,
>>     CAIRO_OPERATOR_IN,
>>     CAIRO_OPERATOR_OUT,
>>     CAIRO_OPERATOR_ATOP,
>>
>>     CAIRO_OPERATOR_DEST,
>>     CAIRO_OPERATOR_DEST_OVER,
>>     CAIRO_OPERATOR_DEST_IN,
>>     CAIRO_OPERATOR_DEST_OUT,
>>     CAIRO_OPERATOR_DEST_ATOP,
>>
>>     CAIRO_OPERATOR_XOR,
>>     CAIRO_OPERATOR_ADD,
>>     CAIRO_OPERATOR_SATURATE
>> } cairo_operator_t;
>>
>> On Mon, Jun 7, 2010 at 6:03 PM, Carlos Garcia Campos <carlosgc at gnome.org> wrote:
>> > Excerpts from Magicloud Magiclouds's message of lun jun 07 09:44:10 +0200 2010:
>> >> Hi, sorry the subject is not clear.
>> >> I mean that, first I draw something in the cairo context, then I draw
>> >> a circle in it, which acts like a invert mask. All colors in its area
>> >> are inverted.
>> >
>> > I think filling with white with the difference operator is what you
>> > want
>> >
>> > cairo_set_source_rgb (cr, 1., 1., 1.);
>> > cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE);
>> > cairo_fill(cr);
>> >
>> >> I thought xor operator helped, but it did not....
>> >> Thanks.
>> >
>> > Regards,
>> >
>>
> --
> Carlos Garcia Campos
> PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462
>



-- 
竹密岂妨流水过
山高哪阻野云飞


More information about the cairo mailing list