GD2绘制基本图形

一 代码

<?php
    header("Content-type: image/png");    //将图像输出到浏览器
    $img = imagecreate(560, 200);      //创建一个 560×200 的图像
    $bg = imagecolorallocate($img, 0, 0, 255);         
     //设置图像背景色
    $white = imagecolorallocate($img, 255, 255, 255);       
     //设置绘制图像的颜色为白色
	imageline($img, 20, 20, 150, 180, $white);
    imagearc($img, 250, 100, 150, 150, 0, 360, $white);      
    //绘制一个白色的圆
    imagerectangle($img, 350, 20, 500, 170, $white);
	imagepng($img);
	imagedestroy($img); 
?>

 

二 运行结果

 

猜你喜欢

转载自cakin24.iteye.com/blog/2375270
今日推荐