[cairo] PATCH cairo-www: Simpler explanation for how to get sharp, single-pixel-wide lines

Bill Spitzak spitzak at gmail.com
Thu May 18 17:47:16 UTC 2017

On Thu, May 18, 2017 at 5:04 AM, Lawrence D'Oliveiro
<ldo at geek-central.gen.nz> wrote:
> On Thu, 18 May 2017 11:24:05 +0200, Guillermo Rodriguez wrote:
>> https://lists.cairographics.org/archives/cairo/2004-October/002039.html
> Worth (so to speak) also pointing out this bit:
>     As I talk about in the comment in the sample code, it may still be
>     beneficial to add some automatic snapping to cairo. It would simply
>     make it easier to achieve effects such as this---and in particular,
>     to achieve these effects regardless of what scaling the current
>     transformation might be performing.
> Was such an “automatic snapping” API ever added to Cairo? One that is
> independent of the current transformation?


> Trick question: in fact, it already existed even as he spoke.

No it does not.

> It’s precisely the effect that *aliasing* achieves.

No it is not. A diagonal line draws with aliasing artifacts when
antialiasing is off. A hinting scheme would not do this. Therefore
they are not the same, no matter how many times you claim they are.

You seem to be under the impression that it is ok to destroy all lines
that are not horizontal or vertical. I think most people here believe
that to be a very bad solution.

I fully agree that a hinting (or "automatic snapping" as you call it)
addition to Cairo would be a VERY VERY good idea as it would stop
people like you from blindly turning antialiasing off and making the
display look like crap. Cairo should be doing this itself, in the
transformed coordinates. Although there are kludges to get around it,
I suspect most software using Cairo trying to avoid these artifacts
just assume the ctm is 1:1 with pixels, and it just seems weird to
transform to display coordinates, fiddle with them, then transform
back, just so cairo can transform them all over again.

More information about the cairo mailing list