[cairo] Redoing SOURCE and CLEAR

Carl Worth cworth at redhat.com
Wed Aug 17 17:05:26 PDT 2005


On Wed, 17 Aug 2005 18:13:05 -0400, Owen Taylor wrote:
> On Wed, 2005-08-17 at 13:35 -0700, Carl Worth wrote:
> > These pictures are exactly what I needed to convince myself we want
> > the new equation. Under the new equation, the operator controls the
> > interaction of source and dest, while the shape and clip are only used
> > to restrict the behavior. As the images show, this provides consistent
> > behavior across all operators, and unique results for each.
> 
> Hmm, I came to the opposite conclusion. There are some nice properties
> of the new equation:
> 
>  - *Everything* is bounded by the mask
>  - They behave more similar to CLEAR and SOURCE

This consistency is what I first found most striking in the pictures.

>  - We only have two equations, not three

This is also quite appealing. Perhaps even more than the equations, I
like the fact that with the new approach it's easy to come up with a
fairly easy-to-understand description that works for all of the
operators:

	The operator controls how the source pattern is combined with
	the destination, and any modification is restricted by the
	shape and the clip.

Do we have anything like that for the different-equation-for-unbounded
case?

>  - The old DEST_IN is 
> 
>     "Cut this shape with scissors from the destination, 
>      and use cut out portion"

This use case does seem rather compelling. And I think you
successfully called my bluff on the "simple...juggling". I tried a bit
myself, and found the following things:

	* Group support would be really nice to eliminate the width
	  and height to cairo_surface_create_similar.

	* Similarly, a cairo_surface_clone that copied the contents
	  (and size) of a surface would help a lot.

	* If clone were available, then it wouldn't be too hard to
	  write a convenience function for:

		Set the target contents as source, then clear the
		target.

	  and at that point I think the juggling is pretty much taken
	  care of.

	* With all of that, the DEST_IN use case could be implemented
	  with just OVER and using what was originally the source as
	  the mask.

But, that approach does rely on one or more non-existent things in
cairo in order to not be really inconvenient. So, it we could just
make DEST_IN do this anyway, and we don't have any use case for what
the new DEST_IN would be...

> > So, I guess what we've done is to reduce "fill" to be conceptually
> > equivalent to "clip; paint"? (with the exception of SATURATE). That's
> > not unpleasant.

And maybe this should actually be turned around as an argument against
using the new equation universally. If cairo_clip(); cairo_paint() can
always be used to emulate the new mode, that's certainly a lot easier
than any of the juggling we contemplated for emulating the old mode.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050817/b2619ab2/attachment-0001.pgp


More information about the cairo mailing list