[cairo] API Shakeup: cairo_paint
Amaury Jacquot
sxpert at esitcom.org
Wed Feb 16 02:01:23 PST 2005
Carl Worth wrote:
> We came up with the following proposal for this operation:
>
> void
> cairo_paint (cairo_t *cr);
>
> This is a new drawing operation that uses the current pattern, and no
> shape, so that it composites the current pattern everywhere within the
> current clip.
I like this idea too. can be used for erasing the whole canvas easily:
instead of :
cairo_save (layer->cr);
cairo_set_operator (layer->cr, CAIRO_OPERATOR_SRC);
cairo_set_alpha (layer->cr, 0.0);
cairo_set_rgb_color (layer->cr, 0.0, 0.0, 0.0);
cairo_rectangle (layer->cr, 0.0, 0.0, layer->width, layer->height);
cairo_fill (layer->cr);
cairo_restore (layer->cr);
do :
cairo_save (layer->cr);
cairo_set_operator (layer->cr, CAIRO_OPERATOR_SRC);
cairo_set_alpha (layer->cr, 0.0);
cairo_set_rgb_color (layer->cr, 0.0, 0.0, 0.0);
cairo_paint (layer->cr);
cairo_restore (layer->cr);
avoids needing to create a rectangle path, and filling it, which takes
time, and apparently requires some memory allocations to be done
More information about the cairo
mailing list