[cairo] Cleaning up the PDF API

Owen Taylor otaylor at redhat.com
Mon May 16 20:22:11 PDT 2005


On Mon, 2005-05-16 at 16:59 -0700, Carl Worth wrote:
> On Mon, 16 May 2005 19:36:26 -0400, Kristian Høgsberg wrote:
> > Also, what are we trying to achieve here?  To reduce the number of
> > arguments or to make it easier to use?
> 
> Specifically, I want to unify the notion of a "stream" in the cairo
> API. Here's what we have right now:
> 
> 	cairo_surface_write_to_png_stream:
> 
> 		stream == write_func + closure
> 
> 	cairo_image_surface_create_from_png_stream:
> 
> 		stream == read_func + closure
> 
> 	cairo_pdf_surface_create_for_stream:
> 
> 		stream == write_func + destroy_func + closure
> 
> That seems inconsistent and hard-to-remember to me, (independent of
> the number of arguments required).

There is a really big difference between:

 A) Function that takes a callback function *for the scope of the call*

 B) Function that takes a callback function *and keeps it around*

In the first case you don't need anything to free the closure data.
In the second a way to free the closure data once it is no longer
in use is important. While there are some differences here, I see
no reason to expect the two circumstances to look the same.

(You can add the destroy func to the others, but it's pretty pointless.)

Regards,
						Owen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050516/a533580f/attachment.pgp


More information about the cairo mailing list