[cairo] Transformation order : erratum

Gian Mario Tagliaretti g.tagliaretti at gmail.com
Fri Dec 8 09:58:48 PST 2006


2006/12/5, mydevel at free.fr <mydevel at free.fr>:
> On Monday 04 December 2006 00:59, Behdad Esfahbod wrote:

> > Do you mind sending us a minimal test case?
> Here its is - note that I'm a pythonist, so I use pycairo :
[snip python version]

C version of your python testcase

#include <cairo.h>
#include <cairo-pdf.h>

#define SIZE 500

int
main (void)
{
    cairo_surface_t *surface_p, *surface_i;
    cairo_t *cr;
    const char *filename_p, *filename_i;

    filename_p = "pdf-test.pdf";
    filename_i = "png-test.pdf";

    surface_p = cairo_pdf_surface_create (filename_p, SIZE, SIZE);
	cr = cairo_create (surface_p);

    surface_i = cairo_image_surface_create_from_png("image.png");

    cairo_translate(cr, SIZE/2, 0);
    cairo_scale(cr, 0.2, 0.4);

    cairo_set_source_surface(cr, surface_i, 0, 0);

    cairo_paint(cr);

    cairo_surface_write_to_png(surface_p, filename_i);

    cairo_show_page(cr);

    cairo_surface_finish(surface_p);
}

cheers
-- 
Gian Mario Tagliaretti
http://www.parafernalia.org/pygtk/


More information about the cairo mailing list