GD2绘制基本图形

来源:互联网 发布:伴唱软件 编辑:程序博客网 时间:2024/05/29 13:41

一 代码

<?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); ?>

 

二 运行结果

 
  • 大小: 1.9 KB
  • 查看图片附件