[cairo] Musings on the default of EXTEND_NONE for surface patterns

Carl Worth cworth at cworth.org
Mon Apr 7 11:29:56 PDT 2008


On Mon, 07 Apr 2008 14:19:55 -0400, Antoine Azar wrote:
[Carl had previously written...]
> > One problem with this is that nobody has actually been able to define this
> > extend mode mathematically, (making it impossible to implement). So I don't
> > think that's the right answer.'
>
> It's surely not impossible to implement. When sampling your image, as long
> as your sampling coordinates are within the image bounds (plus half a pixel
> extra), you perform your sampling as we currently do for EXTEND_PAD. If your
> sample pixels falls outside those bounds, you simply sample transparent
> black (or noop). If I'm not mistaken, you'll get a nice bilinear (or bicubic
> or...) filtered image with sharp edges and nothing around. Wouldn't that
> work?

The problem is that that "plus half a pixel extra" is dependent on the
filter being used. So there has to be some magic to make the treatment
of the extend mode actually depend on details of the filtering, (which
is an entirely separate process later in the pipeline).

So not mathematically impossible, no. But it's not "just an extend
mode" in any sense that we've seen before. And there are lots of
opportunities for a fix like this to accidentally add a repeated
border of extra pixels when doing CAIRO_FILTER_NEAREST.

Basically, I think it's too DWIM of an idea---it violates the
boundaries of the pixel pipeline, creating delicate interdependencies
between them, and making it harder to reason about them separately.

And that has implications down into pixman, the Render extension, the
X server, X server drivers, etc. So I don't think it's a good
idea. Already, we know that the X server and drivers don't have event
EXTEND_REPEAT, EXTEND_PAD, and EXTEND_REFLECT working
reliably. I would not expect
EXTEND_PAD_OR_NONE_DEPENDING_ON_FILTER_BOX_SIZE to be much more
reliable.

-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.cairographics.org/archives/cairo/attachments/20080407/c95d3474/attachment.pgp 


More information about the cairo mailing list