Re: Regarding setting the origin of surface...

Andrea Canciani <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAN_5=BDJ6cR5DB4euVcDBRfBQgv1gd81jpUHMEM4gjziG076Dg@mail.gmail.com>
On Tue, Jan 3, 2012 at 7:34 PM, swati upadhyaya
<[email protected]> 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 ;)
http://cairographics.org/manual/

If you are using the surface as a destination you probably want to use:
cairo_translate(cr, x_off, y_off);
http://cairographics.org/manual/cairo-Transformations.html#cairo-translate

In some special cases you might want to use
cairo_surface_set_device_offset(surface, x_offset, y_offset);
http://cairographics.org/manual/cairo-cairo-surface-t.html#cairo-surface-set-device-offset

Andrea

>
>
> regards
>
>
> --
> cairo mailing list
> [email protected]
> http://lists.cairographics.org/mailman/listinfo/cairo
--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.