[cairo] PNG functions update

Kristian Høgsberg krh at bitplanet.net
Mon Apr 25 21:51:59 PDT 2005


Hi,

I've just committed a couple of updates to the PNG functions that Carl
and I discussed in IRC around a week ago:

      * cairo_image_surface_create_for_png() has been renamed to
        cairo_image_surface_create_from_png().  Originally 'for' was
        chosen for consistency with the other surface constructors, but
        the convention we're using now is that if the resource passed to
        the constructor is only used during surface construction we use
        'from'.  This is the case for the file passed to the PNG image
        surface constructor, but for example,
        cairo_xlib_surface_create_for_pixmap() use the Pixmap throughout
        it's lifetime, thus in that case we use 'for'.

      * The PNG functions have been changed to take filenames instead of
        FILE pointers as arguments.  There are a couple of reasons for
        this change; we avoid pulling in stdio.h in the cairo headers,
        plus with the introduction of the general stream based functions
        described below, we can make the existing PNG functions a little
        more convenient to use.

      * I've added cairo_image_surface_create_from_png_stream() and
        cairo_surface_write_png_to_stream() which take a read function
        pointer or a write function pointer respectively and use that
        for PNG image I/O.  In general, we'll try to use 'stream'
        whenever we're doing callback based I/O.  I'll change the PDF
        backend constructor to be cairo_pdf_surface_create_for_stream()
        as well.

      * Added image surface width and height getters, and removed the
        corresponding out arguments from the PNG image surface
        constructor.

      * Got rid of cairo-png.h and moved prototypes to cairo.h.

cheers,
Kristian





More information about the cairo mailing list