Re: Drawing Single Pixel Lines

Dan Raymond <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
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.


On 12/29/2015 3:00 PM, Christos Sotiriou wrote:
> Hello,
>
> for an application using GTK and Cairo for its back-end I am drawing 
> to *integer* *coordinates* (cairo scale is 1) for efficiency using 
> simple cairo function calls.
>
> I would like to draw single pixel lines. In Cairo version 
> cairo-1.14.0-2.fc20.x86_64, using a line width of *1 (or 1.0)* works fine.
>
> In Cairo version 1.8.8-2.1.48 (Suse) a line width of 1 does not draw 
> the line at all, or draws halfway.
>
> When I change the line width to *2 (or 2.0)*, the line is drawn. I 
> know that in the FAQ a line width of 2.0 is recommended : 
> http://cairographics.org/FAQ/#sharp_lines.
>
> Is this the only solution, i.e. to change the line width to 2.0? When 
> I do that the lines appear slightly thicker that I would like!
>
> Thank you for your help,
>
> Christos.
>
> -- 
> --------------------------------------------------------------------------
> Christos P. Sotiriou
> email: [email protected] <mailto:[email protected]>
> Cell (GR): +30 697 8984 222
> Cell (US): +1 858 247 9436
>
>

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.