[cairo] API shakeup: png function names

Owen Taylor otaylor at redhat.com
Mon Apr 4 11:24:35 PDT 2005

On Mon, 2005-04-04 at 11:07 -0700, Bill Spitzak wrote:
> How about "cairo_image_surface_create_from_png" (replace "for" with 
> "from")? I'm also wondering why the word "image" is in there, since this 
> returns a surface, and I don't see how it could return any other type of 
> surface than an "image" one. How about shortening it to 
> "cairo_surface_create_from_png"?

Subclasses of CairoSurface can have specific operations on them, 
like cairo_xlib_surface_set_size().  

cairo_image_surface_create_for_png() is thus a constructor for 
CairoImageSurface... currently constructors for <foo> are

Related to that, I'd like to see the *width, *height out parameters
vanish from the signature, to be replaced with getters on
cairo_surface() or cairo_image_surface() (*). Some surfaces don't
necessarily have a size ... that's why it *might* belong to 

On the other hand, many surfaces do have a size, so putting them on
CairoSurface and returning -1 to mean "unknown" might be simpler.


(*) Why? Multiple return values don't bind well in all languages,
    and they make the function signature less obvious and harder
    to remember.

P.S. - _from_png() would also be considerably more natural to me 
       as well.

-------------- 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/20050404/0b9527e1/attachment.pgp

More information about the cairo mailing list