[cairo] Negative coordinates with recording surfaces
antony.lee at berkeley.edu
Thu Jul 6 18:10:36 UTC 2017
Indeed, the issue is solved as of 1.15.6 (it also appears that picking a
very small line width does not cause it to be taken as zero anymore (a
change that I'm also happy with)).
2017-07-06 2:32 GMT-07:00 Adrian Johnson <ajohnson at redneon.com>:
> Have you tried the latest snapshot (1.15.6)? 1.15.4 and later contains
> fixes for recording surfaces with negative extents.
> On 06/07/17 16:58, Antony Lee wrote:
> > Hi all,
> > I have am a bit puzzled with how negative coordinates interact with
> > recording surfaces. Consider the following cairocffi example:
> > from cairocffi import *
> > surf = RecordingSurface(CONTENT_COLOR_ALPHA, None)
> > ctx = Context(surf)
> > ctx.move_to(-5, -5)
> > ctx.line_to(5, 5)
> > ctx.set_line_width(.001) # so that ink extents are not affected by
> > linewidth
> > ctx.stroke()
> > print(surf.ink_extents())
> > This gives (-5.0, -5.0, 10.0, 10.0), so ink_extents has correctly
> > reported that we have something going from (-5, -5) to (5, 5) on the
> > unbounded surface.
> > But replace the surface constructor call by
> > surf = RecordingSurface(CONTENT_COLOR_ALPHA, (-10, -10, 20, 20))
> > which is a surface that is large enough to cover our line. (After all,
> > the documentation encourages us to specify the extents, for better
> > performance.)
> > Now the same program gives (5.0, 5.0, 5.0, 5.0). By playing around with
> > the numbers, I *guess* that the origin is relative to the lower left
> > corner of the recording surface, and the width and height are up to 0, 0
> > but not beyond?
> > Shouldn't I get instead either (-5.0, -5.0, 10.0, 10.0) (same as with an
> > unbounded surface), or at least (5.0, 5.0, 10.0, 10.0) (if the returned
> > extents are relative to the lower left corner of the surface)?
> > Thanks in advance,
> > Antony Lee
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cairo