[cairo] Cleaning up the PDF API

Carl Worth cworth at cworth.org
Thu May 12 15:50:54 PDT 2005


The interface in cairo-pdf.h needs a little bit of cleaning up. Some
of this we've discussed before. Here are the issues I see:

1) cairo_pdf_surface_create should accept a "const char *filename"
   rather than a FILE*.

2) cairo_pdf_surface_create_for_callback should be renamed to
   cairo_pdf_surface_create_for_stream.

3) Both functions should be changed to accept width and height in
   device-space units, (points), rather than inches.

4) For both functions the pixels_per_inch parameters should be removed
   from surface_create. I believe these values are only used to
   control the resolution used for image-based fallbacks (if any). So
   we can just declare a default value, (300 DPI, perhaps?), and add a
   new function to change that.

5) Why does cairo_pdf_surface_create_for_callback require a
   cairo_destroy_func_t? This adds extra pain in using the interface,
   and couldn't the same result be achieved by means of
   cairo_surface_set_user_data? If we eliminate that function, then
   we'd have good consistency among the three current "for_stream"
   functions, (all would accept either a cairo_write_func_t or a
   cairo_read_func_t and then a void *closure).

I think it would be nice to get these changes in place before the
imminent 0.5 snapshot. I can take a whack at these if nobody beats me
to it.

-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/20050512/5b9a3e92/attachment.pgp


More information about the cairo mailing list