[cairo] shape api

Gustavo J. A. M. Carneiro gjc at inescporto.pt
Thu Jun 16 05:36:34 PDT 2005


On Wed, 2005-06-15 at 18:40 -0400, Liam Breck wrote:
> At 09:43 AM 6/15/05 -0700, Carl Worth wrote:
> >> It would be really useful if cairo had a lightweight toolkit for common
> >> shapes and figures. It looks like a variety of such things are already
> >> implemented in svg_cairo.c ...
> >
> >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)
> 
> I would include some utilities from svg_cairo as well as shapes, e.g.
> render_image and length_to_pixel. These and other things really belong in
> some middle layer where other apps can use them, without having to maintain
> them.
> 
> >But if it were implemented as a linkable library, I think in
> >the end you'd have a huge library...
> >Maybe it would be better to make the "shape library" be a collection
> >of code snippets that could easily be pasted into applications?
> 
> I think you'd make it a shared lib included in cairo releases.
> Alternatively, users could recompile a static library after setting
> switches for the components they need. The arc_to code isn't small enough
> to meet my definition of "pastable" :-)

  If each shape has relatively little code, how about not making this a
library, but instead just install a bunch of header files with static
inline functions?  This is way more efficient than resolving another
shared library (as if we didn't have enough of those already), both in
executable loading time, and in runtime (calling inline function doesn't
cost anything, unlike calling dll functions), and if the functions are
small we'll hardly get any size increase.  You know, the linux kernel
source uses plenty of static inline functions declared in header files;
they wouldn't do so if it cost much memory, I'm sure.

  Regards.

-- 
Gustavo J. A. M. Carneiro
<gjc at inescporto.pt> <gustavo at users.sourceforge.net>
The universe is always one step beyond logic.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3086 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050616/07d56e40/smime.bin


More information about the cairo mailing list