[cairo] too long lines?
Fried, Vojtech
vojtech.fried at streamserve.com
Wed Dec 15 03:53:57 PST 2010
Hi,
I have a following pycairo sample and it seems to be that the black
lines are too long. They cross the red rectangle (their bounding box) at
the bottom corners. It is even more than one pixel outside the
rectangle. See http://yfrog.com/f/6clonglinesp
Am I doing anything wrong? (cairo 1.10, all surfaces I tried, both linux
and windows)
Here is the code:
import cairo
surf = cairo.ImageSurface( cairo.FORMAT_ARGB32, 200, 200 )
cairoctx = cairo.Context( surf )
cairoctx.rectangle( 0.0, 0.0, 200, 200 )
pat = cairo.SolidPattern( 1.0, 1.0, 1.0 )
cairoctx.set_source( pat )
cairoctx.fill()
cairoctx.set_antialias( cairo.ANTIALIAS_GRAY )
cairoctx.set_line_width( 1.0 )
#black lines
cairoctx.set_source_rgba( 0.0, 0.0, 0.0 )
cairoctx.move_to( 10, 110 )
cairoctx.line_to( 55, 10 )
cairoctx.line_to( 110, 110 )
cairoctx.line_to( 55, 55 )
cairoctx.close_path()
cairoctx.stroke()
#red bounding box
cairoctx.set_source_rgba( 1.0, 0.0, 0.0 )
cairoctx.rectangle( 10, 10, 100, 100 )
cairoctx.stroke()
surf.write_to_png( "out.png" )
surf.finish()
/Vojtech
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20101215/cfce0308/attachment.html>
More information about the cairo
mailing list