|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-05-22 17:00 UTC] 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. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 07:00:02 2025 UTC |
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?>