[Xr] Xr API comments

Soorya Kuloor skuloor at verano.com
Mon May 26 08:40:35 PDT 2003

On Mon, 2003-05-26 at 06:44, Carl Worth wrote:
> On May 23, Soorya Kuloor wrote:
>  > After using the Xr API for a while, here are some thoughts:
> Thanks Soorya. Feedback from those with experience is quite needed
> right now.
>  > * XrSave() and XrRestore() function names are a bit confusing. XrPush()
>  > and XrPop() may be better names?. Other libraries seem to use the
>  > push/pop names (Eclipse draw2d, Java2D).
> Save/restore come from PostScript and we've been trying to avoid
> gratuitous inconsistency with PostScript.

OK makes sense then.

> On the other hand, I do want to add back the functions for drawing to
> a temporary surface. The current proposed names for those are
> XrPushGroup/XrPopGroup. So for internal consistency it may make sense
> to switch to XrPush/XrPop as well.
>  > * Are there any plans to provide 'higher level' shape related functions
>  > in Xr API, such as drawing ellipses, curves and rectangles?
> I recently added a convenience function for adding a rectangle to the
> current path.
> I do want to add arc functions as well. I posted a proposal some time
> ago on the old render at xfree86.org list. Looks like there's an archival
> copy of the message here:
> 	http://www.mail-archive.com/render%40xfree86.org/msg00775.html
> I still feel pretty good about the XrArc, XrArcNegative, and XrArcTo
> API proposed there.

The API in there looks good. As you said elliptical arcs should be easy
to generate.

> 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'll see if I can find any, though this is a bit outside my competency

>  > 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.
> The proposal above adds circular arcs. Transforms can be used to get
> elliptical arcs. I haven't planned to add rounded rectangles, but the
> XrArcTo function should make it quite easy to construct these
> "manually" outside of Xr.

Yes, I agree. Arc was the toughest one. Ones that is done all others are
just paths with some scaling and rotation.

>  > I had to dig them out of libxsvg and copy them over into my
>  > code. Some of the shapes such as arcs are really complex.
> Yes. The only reason I haven't copied the libxsvg version into Xr is
> that it doesn't satisfy the "within a specified tolerance" constraint
> I mentioned above.

I am using that one for now. I could not find anything better. However,
I'll look around.

-- Soorya

> -Carl

More information about the cairo mailing list