[cairo] another pixman issue
spitzak at thefoundry.co.uk
Mon Mar 24 08:53:52 PDT 2008
Although this behavior makes sense, I do want to point out that this is
not what most users expect. The *expected* result is the same as:
1. Intersect the clip region with a rectangle equal to the dimensions of
the source image.
2. Draw the image with EXTEND_PAD.
3. Restore the clip region.
The result then has a "sharp" quadrilateral as a border.
This can certainly be achieved with cairo now, but I'm wondering if it
should be able to be set as a mode of the source surface. This is
because it could be much more efficient to have the source surface do
this rather than using the cairo clip region.
Soeren Sandmann wrote:
> A pixman image is an array of pixels, where the top left pixel has
> coordinates (0.5, 0.5). But the scaling actually has (0, 0) as the
> center and not (0.5, 0.5).
> In your test case, the top left destination pixel with coordinates
> (0.5, 0.5) gets transformed into (0.25, 0.25). The bilinear filter
> then finds the four closest pixels to those coordinates:
> (-0.5, -0.5), (0.5, -0.5), (-0.5, 0.5) and (0.5, 0.5).
> Three of these are outside the source image, so they are treated as
> transparent. The last one is opaque white, so the result of the
> resampling is a translucent gray.
> The pixel with coordinates (n + 0.5, k + 0.5) is stored at k * stride
> + n, so the purpose of adjust is to subtract (0.5, 0.5) from the
> transformed pixel so that the filtering code can pretend that pixels
> actually have integer coordinates.
More information about the cairo