[cairo] src surface clip problems
Carl Worth
cworth at cworth.org
Thu Aug 17 16:10:11 PDT 2006
On Thu, 17 Aug 2006 14:53:55 -0700, "Vladimir Vukicevic" wrote:
> > > (Note that the resulting image still isn't correct, due to broken
> > > pixman upscaling -- in particular, the left and right edges should be
> > > solid green, and not green-mixed-with-.. black? transparent black?
> > > something.)
...
> Yep, I'm looking at the left and right edges of the image, not the
> green-to-blue transition (which is correct). pixman has all pixels
> that are not contained within the image as transparent black; the
> problem is that the sampling functions don't take into account image
> edges at all, and instead read from the transparent black
> out-of-bounds region even if they're not part of the compositing
> operation. Specifically, the leftmost and rightmost column of pixels
> in that image sould be solid green, not (0.25,0.75,0.0).
Ah, so I was looking at the wrong pixels.
Now, the cairo semantics for reading from the "outside" portions of a
pattern depend on the extend mode of the pattern, (please see
cairo_pattern_set_extend). For surface patterns, the default extend
mode is EXTEND_NONE which means that any read from outside the surface
will be transparent black. So the result does seem consistent.
Note: The reason we have the default extend mode for surface patterns
as EXTEND_NONE is so that the idiom of:
cairo_set_source_surface (cr, surface, x, y);
cairo_paint (cr);
can be used to copy an image to x,y.
So I think the result you are seeing is exactly correct.
Though, obviously one should be able to get the result you actually
expected. To this end we added a setting of EXTEND_PAD between cairo
1.0 and 1.2. Unfortunately, we noticed just before releasing cairo
1.2.0 that while EXTEND_PAD had been implemented for gradients, it
hadn't yet been implemented for surface patterns (oops!).
So we noted that in the documentation for 1.2, but it hasn't been
fixed yet.
I just added this bug to the roadmap for cairo 1.4.
-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060817/77062c63/attachment.pgp
More information about the cairo
mailing list