[cairo] Regarding setting the origin of surface...

Andrea Canciani ranma42 at gmail.com
Tue Jan 3 11:09:11 PST 2012

On Tue, Jan 3, 2012 at 7:34 PM, swati upadhyaya
<swatiupadhyaya at gmail.com> wrote:
> Hi....
> I am using
>   cairo_image_surface_create_for_data (unsigned char *data,
>                                                          cairo_format_t
> format,
>                                                          int width,
>                                                          int height,
>                                                          int stride);
> to create the surface.... But I want to set the origin of this surface to
> some coordinate(x ,y) and I am not able to do it. Its mentioned in document
> that its start from top left.. But for my thing I have to set this start of
> surface somewhere from the middle.
> Please let me know how to do thi as I didnt find any thing to shift the
> origin

The API documentation is your friend ;)

If you are using the surface as a destination you probably want to use:
cairo_translate(cr, x_off, y_off);

In some special cases you might want to use
cairo_surface_set_device_offset(surface, x_offset, y_offset);


> regards
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo

More information about the cairo mailing list