ID: 28490
User updated by: philippe dot nonn at capgemini dot com
Reported By: philippe dot nonn at capgemini dot com
-Status: Feedback
+Status: Open
Bug Type: GD related
Operating System: Windows XP / IIS
PHP Version: 4.3.6
New Comment:
find above a script showing the part of pie not completely filled of
red color
Philippe
<?php
/*
** Convertir les degr�s en radians
*/
function radians($degrees)
{
return($degrees * (pi()/180.0));
}
/*
** prendre x,y dans le cercle,
** centre = 0,0
*/
function circle_point($degrees, $diameter)
{
$x = cos(radians($degrees)) * ($diameter/2);
$y = sin(radians($degrees)) * ($diameter/2);
return (array($x, $y));
}
$image = imagecreate(400, 400 );
//arri�re-plan
//couleurs
$colorBody = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
imagefill($image, 0, 0, $colorBody);
$CurrentColor = imagecolorallocate($image, 0xFF, 0x00, 0x00);
$ChartCenterX = 200;
$ChartCenterY =200;
$ChartDiameter = 300;
$StartDegrees = 0;
$EndDegrees = 50;
//dessiner un arc
imagearc($image,
$ChartCenterX,
$ChartCenterY,
$ChartDiameter,
$ChartDiameter,
$StartDegrees,
$EndDegrees,
$CurrentColor);
//Tracer le d�but de la ligne � partir du centre
list($ArcX, $ArcY) = circle_point($StartDegrees,
$ChartDiameter);
imageline($image,
$ChartCenterX,
$ChartCenterY,
floor($ChartCenterX + $ArcX),
floor($ChartCenterY + $ArcY),
$CurrentColor);
//dessiner la fin de la ligne
list($ArcX, $ArcY) = circle_point($EndDegrees,
$ChartDiameter);
imageline($image,
$ChartCenterX,
$ChartCenterY,
ceil($ChartCenterX + $ArcX),
ceil($ChartCenterY + $ArcY),
$CurrentColor);
if (($EndDegrees - $StartDegrees) > 1)
{
//remplir les portions
$MidPoint = round((($EndDegrees - $StartDegrees)/2) +
$StartDegrees);
list($ArcX, $ArcY) = circle_point($MidPoint,
$ChartDiameter/2);
imagefilltoborder($image,
floor($ChartCenterX + $ArcX),
floor($ChartCenterY + $ArcY),
$CurrentColor,
$CurrentColor);
}
//afficher l'image
header("Content-type: image/jpeg");
imagejpeg($image);
php?>
Previous Comments:
------------------------------------------------------------------------
[2004-05-22 17:40:03] [EMAIL PROTECTED]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc.
If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2004-05-22 17:00:42] philippe dot nonn at capgemini dot com
Description:
------------
Using the las version of Graphical Library PHP_GD2 leads to display
images which are only partially filled when using the function
ImageFillToBorder.
It looks like only the upper part of the zone which should be filled
gets the selected color.
The problem doesn't appear when using le 4.3.5 version of php_gd2.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28490&edit=1