[cairo] defining CLAMP extend mode

Bill Spitzak spitzak at d2.com
Wed Oct 25 13:26:22 PDT 2006

Owen Taylor wrote:

> What I was saying was simply that if we add a new extend mode
> EXTEND_CLAMP, say, that has the meaning:
>  "Sample with EXTEND_PAD then multiple the image by a mask of the 
>   transformed source"
> Then we've taken away the ability of the application to choose their
> own path for a fill, because if the application's fill has segments
> that match the boundaries of the transformed source, you'll have
> antialiasing problems.
> 					- Owen

Except the problem is *worse* with the current mode, as the edge of the 
image is the antialiased resampling of the pixels with a black edge 
pixel mixed in. If the scale is greater than 1 then this is going to be 
blurrier than the antialiased rectangle I want, and at scales less than 
1 it is the exact same value.

In both the current version and this proposal, the way to avoid this 
problem is to turn off the clipping.

Furthermore, the correct image could be produced by doing a MIN 
operation between the rectangle and the path rather than mulitplying it. 
Though MIN normally produces Mach bands, this is not a problem when the 
transparent part is only 1 pixel thick. The compositing operation would 
then be somewhat more complex:

   ((source IN (rectangle MIN path)) OP dest) IN clip + dest OUT clip

More information about the cairo mailing list