[cairo] Redoing SOURCE and CLEAR
Behdad Esfahbod
behdad at cs.toronto.edu
Wed Aug 17 09:38:02 PDT 2005
On Wed, 17 Aug 2005, Owen Taylor wrote:
> On Wed, 2005-08-17 at 11:55 -0400, Behdad Esfahbod wrote:
>
> - What is useful for people
> - What makes sense to people
So far I've been escaping from understanding what's going on by
not touching cairo_set_operator at all, and that's what people
need most of the time! The question here is what do SOURCE with
your proposed definition would offer that OVER doesn't offer.
> (And it's tailoring, unless I'm doing it. :-)
Sorry about that. Silly me. :)
> > Moreover, it reduces SOURCE to IN somehow, but a broken one. The
> > fact that it's differentiating between a alpha of 0 in the
> > source, and a point ouside the mask is confusing.
>
> I don't see the relationship between the new SOURCE and IN.
>
> But what's *wrong* with doing:
>
> cr = cairo_create (canvas);
> cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
> cairo_fill();
> cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
> cairo_set_source_rgba (cr, 0, 0, 0);
> cairo_rectangle (cr, x, y, width, height);
> cairo_fill (cr);
> cairo_destroy (cr);
>
> Yes, it touches the pixels in the rectangle twice, but it's not
> going to be a big performance difference. And it's more apparent
> what it is doing.
Ok, then what's wrong with simply using OVER? In other words,
why should people use SOURCE at all?
> (Note also that create_similar() clears the surface, for better
> or worse.)
I personally have been keeping my scratch buffers around and only
recreate on resize...
> Rgeards,
> Owen
--behdad
http://behdad.org/
More information about the cairo
mailing list