[cairo] Extending XRender to support non-blurry edges for transformations(?)

Owen Taylor otaylor at redhat.com
Thu Jul 31 05:23:12 PDT 2008


On Thu, 2008-07-31 at 03:18 +0200, Clemens Eisserer wrote:
> Hi again,
> 
> > It's easy to describe the high-level result desired, (a rotated, scaled
> > image with internal blurring but no blurring on the edges). And it's
> > possible to achieve that result with cairo, (EXTEND_PAD,
> > cairo_rectangle, cairo_fill).
> 
> I think I've found a solution which does not have the need for
> explicit geometry generation:
> Simply use a mask which has the same dimensions as the original image
> (can also be a larger mask restricted with clipping), set a billinear
> filter on the source and a nearest on the mask and after that apply
> the same transformation to both source and mask.
> It should give the desired result when REPEAT_PAD (or for cairo:
> EXTEND_PAD) is used.
> 
> I am not 100% sure it works, because Xorg for now doesn't implement
> REPEAT_PAD, but as far as I can imagine it should?

Multiple problems:

 - You'll get fuzzing out towards the edges of the pixels that are
   present in the mask... the same way if you drew a transformed
   rectangle and used EXTEND_NONE rather than EXTEND_PAD for the
   repeat mode.

 - No antialiasing, so it might look OK (except for the fuzzing out
   problem mentioned above) for scaling, but isn't going to look
   OK for rotation.

- Owen




More information about the cairo mailing list