Bug #50036 [Asn->Nab]: imagefilledarc ignores angle when start and end are the same
| From: | cmb@php.net | Date: | Mon, 29 Jun 2015 20:02:15 +0000 |
| Subject: | Bug #50036 [Asn->Nab]: imagefilledarc ignores angle when start and end are the same | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-193997@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=50036&edit=1
ID: 50036
Updated by: cmb@php.net
Reported by: gavin dot miller at areva-td dot com
Summary: imagefilledarc ignores angle when start and end are
the same
-Status: Assigned
+Status: Not a bug
Type: Bug
Package: GD related
Operating System: Windows XP
PHP Version: 5.2.11
-Assigned To: pajoye
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
This is not a bug, but rather a deliberate design decision.
Drawing an arc of 0° does not really make sense, because there's
nothing to be drawn, so this case is treated as an arc of 360° has
been requested[1].
The strange result is due to the use of IMG_ARC_NOFILL, by the
way; if this option is not given, a full black circle is drawn.
[1] <https://github.com/php/php-src/blob/php-5.6.10/ext/gd/libgd/gd.c#L1685-L1686>
Previous Comments:
------------------------------------------------------------------------
[2009-12-08 12:04:37] felipe@php.net
This looks like was introduced by libgd/gd.c:rev.237682 (- Fixed regression introduced by the fix
for the libgd bug#74)
------------------------------------------------------------------------
[2009-10-29 16:46:47] gavin dot miller at areva-td dot com
Description:
------------
When doing a imagefilledarc where the start and end angle are the same
the angle is ignored and zero is used instead.
Just upgraded from PHP 5.1.4 to 5.2.11
Using 5.1.4 the function would correctly position a line at the request
angle with 5.2.11 zero is always used.
the start and end must be at least 1 degree different to produce the
correct result.
Reproduce code:
---------------
---
From manual page: function.imagefilledarc#Description
---
<?php
$img = imagecreate(200, 200);
$white = imagecolorallocate($img, 255, 255, 255);
$blue = imagecolorallocate($img, 153, 204, 255);
$black = imagecolorallocate($img, 0, 0, 0);
imagefilledarc($img, 100, 100, 175, 175,0,360, $blue,IMG_ARC_PIE);
imagefilledarc($img, 100, 100, 175, 175, 150,150, $black,IMG_ARC_PIE|IMG_ARC_NOFILL |IMG_ARC_EDGED);
header("Content-type: image/png");
imagepng($img);
imagedestroy($img);
?>
Expected result:
----------------
blue circle with black line drawn at 150degrees
Actual result:
--------------
blue circle with black line drawn at 0degrees
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=50036&edit=1