[cairo] API Shakeup: Simplifying the operator set
Carl Worth
cworth at cworth.org
Wed Feb 23 08:19:03 PST 2005
As part if the API Shakeup, I'd like to renew a less-aggressive version
of my earlier proposal to simplify the operator set. I now propose:
typedef enum cairo_operator {
CAIRO_OPERATOR_CLEAR,
CAIRO_OPERATOR_SOURCE,
CAIRO_OPERATOR_OVER,
CAIRO_OPERATOR_IN,
CAIRO_OPERATOR_OUT,
CAIRO_OPERATOR_ATOP,
CAIRO_OPERATOR_DEST,
CAIRO_OPERATOR_DEST_OVER,
CAIRO_OPERATOR_DEST_IN,
CAIRO_OPERATOR_DEST_OUT,
CAIRO_OPERATOR_DEST_ATOP,
CAIRO_OPERATOR_XOR,
CAIRO_OPERATOR_ADD,
CAIRO_OPERATOR_SATURATE
} cairo_operator_t;
As before, the primary change here is in naming convention. SRC is
expanded to SOURCE and DST to DEST. (Keith put his foot down before I
could expand that to DESTINATION).
The OP_REVERSE convention is also changed to DEST_OP and these are
re-ordered to group all SOURCE and DEST operators, (which hopefully
makes them easier to learn).
Unlike my earlier proposal, this does not eliminate any of the
Porter/Duff operators that I had nominated for the axe before, (Owen
recently found a good use for ATOP). And Keith makes a fairly
compelling argument in favor of algebraic completeness, (even the
no-op CAIRO_OPERATOR_DEST might come in handy as a graphical analog of
#if 0, who knows?).
I've decided against trying to invent new, more intuitive names for
existing Porter/Duff operators. While in some cases there are
reasonable alternative names, I don't think we could be equally
successful across the board, so I think we'd end up just being
different without much benefit.
Also, names like DEST_OVER (as opposed to say, UNDER), will receive
reinforcement from other systems that have adopted a similar
convention, (eg. "dst-over" in SVG).
We still do have room to add other, "fancier", compositing operators
in the future.
-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/20050223/95358d8c/attachment.pgp
More information about the cairo
mailing list