[cairo] Change the coordinate system for drawing

craf pyclutter at gmail.com
Thu Oct 20 19:02:41 PDT 2011


Hi Everyone

I apologize if my questions are very simple, I searched the list
archives, but I've found questions similar to mine.
The English is not my first language, so try to make myself understood
with some drawings.

As I understand it, the point (0,0) is located in the upper left of the
control gtk.drawinarea.

 
 ___________________________
| 0, 1, 3, 4, ...x          |
| 1                         |
| 2                         |
| 3                         | 
| 4      gtk.DrawingArea    |  
| .                         | 
| .                         | 
| y                         |
|                           |  
|___________________________|

First Question
--------------

Is it possible to change the coordinate system only to gtk.DrawingArea,
such as?

 ___________________________
|                          |
|                          |
| y                        |
| .                        | 
| .      gtk.DrawingArea   |  
| 3                        | 
| 2                        | 
| 1                        |
| 0 1 2 3 4 ... x          |  
|__________________________|

Second Question
---------------

If you can not do gtk.DrawingArea control, you can do with a context?

Example.

. Creating a Context

context = self.drawingarea.window.cairo_create

and then change the coordinate system to the context.

 
 ___________________________
|        gtk.DrawingArea    |
|   ______________________  |
|  |                     |  |
|  | y                   |  |
|  | .                   |  | 
|  | .                   |  | 
|  | 3        context    |  | 
|  | 2                   |  | 
|  | 1                   |  |
|  | 0 1 2 3 4 ... x     |  |  
|  |_____________________|  |
|___________________________|

Conclusion
----------
I tried to use the methods, translated, rotated, transformed, but only
take effect what I want to draw, for example a curve or a line.

I appreciate any help that I may have to clarify these concepts, and I
hope to have made me understand

Best Regards.

Cristian



More information about the cairo mailing list