[Image-SIG] fix for wide line directional dependence
Randolph Bentson
bentson at holmsjoen.com
Wed Sep 30 16:56:32 CEST 2009
I've found that wide lines drawn with PIL 1.1.6 have a directional
dependence, e.g., lines from (0,0) to (-100,0) are thinner than those
from (0,0) to (0,-100). The following patch seems to help, although
the lines still have a modest variation when rotating through the compass.
--- Draw.c_2745 2009-09-30 07:40:23.000000000 -0700
+++ Draw.c 2009-09-30 07:36:56.000000000 -0700
@@ -686,8 +686,8 @@
d = width / sqrt(dx*dx + dy*dy) / 2.0;
- dx = (int) (d * (y1-y0) + 0.5);
- dy = (int) (d * (x1-x0) + 0.5);
+ dx = (int) (d * abs(y1-y0) + 0.5);
+ dy = (int) (d * abs(x1-x0) + 0.5);
add_edge(e+0, x0 - dx, y0 + dy, x1 - dx, y1 + dy);
add_edge(e+1, x1 - dx, y1 + dy, x1 + dx, y1 - dy);
--
Randolph Bentson
bentson at holmsjoen.com
More information about the Image-SIG
mailing list