"rzed" <[EMAIL PROTECTED]> wrote:

> If I have the correct version of the PIL code, specifying the new width
> parameter to ImageDraw's line() function results in a line of twice the
> specified thickness. It appears to be because, in ImagingDrawWideLine
> (Draw.c), the width is both added to and subtracted from the line
> positions. If dx and dy were halved, the  specification should work
> correctly (within rounding limits, anyway).
>
>      dx = (int) (d * (y1-y0) + 0.5);
>      dy = (int) (d * (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);
>      add_edge(e+2, x1 + dx,  y1 - dy, x0 + dx,  y0 - dy);
>      add_edge(e+3, x0 + dx,  y0 - dy, x0 - dx,  y0 + dy);
>
> To an extent, it can be worked around by halving the width
> specification, of course.

I've attached the 'official' patch.

</F>

Index: libImaging/Draw.c
===================================================================
--- libImaging/Draw.c   (revision 2434)
+++ libImaging/Draw.c   (working copy)
@@ -674,7 +675,7 @@
         return 0;
     }

-    d = width / sqrt(dx*dx + dy*dy);
+    d = width / sqrt(dx*dx + dy*dy) / 2.0;

     dx = (int) (d * (y1-y0) + 0.5);
     dy = (int) (d * (x1-x0) + 0.5);



_______________________________________________
Image-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to