[cairo] cairo internal design ideas

Carl Worth cworth at cworth.org
Thu Jan 6 23:07:07 PST 2005


On Thu, 23 Sep 2004 12:29:30 -0700, Bill Spitzak wrote:
> I wish, I suggested this a long time ago. Unfortunatly the set of compositing 
> operators include ones which modify outside the path, so you cannot reduce 
> the clip+path to a single path.
> 
> My suggestion was:
> 
> 1. get rid of all operators that can modify a pixel outside the path (or when 
> the alpha is zero in a source pattern).

Will the recent proposals to fix clipping obviate the need to drop all
these operators in your view?

> 2. Add a "invert path" operator that makes the "interior" of the path be 
> everything outside it, rather than inside it.
> 
> The purpose is so that the backend can think about a single alpha channel 
> rather than two, thus removing one term from all the compositing functions. 
> It would also allow path+clip to be turned into a single path.

It seems that the new clip specification still doesn't allow path and
clip to be combined.

> Invert-path is also vital in order to "clip out" a shape, which is currenlty 
> impossible in the current Cairo scheme.

Now that's a more compelling argument to me. I don't want things to be
impossible.

Rather than "invert path" though, how about extending the fill rules
to do the inversion? Maybe something like:

	typedef enum cairo_fill_rule {
	    CAIRO_FILL_RULE_WINDING,
	    CAIRO_FILL_RULE_EVEN_ODD,
	    CAIRO_FILL_RULE_INVERSE_WINDING,
	    CAIRO_FILL_RULE_INVERSE_EVEN_ODD
	} cairo_fill_rule_t;

Both cairo_fill and cairo_clip are already defined to use this fill
rule.

And this approach keeps the infinities in the operators, not the
operands. (Besides, even if we did add "invert path", I think the fill
rule modification more closely matches what would actually be
implemented).

-Carl



More information about the cairo mailing list