[cairo] problem with ellipse

Pascal Germroth funkycoder at gmail.com
Sun Jan 31 08:57:19 PST 2010


Hi,

I didn't run your code, so I don't know if this is the only problem but
here:

> ctx.arc(Cx,Cy,80,0,2*pi)
> ctx.scale(4,10)
> ctx.set_source_rgb (0, 0, 0)
> ctx.stroke()

You have the transformation at the wrong position.
The path has already been created by the arc-call, you're just
transforming the pen that draws the stroke now.

It should look like:

 ctx.save() # save current matrix
 ctx.scale(4, 10) # scale the path that comes next
 ctx.translate(Cx / 4.0, Cy / 10.0) # scale at origin of circle
 ctx.arc(0,0,80,0,2*pi) # create the path
 ctx.restore() # restore the matrix
 ctx.set_source_rgb(0, 0, 0)
 ctx.stroke()

(Not sure about the translation though, might have it backwards)


-- 
pascal


More information about the cairo mailing list