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

Guillermo Rodriguez guillerodriguez.dev at gmail.com
Wed May 17 10:29:15 UTC 2017


2017-05-17 11:24 GMT+02:00 Lawrence D'Oliveiro <ldo at geek-central.gen.nz>:
> On Wed, 17 May 2017 10:47:46 +0200, Guillermo Rodriguez wrote:
>
>> This simpler explanation fails to explain why this "problem"
>> occurs ...
>
> It occurs because of anti-aliasing.

No. It occurs because integer coordinates map to points half way
between sample point locations, as the original text adequately
explains.

>
>> ... and what is the rationale behind the current design.
>
> You want me to include a rationale for anti-aliasing?

I don't want you to do anything. The original text explains perfectly
why the design is like it is ("[...] so that fills align nicely, at
the cost that some strokes do not").

>
>> It also fails to discuss alternatives such as adjusting endpoints by
>> 0.5, which allows you to get sharp, single-pixel-wide lines without
>> turning off antialiasing, which in many cases is undesirable.
>
> Let me refresh your memory about the question in the FAQ:

Not needed.

>
>     Question: Whenever I try drawing with a line-width of 1.0, my
>     horizontal/vertical lines come out fat and blurry (eg. 2 pixels
>     wide and half-intensity). What's wrong?
>
> Note that it only discusses “horizontal/vertical” lines. This is the
> specific situation where turning off antialiasing is the simplest
> solution.

It may be the simplest, but it is not the only one, and in many cases
not the best one either. The solution proposed in the original text
also solves the problem without the need to turn off antialiasing.

Guillermo


More information about the cairo mailing list