Bug 4182 - Add a "clamp" extend mode.
Summary: Add a "clamp" extend mode.
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: 1.1.1
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Billy Biggs
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-22 09:05 UTC by Owen Taylor
Modified: 2005-10-08 16:27 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Patch (10.06 KB, patch)
2005-10-09 08:48 UTC, Billy Biggs
Details | Splinter Review

Description Owen Taylor 2005-08-22 09:05:19 UTC
typedef enum _cairo_extend {
    CAIRO_EXTEND_NONE,
    CAIRO_EXTEND_REPEAT,
    CAIRO_EXTEND_REFLECT
} cairo_extend_t;

Is missing one of the most commonly needed extend modes - using the
nearest pixel within the image. A common usage of this is when you
want to scale an image with a "hard edge" but with filtering of its
contents. EXTEND_NONE fuzzes out the edges.

See: 

http://lists.freedesktop.org/archives/cairo/2005-July/004487.html

and followups for one example of this problem. (Message unfortunately
munged out of recognition by pipermail, but I'll leave the link in
hopes that will be fixed at some point without renumbering the 
archives.)
Comment 1 Carl Worth 2005-08-22 17:14:13 UTC
Move bugs against "cvs" version to "0.9.3" so we can remove the "cvs" version.
Comment 2 Billy Biggs 2005-10-09 08:43:37 UTC
davidr and I have a patch we would like reviewed.
Comment 3 Billy Biggs 2005-10-09 08:48:11 UTC
Created attachment 3522 [details] [review]
Patch

The difficult issue with this patch is that we are proposing
that CAIRO_EXTEND_NONE work the same with images as
well as gradients.  Currently when rendering gradients, using
CAIRO_EXTEND_NONE gives you a gradient with the "nearest"
extend behaviour.  Our proposed change fixes this bug.
Comment 4 Billy Biggs 2005-10-09 09:22:43 UTC
We talked to cworth and otaylor about the changes.  The break in
this change is that code which explicitly asked for EXTEND_NONE
for gradients would get the NEAREST behaviour in 1.0.  However,
given the way NONE is defined, this seems to be truly a bug fix and
not an API change.
Comment 5 Carl Worth 2005-10-09 09:27:12 UTC
[I wrote this before Billy resolved the bug---but here it is rather than
throwing it away.]

CAIRO_EXTEND_NONE should work the same for all patterns, (by extending as
transparent). What we shouldn't change is the default behavior of gradients,
(which have been extending as NEAREST even though the default was nominally NONE).

So I like the patch, it adds NEAREST and changes gradient extent to NEAREST to
preserve the current behavior. I assume it also fixes the behavior of NONE for
gradients, (which is a bug fix and hopefully won't cause any compatibility
problems).

Different extend defaults for different pattern types is a bit goofy, but does
give the desired (and compatible) behavior. The last thing I see missing here is
documentation for the different extend modes, and documentation for the default
extend modes for the various patterns.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.