[cairo] Xlib/Xcb and EXTEND_PAD
Zack Weinberg
zweinberg at mozilla.com
Tue Jan 20 14:04:52 PST 2009
Bill Spitzak <spitzak at thefoundry.co.uk> wrote:
> The problem really is that people thought that REPEAT_NONE was
> something that was wanted. They should have talked to programmers who
> have worked with image processing and texture mapping and we would
> have told them that REPEAT_PAD is the most important thing to
> support. REPEAT_NONE is trivially supported by adding a black pixel
> all around the edge and doing REPEAT_PAD.
>
> REPEAT_TILE and so on appeals to some programmers, but it seems to me
> that in the real world nobody uses repeating tiled backgrounds, or
> the backgrounds are so large that there probably is no loss in having
> the program itself draw the image repeatedly to fill it. Small
> repeating backgrounds are not used because they look very
> old-fashioned.
I don't disagree with the assertion that EXTEND_NONE is not terribly
useful nor that EXTEND_PAD is what one almost always wants; however
I think you underestimate the utility of EXTEND_REPEAT. We use it in
Mozilla for every CSS box with a background image that doesn't cover
the entire box area, which is quite common "out there" on the 'net (any
web page whose overall background is set to some kind of paper texture,
for instance).
At any rate, the installed base of Cairo is so large at this point that
I don't think your proposed change can realistically be made, and I
disagree with this statement:
> Removing the need to check the padding type from the backends would
> help a lot to force them to update to correct behavior.
... because the current set of problems with EXTEND_PAD are not in
cairo itself, but in the X video drivers, which are maintained by a
completely different group.
Tangentially, it would be very nice to be able to clip a source image
and then have the EXTEND mode apply *after* clipping; that would
eliminate several cases where we have to use a scratch surface. We
only need this for a rectangular clip region. I'm aware that there's a
dispute over what this feature ought to do for arbitrary clip regions,
but there's no definition problem for rectangles; perhaps the right API
is something like cairo_pattern_set_source_clip(rectangle).
zw
More information about the cairo
mailing list