[cairo] A diagram for criticism/comments

Carl Worth cworth at cworth.org
Thu Dec 13 11:30:02 PST 2007


On Thu, 13 Dec 2007 19:45:06 +0200, Donn wrote:
> I like your diagram, it confirms my thoughts today that one can say (from a
> fairly abstract high level) that all the real "drawing" happens on the *mask*
> and only 'Action' (Behdad's term) commands commit the "ink" to the Surface.

I wouldn't describe it that way.

Seen from one viewpoint, cairo only has one drawing operation, and it
does "commit the ink" to the destination surface. This drawing
operation is exposed in the cairo API as cairo_mask---it accepts an
explicit mask pattern and implicitly uses the source pattern set
earlier.

Now, cairo_mask is probably the least commonly used drawing
operation. But that's only because there are 4 variants of it that are
more convenient, (cairo_stroke, cairo_fill, cairo_show_text/glyphs,
and cairo_paint). These variants each provide a convenient mechanism
for constructing a desired mask, (from the path for stroke/fill, from
a font for show_text/glyphs, and the trivial, infinitely large mask
for paint).

So those are the 5 drawing operations.

And I don't think anything else should be described as
"drawing". There are things that construct a path, and there are
things that set transformations and options, but I wouldn't call any
of those "drawing". In particular, none of these things "draw on a
mask". Instead an operation like cairo_fill might construct a mask
implicitly from the current path as part of doing its drawing, but it
also might not need to construct a mask at all, (see what happens with
cairo_fill in the PDF backend for example---it simply emits the path).

> I will most likely do a series of diagrams to avoid clutter, while keeping
> each one as dense as needed. They should be clear as to where each one would
> slot into the main one. Right now it's more of a struggle to get the concepts
> right - I'll lay it out better after that.

Personally, I'm glad to help straighten out concepts as best I can. I
think I'd be quite useless at laying things out---so I'm glad to have
you doing the work that's actually hard.

> Anyway, the working version 1.1 is attached.

I think it's a lot better, well done! I'd like to see a more obvious
connection from the appearance of the source and the final result on
the destination. For example, the source should be drawn with the same
perspective as the mask and destination---it's effectively another
layer.

Also, to avoid confusion, it might be good if the result ended up in
the upper-left corner of the destination, since that's where the origin
is in cairo, (as opposed to systems like PostScript where the origin
is at the lower-left). Or wait... is the result happening in the
upper-left corner already and we're just seeing the destination
sideways? I think having "cairo" written rotated like that could be
confusing.

-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.cairographics.org/archives/cairo/attachments/20071213/2f115411/attachment.pgp 


More information about the cairo mailing list