[cairo] How to draw paths with different registration points?

Stuart Axon stuaxo2 at yahoo.com
Fri Jan 29 02:55:27 PST 2010


Hi,
   In the Shoebot project were implementing the Nodebox api using Cairo.  
I wonder if anyone on the cairo list would know how we can implement something:


Nodebox lets you set the registration point of paths drawn 
(when you draw a shape in NB it creates a path)

This is set using the transform mode, which can change during the script:



transform(mode=CORNER)
In this case the current cursor position is the top-left of any path that will be drawn.


transform(mode=CENTER)
In this case the current cursor position is the middle of any path that will be drawn.



Having some sort of sub-surface might make sense here, but it's too slow for us to use image surfaces for this
(really we just want the bottom surface to be the image).

Calculating the center of the path manually in python also seems like a bad plan for performance.
 

Any ideas ?
(- is this something the new meta surfaces could help with ?)

S++



      


More information about the cairo mailing list