[Xr] Xr API comments

Bill Spitzak spitzak at d2.com
Tue May 27 11:17:36 PDT 2003

On Monday 26 May 2003 05:44 am, Carl Worth wrote:

> I still feel pretty good about the XrArc, XrArcNegative, and XrArcTo
> API proposed there.
> The only remaining problem is that I need an implementation that can
> break an elliptical arc into a sufficient number of cubic splines so
> that the splines approximate the arc within a specified tolerance
> value. Any help or pointers here would be most appreciated.

I think some people would like to see arcs treated directly by converting 
them into straight lines, rather than going to an intermediate step of 
turning them into Bezier and then into straight lines.

In any case I remember checking this on a Postscript printer by setting the 
error value extremely large, so that the straight lines revealed where the 
beziers were. It appeared that Postscript converted a circle into 8 beziers. 
Any smaller arc seemed to be made by cutting out the correct section of the 
circle, ie if an arc went from -5 to 50 degrees, it would have a 45 degree 
bezier in the middle and a 5 on each end. They may have done this so that 
arcs drawn with different end points would occupy exactly the same pixels 
over most of their length.

>  > I am specifically talking about shapes that are supported by SVG,
>  > such as arcs, ellipses, rounded rectangles. Xr already has
>  > 'path'.
> Xr will remain more like PostScript rather than SVG in that everything
> is a path and the only way to draw is with XrStroke or XrFill.

I don't think SVG has a different drawing model, just some more operators 
that construct paths. It may be a good idea to support these when it is not 
obvious how to convert them into the Xr primitives. I seem to recall SVG had 
several calls to create conic sections, and a quadratic curve (a bezier with 
3 points instead of 4), and perhaps these should be added to the 
path-building. However things like rounded rectangles it is obvious how to 
convert them to lines and arcs, so they should not be in Xr.

                   ,~,~,~,~ ~ ~ ~ ~
     /\_       _|_========___         Bill Spitzak
 ~~~/\/\\~~~~~~\____________/~~~~~~~~ spitzak at d2.com

More information about the cairo mailing list