[cairo] problem with ellipse
nick0
luciano_fornari at alice.it
Sun Jan 31 08:17:43 PST 2010
hello to everybody,
I'm new in ML, my name is nick :)
I started studying pycairo few days ago and I have a problem with this
code:
import cairo,sys,string
from math import pi
X,Y = 600, 400
Ox,Oy = X/2,Y/2
# Setup Cairo
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, X, Y)
ctx = cairo.Context(surface)
ctx.set_source_rgb(255, 255, 255)
ctx.paint()
ctx.set_source_rgb (0, 0, 0)
ctx.set_line_width (2.0)
# I draw cartesian axis
ctx.rectangle (0, Y/2, X,1) # x
ctx.rectangle (X/2,0, 1, Y) # y
ctx.move_to(Ox,Oy)
ctx.line_to(X,0)
ctx.stroke()
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()
If you run the code you can see the ellipse I want to obtain by scaling
the circumference but the area comprised between ellipse and
circumference is black.
I want to obtain just an ellipse... what is wrong?
Secondly where does the black rectangle come from?
Thank you, forgive my grammar errors
More information about the cairo
mailing list