[php-src] Issue #13379: imagearc bug
| From: | erroneum | Date: | Mon, 12 Feb 2024 17:03:16 +0000 |
| Subject: | [php-src] Issue #13379: imagearc bug | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246445@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13379
Author: erroneum
When using
imagearc along with imagesetthickness for a thickness value
larger than 1, there are graphical anomalies, most notably at the locations 45° off axis.
I've verified this to still be an issue as recently as PHP version 8.1.2 and GD version 2.3.0
I suspect that the issue stems from the algorithm being used to plot the circular arcs (I suspect
derived from the midpoint circle algorithm) failing to correctly fill in as it reaches the terminal
case. I do not know if that would put it as something the PHP module handles or something
implemented in libGD itself.
Here is an image showing what I'm talking about

And the code which generated the issue:
```php
<?php
$x = $y = 2000;
$i = imagecreatetruecolor ( $x, $y );
$white = imagecolorallocate ( $i, 255, 255, 255 );
imagefill ( $i, 0, 0, $white );
imagesetthickness ( $i, $x * 0.025 );
$c = imagecolorallocate ( $i, 0xC4, 0xC4, 0xC4 );
imagearc ( $i, $x / 2, $y / 2, $x * 0.8, $y * 0.8, 0, 360, $c );
imagepng ( $i, 'gdarc.png' );
```