[cairo] Premultiplied transparency causes streaks in images

Bill Spitzak spitzak at gmail.com
Fri Nov 12 14:57:42 PST 2010


I don't think there is any way around having to use another buffer for 
the brush stroke.

However using MIN (or MAX if the brush is 0 in the transparent areas and 
1 where opaque) would be a way to create this buffer from an antialiased 
or partially-transparent brush at the same resolution as the final 
image. There is no need for the super-sampling I suggested.

M Joonas Pihlaja wrote:
> On Fri, 12 Nov 2010, Bill Spitzak wrote:
> 
>> The real solution is to somehow figure out the exact antialiasing of the
>> entire brush stroke. I think modern programs just do this by making a much
>> bigger "stroke buffer" where the a much larger aliased brush draws opaque,
> 
> If you could composite the brush using MIN() on the alpha component,
> then you could generate a mask that preserves the antialiasing
> reasonably but afaict, there's no easy way to do this using pure cairo
> calls.  Andrea Canciani suggested using the new DARKEN operator to
> create a greyscale version of the mask (implements MIN() on the colour
> components, but sadly not alpha) and then converting that to an A8
> mask.
> 
> Joonas


More information about the cairo mailing list