<div dir="ltr">No non-linear blending does not cause this artifact when both the background and lines are the same color.<div><br></div><div>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)</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 21, 2024 at 6:57 AM Bandi-T <<a href="mailto:bandit@surfnonstop.com">bandit@surfnonstop.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div>
<p>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:
<a href="https://pixls.us/articles/users-guide-to-high-bit-depth-gimp-2-9-2-part-2/" target="_blank">https://pixls.us/articles/users-guide-to-high-bit-depth-gimp-2-9-2-part-2/</a></p>
<p>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).</p>
<p>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.<br>
</p>
<div>2024. 04. 20. 18:38 keltezéssel,
Richard Rosenman írta:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hi there;
<div dir="ltr">
<div> </div>
<div> I am using Cairo within After
Effects for development using the After Effects SDK. </div>
<div> </div>
<div> However, I am getting a strange
faint halo around my fill / stroke antialiasing. Can you see
the faint greenish outline within the yellow: </div>
<div> </div>
<div> <img style="max-width: 100%;" alt="image.png" src="cid:ii_18f001c0dafcb971f161"> </div>
<div> </div>
<div> If I disable antialiasing, it
disappears but of course we need antialiasing. </div>
<div> </div>
<div> Do you have any ideas why this is
happening and how I could fix it? </div>
<div> </div>
<div> Thanks, </div>
<div> -Richard </div>
<div> </div>
<div>
<div> <span style="font-size:10pt"><em><strong>Richard
Rosenman <span style="color:rgb(128,128,128)">//</span> </strong></em></span><span style="font-size:9pt;color:rgb(128,128,128)"><em>Creative
Director</em></span> </div>
<div> <span style="font-size:9pt"><em><span style="color:rgb(128,128,128)">Hatch Studios Ltd. // </span></em></span><span style="font-size:9pt"><em><span style="color:rgb(128,128,128)">1.416.565.6609</span></em></span>
</div>
<div> <em><a href="mailto:richard@hatchstudios.com" target="_blank"><span style="font-size:9pt"><span style="color:rgb(0,153,255)">richard@hatchstudios.com</span></span></a></em>
</div>
<div> <em><a href="http://hatchstudios.com" target="_blank"><span style="font-size:9pt"><span style="color:rgb(0,153,255)">http://hatchstudios.com</span></span></a></em>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote></div>