*/
Create an image
$image =imagecreatetruecolor (300,300);
Define the color required for the appeased chart
$white =imagecolorallocate ($image, 0xFF, 0xFF, 0xff);
$gray =imagecolorallocate ($image, 0xc0, 0xc0, 0xc0);
$darkgray =imagecolorallocate ($image, 0x90, 0x90, 0x90);
$navy =imagecolorallocate ($image, 0x00, 0x00, 0x80);
$darknavy =imagecolorallocate ($image, 0x00, 0x00, 0x50);
$red =imagecolorallocate ($image, 0xFF, 0x00, 0x00);
$darkred =imagecolorallocate ($image, 0x90, 0x00, 0x00);
/*
Imagecolorallocate--Assigning a color description to an image int imagecolorallocate (resource image, int red, int green, int blue) Imagecolor Allocate () returns an identifier that represents a color made up of a given RGB component. The image parameter is the return value of the Imagecreate () function. Red,green and Blue are the red, green, and blue components of the desired color respectively. These parameters are integers from 0 to 255 or hexadecimal 0x00 to 0xFF. Imagecolorallocate () must be called to create each color used in the image represented by image.
*/
Drawing
for ($i =160; $i >; $i-)
{
Imagefilledarc ($image, $i, 0, $darknavy, Img_arc_pie);
Imagefilledarc ($image, $i, $darkgray, and Img_arc_pie);
Imagefilledarc ($image, $i, $darkred, and Img_arc_pie);
}
Imagefilledarc ($image,-------0, $navy, Img_arc_pie);
Imagefilledarc ($image,,,,,,, Img_arc_pie, Max, Max, and $gray);
Imagefilledarc ($image,,,,,,,,,,, $red, Img_arc_pie);
Header (' content-type:image/png ');
Imagepng ($image);
Imagedestroy ($image);
/*
The Imagefilledarc () function allows you to fill an elliptical arc with a specified color while it is being drawn. With this function, you can easily draw a pie chart for statistics. The following shows how the Imagefilledarc () function is used
The code is executed as shown in result 22.8:
*/
Draw lines in pictures
Create a true Color image
$img =imagecreatetruecolor (300,300);
$white =imagecolorallocate ($img, 255,255,255);
$red =imagecolorallocate ($img, 255,0,0);
$green =imagecolorallocate ($img, 0,255,0);
Draw an ellipse on an image
Imagefilledellips Tutorial E ($img, 150,150,250,100, $red);
Imagefilledellipse ($img, 150,150,100,250, $green);
Output image
Header ("Content-type:image/png");
Imagepng ($IMG);
Destroying images
Imagedestroy ($IMG);
/*
The code is executed as shown in result 22.9:
*/
http://www.bkjia.com/PHPjc/632996.html www.bkjia.com true http://www.bkjia.com/PHPjc/632996.html techarticle *//Create Image $image =imagecreatetruecolor (300,300);//define appeased required color $white =imagecolorallocate ($image, 0xFF, 0xFF, 0xFF ); $gray =imagecolorallocate ($image,...