[cairo] cairo internal design ideas

Paul Sladen xr at paul.sladen.org
Thu Sep 23 03:31:35 PDT 2004

On Thu, 23 Sep 2004 dirk.schoenberger at sz-online.de wrote:

Hello Dirk,

> >   2 w                   % stroke width
> >   0.3 0 0 RG            % fill colour
> >   0 g                   % stroke colour
> >   0 0 m                 % moveto bottom left
> >   100 0 l               % bottom right
> >   70 20  30 20  0 0 c   % arc, right, left, back to start.
> >   b                     % closepath, then fill, then stroke
> But this would mean that the set of "drawing primitives" in cairo should
> be extended, no?

No, ...With the possible exception of keeping 'arc' a high-level operator;  
Postscript and SVG both have arc facilities, whilst PDF does not.

However, Postscript's' pathforall only handles moveto, lineto, curveto,
closepath;  arc's unfortunately have to be approximated with curves.

> Currently we have only moveto, curveto, lineto,

This are the commands above:  m == moveto, l == lineto, c == curveto.

> while e.g. the SVG operators (horizontal lineto, cubic bezier curve
> segment and such, are "flattened" to the basic operators.

Horizontal lineto should be flattened to lineto as you say;  it can be
`unflattened' through analysis if needed.  Cubic Bezier is a native
operator.  However, Postscript/PDF do not have a Quadratic Bezier operator
(as used in Truetype fonts).

> From what I understood, the more high level operations are rather
> different between the "Postscript and descendants" graphics APIs, ie
> Postscript, PDF, SVG.

Postscript, PDF and SVG, all use the same basic imaging model (PDF and SVG
add Porter-Duff transparency).

Would you be happy with me sending this to the list?

Is there no safe way to travel?  Nottingham, GB

More information about the cairo mailing list