note 8566 modified in function.imagearc by felipe

From: Date: Mon, 21 Jul 2008 01:17:27 +0000
Subject: note 8566 modified in function.imagearc by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142384@lists.php.net to get a copy of this message
There is another way to fill an arc : <?php // To draw the arc $Color = imagecolorallocate($Image, $Red, $Green, $Blue); imagearc($Image, $CenterX, $CenterY, $Diameter, $Diameter, $Start, $End, $Color); // To close the arc with 2 lines between the center and the 2 limits of the arc $x = $CenterX + (cos(deg2rad($Start))*($Diameter/2)); $y = $CenterY + (sin(deg2rad($Start))*($Diameter/2)); imageline($Image, $x, $y, $CenterX, $CenterY, $Color); $x = $CenterX + (cos(deg2rad($End))*($Diameter/2)); $y = $CenterY + (sin(deg2rad($End))*($Diameter/2)); imageline($Image, $x, $y, $CenterX, $CenterY, $Color); // To fill the arc, the starting point is a point in the middle of the closed space $x = $CenterX + (cos(deg2rad(($Start+$End)/2))*($Diameter/4)); $y = $CenterY + (sin(deg2rad(($Start+$End)/2))*($Diameter/4)); imagefilltoborder($Image, $x, $y, $Color, $Color); ?> --was-- There is another way to fill an arc : // To draw the arc $Color = imagecolorallocate($Image, $Red, $Green, $Blue); imagearc($Image, $CenterX, $CenterY, $Diameter, $Diameter, $Start, $End, $Color); // To close the arc with 2 lines between the center and the 2 limits of the arc $x = $CenterX + (cos(deg2rad($Start))*($Diameter/2)); $y = $CenterY + (sin(deg2rad($Start))*($Diameter/2)); imageline($Image, $x, $y, $CenterX, $CenterY, $Color); $x = $CenterX + (cos(deg2rad($End))*($Diameter/2)); $y = $CenterY + (sin(deg2rad($End))*($Diameter/2)); imageline($Image, $x, $y, $CenterX, $CenterY, $Color); // To fill the arc, the starting point is a point in the middle of the closed space $x = $CenterX + (cos(deg2rad(($Start+$End)/2))*($Diameter/4)); $y = $CenterY + (sin(deg2rad(($Start+$End)/2))*($Diameter/4)); imagefilltoborder($Image, $x, $y, $Color, $Color); http://php.net/manual/en/function.imagearc.php

« previous php.notes (#142384) next »