[cairo] problem with ellipse
Chris Wilson
chris at chris-wilson.co.uk
Sun Jan 31 08:44:31 PST 2010
On Sun, 31 Jan 2010 17:17:43 +0100, nick0 <luciano_fornari at alice.it> wrote:
> ctx.move_to(Ox,Oy)
> Cx = Ox
> Cy = Oy
> ctx.arc(Cx,Cy,80,0,2*pi)
> ctx.scale(4,10)
> ctx.set_source_rgb (0, 0, 0)
> ctx.stroke()
The trick to remember is that both the path and the pen are transformed by
the current transformation matrix. So in order to draw an ellipse you need
to apply the transformation before the path and then remove it before
stroking (so the pen remains regular).
ctx.move_to(Ox,Oy)
Cx = Ox
Cy = Oy
ctx.save()
ctx.scale(4,10)
ctx.arc(Cx,Cy,80,0,2*pi)
crx.restore()
ctx.set_source_rgb (0, 0, 0)
ctx.stroke()
Hope this helps, and you have fun using Cairo!
-ickle
--
Chris Wilson, Intel Open Source Technology Centre
More information about the cairo
mailing list