mixed path/stroke ctm bug

David Maxwell <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Hi:

The snippet of python code included at the end of this email results in two very different outcomes depending on the value of 'h'.  If h is nonzero and small, but not too small,  then the rendered image is nearly a square.  If h=0.0, then the coordinates of the square seem to have collapsed unexpectedly and the rendered image is a line. Changing the amount of rotation in 'angle' results in different garbling of the coordinates of the corners, but only if 'h' is very close to zero.

The code is trying to express the coordinates of the path in one coordinate system, and then just prior to stroking change coordinate systems so as to allow for  a different pen shape, for example.  

Is this a bug?  I'm using cairo 1.8.10 on OS X built using macports.

-David


import cairo

L=72/2.54
circle=2*3.14159
angle = circle*1./8
h=0.01

surface = cairo.PDFSurface ("ASquare.pdf", 3*L,3*L)

ctx = cairo.Context(surface)
ctx.move_to(L,L)
ctx.line_to(2*L,L)
ctx.line_to(2*L,2*L+h)
ctx.line_to(L,2*L)
ctx.close_path()

penMatrix = cairo.Matrix()
penMatrix.rotate(angle)
ctx.set_matrix(penMatrix)
ctx.stroke()

surface.finish()

--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.