Bug #43475 [Asn->Csd]: Thick styled lines have scrambled patterns
| From: | cmb@php.net | Date: | Thu, 16 Jun 2016 12:23:12 +0000 |
| Subject: | Bug #43475 [Asn->Csd]: Thick styled lines have scrambled patterns | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-201675@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=43475&edit=1
ID: 43475
Updated by: cmb@php.net
Reported by: lb2048 at pobox dot com
Summary: Thick styled lines have scrambled patterns
-Status: Assigned
+Status: Closed
Type: Bug
Package: GD related
Operating System: *
PHP Version: 5.2CVS-2008-10-30
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8aa511f1fc8123bba6107fa856b0b6bf298de87c
Log: Fix #43475: Styled thick horizontal lines are scrambled
Previous Comments:
------------------------------------------------------------------------
[2016-06-15 16:14:01] cmb@php.net
The bug has been fixed in libgd, so I'm reopening.
------------------------------------------------------------------------
[2015-06-11 17:15:59] cmb@php.net
The libgd ticket: <https://github.com/libgd/libgd/issues/167>.
------------------------------------------------------------------------
[2015-06-11 17:15:26] cmb@php.net
I have filed a ticket against libgd now.
I've noticed a minor issue wrt. to jacQues' ImageStyleThicken()
function: it only works correctly for even thickness values,
because libgd rounds odd thickness values to the next smaller even
value.
------------------------------------------------------------------------
[2015-06-11 12:53:21] cmb@php.net
Sorry for the late reply.
> Horizontal thick lines patterns look scrambled to me.
Indeed! I had a closer look at the issue, and found that
horizontal and vertical lines do call gdImageFilledRectangle when
the thickness is greater than 1 for performance reasons.
The relevant code of gdImageFilledRectangle[1] loops over the x
and y coordinates, and calls gdImageSetPixel which iterates over
the style pattern[2]. As is, this works fine for vertical lines,
but not for horizontal lines. Swapping the for loops in
gdImageFilledRectangle will make horizontal lines look fine, but
will break vertical lines.
I'm not sure (yet) how to solve this issue, but anyhow, this is an
issue that should preferably be fixed upstream in libgd. I'll file
a bug report there later, and switch this ticket to "suspended"
until a resolution is found.
[1] <https://github.com/php/php-src/blob/PHP-5.6.9/ext/gd/libgd/gd.c#L2145-L2149>
[2] <https://github.com/php/php-src/blob/PHP-5.6.9/ext/gd/libgd/gd.c#L724-L735>
------------------------------------------------------------------------
[2015-05-08 00:05:54] lb2048 at pobox dot com
I agree that changing the way it works would be bad, and the way it works should be better
documented.
I do not agree that the issue raised by "jacQues" has been fixed. After replicating my
pattern bits by the line thickness, as stated in that comment, I do see reasonable thick styled
lines, except for horizontal lines. Horizontal thick lines patterns look scrambled to me. (jacQues
said in 2010 that vertical lines were also bad. I don't see that now - my vertical lines seem
OK.)
Now using php-5.6.8; same results with php-5.5.24.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=43475
--
Edit this bug report at https://bugs.php.net/bug.php?id=43475&edit=1