[cairo] Translate and scale question

Bill Spitzak spitzak at gmail.com
Wed Jul 22 11:04:04 PDT 2009


W,H = size of drawing surface.
xmin, ymin, xmax, ymax = coordinates of lower-left and upper-right corners.

scale((xmax-xmin)/W, (ymax-ymin)/H)
translate((xmax+xmin)/2, (ymax+ymin)/2)

Xenofon Papadopoulos wrote:
> Hello, I'm a Cairo newbie. I'm using Cairo in python to draw on a 
> DrawingArea with 400x300 device size, but my user coordinations system 
> ranges from x_min to x_max on the x-axis and from y_min to y_max on the 
> y-axis (for example from -10 to 10 on the x-axis, and from -20 to 20 on 
> the y-axis). What are the transformations I have to do to use user 
> coordinates in draw operations?
> Thanks
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo


More information about the cairo mailing list