[cairo] shape api

Carl Worth cworth at cworth.org
Wed Jun 15 09:43:23 PDT 2005


On Wed, 08 Jun 2005 16:12:28 -0400, Liam Breck wrote:
> It would be really useful if cairo had a lightweight toolkit for common
> shapes and figures.

Such a thing has been mentioned once or twice in the past.

>                     It looks like a variety of such things are already
> implemented in svg_cairo.c, and could easily be yanked into a new pair of
> source files.

I don't see that much in svg_cairo.c. I looked for shapes it has that
aren't directly supported by cairo and I only recall finding the
following three shapes:

	quadratic curves
	rounded rectangles
	arcs specified by bounding rectangle (rather than center+radius)

My gut feeling about a collection of common shapes is that there won't
actually be that much commonality. That is, higher-level objects than
what cairo supports directly are likely to also require higher levels
of application-specific specialization.

I can imagine the collection becoming quite large. Or, if the
collection is filled with parameterizable generators for greater
flexibility, I can imagine each shape generator becoming quite
complex. (Imagine the variation that could occur in something simple
like arrowheads on the end of strokes.)

This is not to say that such a shape collection could not be
useful. But if it were implemented as a linkable library, I think in
the end you'd have a huge library of which only a tiny fraction would
be used by any given application. And that probably doesn't make a lot
of sense.

Maybe it would be better to make the "shape library" be a collection
of code snippets that could easily be pasted into applications?

That's my instinct here, anyway.

Of course, I'm glad to see almost anything built on top of cairo. And
I hope you have a lot of fun and success with this.

-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/20050615/dc00f1d7/attachment.pgp


More information about the cairo mailing list