[cairo] Drawing Single Pixel Lines

Stefan Salewski mail at ssalewski.de
Tue Dec 29 14:47:50 PST 2015

On Tue, 2015-12-29 at 15:25 -0700, Dan Raymond wrote:
> As I recall, integer coordinates will refer to positions between 
> pixels.  If you add 0.5 to your coordinates then you will draw the
> line 
> at the center of the pixel and it will be possible to have a single 
> pixel width line.

He already known that, see
> know that in the FAQ a line width of 2.0 is recommended : 
> http://cairographics.org/FAQ/#sharp_lines.


your mentioned Suse version seems to be more than 6 years old -- why do
you care?

In the last 5 years cairo drawing has always worked fine for me, see 
http://ssalewski.de/PetEd.html.en. But there is some effort to get sharp
lines unfortunately.

What you may try is


to set antialias to none. I tried that many years ago but was not happy
with the results, maybe now it works better.

Of course for thin lines color is important, when line color is very
similar to background color thin lines may become invisible.

Now in these days UHD (4k) displays are common, so I would really like a
fast drawing mode without antialias with good hardware support :-)

More information about the cairo mailing list