[cairo] image alignment

Alexei Babich a.babich at rez.ru
Thu Apr 24 03:00:14 PDT 2008


Hi, all.
I want place .png image to target surface at some location.
Code (linked with cairo-1.6.4-1, on x86 Linux):
----
cairo_surface_t *surface; //target surface
cairo_surface_t *src_image; //surface with image
cairo_t *cr;

src_image = cairo_image_surface_create_from_png("img/abcd.png");
surface = (cairo_surface_t *) cairo_xlib_surface_create(display, win, visual, size_x, size_x); //Xlib surface
cr = cairo_create(surface);

cairo_set_source_surface (cr, src_image, 0,0);
cairo_rectangle(cr, 0,0,size_x,size_y);		//wuthout this cairo do nothing


cairo_fill(cr);		//fill src surface to target surface

cairo_destroy(cr);
cairo_surface_destroy(src_image);
cairo_surface_destroy(surface);
----

So, how can I place image _not_ at (0,0) coordinates on target surface, but, for example, (10,10) ?

Thank you.

-- 
Regards,
Alexei Babich, chematic engineer, OOO NPP "Rezonans", Chelyabinsk, Russia
http://www.rez.ru
Jabber ID: impatt at jabber.ru


More information about the cairo mailing list