[cairo] Fuzzy lines

Piotr Zurek p.zurek at gmail.com
Sun Nov 5 19:49:38 PST 2006


Hi guys,

I just wanted to ask how do you usually approach the problem of 
pixel-aligned lines in your applications.
What I tried to do is to test the current line width before the stroke 
for each path I draw. If the line width is an odd number I translate it 
by (0.5, 0.5) and after the stroke, I translate it back by (-0.5, -0.5).
I'm not really concerned about fills at the moment.
The problem is that is doesn't really work 100%. Some lines look fine 
and some don't, e.g. 1 point thick is OK, 2 is OK, 3 is wrong and 4 is 
OK. Should I also check what the current point is before I create the 
path and see if the path is drawn at integer coordinates?

What's the easiest way to get around that problem? Solving that problem 
globally for all situations is probably a big challenge but at the 
application level I should be able to work around it somehow. I hope.

Cheers
piotr


More information about the cairo mailing list