[cairo] How can i find out the absolute (x, y) of my next cairo operation

Matt Rice ratmice at gmail.com
Sat Feb 20 14:57:39 PST 2010


On Sat, Feb 20, 2010 at 10:37 AM, hap 497 <hap497 at gmail.com> wrote:
> Hi,
>
> In cairo, I can move the 'origin' of my operation by using
> cairo_translate, like this
>
> http://www.cairographics.org/samples/
> cairo_translate (cr, 0, 128);
> cairo_rectangle (cr, 12, 12, 232, 70);
>
> The actual rectangle is drawn at 12 and 140. Can you please tell me if
> there is a way to find out the
> absolute (x,y) of my cairo operation?  I may call cairo_translate()
> multiple times in different places of my code, I just want to check
> where will be (on the screen) my cairo_rectangle will be drawn (for
> debugging purpose).

I think you want cairo_user_to_device or its cohort cairo_device_to_user
with these you should be able to convert the coordinates

http://www.cairographics.org/manual/cairo-transformations.html#cairo-user-to-device


More information about the cairo mailing list