[cairo] global clip for a cairo context

Uli Schlachter psychon at znc.in
Sat Jan 2 09:53:50 PST 2016


Am 02.01.2016 um 17:48 schrieb Enrico Weigelt, metux IT consult:
> On 02.01.2016 15:25, Uli Schlachter wrote:
>> P.S.: Actually, I'd do something like this:
>>
>>   cairo_save(cr);
>>   cairo_translate(cr, widget->x, widget->y);
>>   cairo_rectangle(cr, 0, 0, widget->width, widget->height);
>>   cairo_clip(cr);
>>   widget->paint_callback(cr, widget->width, widget->height);
>>   cairo_restore(cr);
> 
> Does that also work when the widget uses these operations itself ?

Yeah, it does.

cairo_save/restore save the whole state of the cairo context except for the
current path (if you want, you can clear that with cairo_new_path()).
Internally, a linked list is used to chain these together.

Uli
-- 
"In the beginning the Universe was created. This has made a lot of
 people very angry and has been widely regarded as a bad move."


More information about the cairo mailing list