Cairo Antialiasing Outline Issue?

Bill Spitzak spitzak at gmail.com
Sun Apr 21 10:13:22 UTC 2024


No non-linear blending does not cause this artifact when both the
background and lines are the same color.

This may be a precision error. The premultiplied value of either the
foreground or background may be rounded to the nearest 8-bit value. The
correct solution is to premultiply the foreground as round(A*a) and to
premultiply the background as B-round(B*a)



On Sun, Apr 21, 2024 at 6:57 AM Bandi-T <bandit at surfnonstop.com> wrote:

> As far as I know Cairo (and/or the underlying pixman library) does not
> currently work (antialias) in linear light, but instead works directly with
> (blends) the gamma-companded RGB values; this is know to cause such color
> artifacts, very clearly demonstrated here:
> https://pixls.us/articles/users-guide-to-high-bit-depth-gimp-2-9-2-part-2/
>
> Two workarounds I can suggest is either have your colors and shapes
> rendered by a GPU (most GPUs today work in liear light and can do such
> compositions correctly), or have cairo render things at a multiple of the
> size you need (e.g. 64×64 size) and then develop a downsampling routine
> that computes in linear light (and only gamma-compands the final values
> upon output).
>
> A third "workaround" (it is not a real workaround, because it is the
> solution itself) is: enhance pixman/cairo itself to do blending in linear
> light.
> 2024. 04. 20. 18:38 keltezéssel, Richard Rosenman írta:
>
> Hi there;
>
> I am using Cairo within After Effects for development using the After
> Effects SDK.
>
> However, I am getting a strange faint halo around my fill / stroke
> antialiasing. Can you see the faint greenish outline within the yellow:
>
> [image: image.png]
>
> If I disable antialiasing, it disappears but of course we need
> antialiasing.
>
> Do you have any ideas why this is happening and how I could fix it?
>
> Thanks,
> -Richard
>
> *Richard Rosenman // **Creative Director*
> *Hatch Studios Ltd. // **1.416.565.6609*
> *richard at hatchstudios.com <richard at hatchstudios.com>*
> *http://hatchstudios.com <http://hatchstudios.com>*
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20240421/f56b89bf/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 9497 bytes
Desc: not available
URL: <https://lists.cairographics.org/archives/cairo/attachments/20240421/f56b89bf/attachment.png>


More information about the cairo mailing list