[libGD] #100 [Task opened] spurious horizontal line drawn by gdImageFilledPolygon; fix attached
[email protected] (libGD) Thu, 19 Jul 2007 06:20:43 +0000
| Newsgroups | php.gd.bugs |
|---|---|
| Message-ID | <[email protected]> |
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY. A new Flyspray task has been opened. Details are below. User who did this - Ducky Sherwood (duckysherwood) Attached to Project - libGD Summary - spurious horizontal line drawn by gdImageFilledPolygon; fix attached Task Type - Bug Report Category - General Status - Unconfirmed Assigned To - Operating System - All Severity - Low Priority - Normal Reported Version - 2.0.35 Due in Version - Undecided Due Date - Undecided Details - There is a bug in gdImageFilledPolygon such that you can get spurious horizontal lines. I've attached fix for it and a test case that demonstrates it. gdImageFilledPolygon works by iteratively drawing horizontal lines between the borders of the polygon. To do this, it interpolates the x-value for a given y-value, based on the positions of two connected vertices. Then, it sorts the x-values (for that given y-value) and draws lines between the first and second x-value, third and fourth, etc. (Why does it sort? To deal with cases where the polygon is shaped such that there is a gap in the horizontal line. Imagine, for example, a "V" shape -- a horizontal slice near the top would give two colored pieces with a non-colored piece in between them.) Unfortunately, it is possible to get conditions where you have an *odd* number of x-values that intersect a given y-value. Thus when gdImageFilledPolygon tries to draw a horizontal line between x[i] and x[i+1], the x[i+1] is garbage (usually 0 for me, YMMV). To fix this, I checked for odd-numbers of intercepts. If it was odd, I added an intercept, making x[i+1] = x[i]. This means drawing a spurious dot, but that seemed safer than taking one intercept away. More information can be found at the following URL: http://bugs.libgd.org/?do=details&task_id=100 You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.