[cairo] API shakeup: png function names

Bill Spitzak spitzak at d2.com
Mon Apr 4 11:07:28 PDT 2005


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"?

Kristian Høgsberg wrote:
> John Ellson wrote:
>> I totally misinterpred the role of this function:
>>
>> cairo_surface_t *
>> cairo_image_surface_create_for_png (FILE *file,  int *width,  int 
>> *height);
>>  
>> Why not just call it:  cairo_surface_read_png  so as to be clear that 
>> it is the read counterpart to the other png function?
> 
> Well, it isn't really the counterpart.  The counterpart would read a png 
> into an existing image surface.  cairo_image_surface_create_for_png() is 
> a surface constructor and follows the naming and parameter conventions 
> for constructors.

 > A function to read a png file into a en existing surface might make
 > sense, but I'm not sure how you would get the size of the png to make
 > sure the surface is the right size.

Make it do exactly the same thing as though you created a png surface, 
then did a fill using it as a source, and then deleted the png surface.



More information about the cairo mailing list