[cairo] png streams

lafriks at hello.lv lafriks at hello.lv
Wed Feb 15 16:29:40 PST 2006


Hi,

  I'm new to cairo so I have one little question :)

I have such code:

cairo_surface_t * image = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
                                300, 300);
cairo_t * cr = cairo_create(image);
cairo_scale(cr, 300, 300);

// Draw image
do_draw(cr);

void *cl;
cairo_surface_write_to_png_stream (image, output, cl);

cairo_destroy(cr);
cairo_surface_destroy(image);

output function looks like this:

cairo_status_t output (void *closure, unsigned char *data, unsigned int length)
{
    // here goes writing data to buffer
    return CAIRO_STATUS_SUCCESS;
}

Everything is working just fine and I'm getting PNG image. Only problem is that
when compiling I'm getting such warning:
graph.c:85: warning: passing argument 2 of 'cairo_surface_write_to_png_stream'
from incompatible pointer type

What I'm doing wrong? Couldn't find any example on the web how is the correct
way to use cairo_surface_write_to_png_stream.

Thanx in advance,
Lauris
p.s. if it does change anything I'm using gcc 4.0.2 on x86_64


More information about the cairo mailing list