用gd库画矩形和椭圆
2015-09-08 22:18
176 查看
画矩形:bool imagerectangle ( resource
填充颜色用imagefilledrectangle();参数和上面的一样
画椭圆:bool imageellipse ( resource
画圆弧:bool imagearc ( resource
画圆弧填充颜色,bool imagefilledarc ( resource
值可以是下列值的按位或(OR):
可以用数字相加来叠加多个方式的效果
$image画布资源, int
$x1左上角的坐标, int
$y1, int
$x2右下角坐标, int
$y2, int
$col颜色)
填充颜色用imagefilledrectangle();参数和上面的一样
画椭圆:bool imageellipse ( resource
$image, int
$cx中心坐标, int
$cy, int
$width宽度, int
$height高度, int
$color颜色)
画圆弧:bool imagearc ( resource
$image, int
$cx中心坐标, int
$cy, int
$width宽度, int
$height高度, int
$start起始角度, int
$end结束角度, int
$color颜色)顺时针计算
画圆弧填充颜色,bool imagefilledarc ( resource
$image, int
$cx, int
$cy, int
$width, int
$height, int
$start, int
$end, int
$color, int
$style样式)
style
值可以是下列值的按位或(OR):
IMG_ARC_PIE
IMG_ARC_CHORD
IMG_ARC_NOFILL
IMG_ARC_EDGED
可以用数字相加来叠加多个方式的效果
<?php //画矩形和椭圆 //画布 $rs=imagecreatetruecolor(600,400); //颜料 $gray=imagecolorallocate($rs,200,200,200); $red=imagecolorallocate($rs,255,0,0); $green=imagecolorallocate($rs,0,255,0); $blue=imagecolorallocate($rs,0,0,255); //绘画 //画矩形 imagerectangle($rs,100,50,500,350,$gray); //填充颜色 imagefill($rs,0,0,$red); //画椭圆 imagefilledellipse($rs,300,200,400,300,$green); imagefilledellipse($rs,300,200,300,300,$blue); imagefilledellipse($rs,300,200,200,300,$green); imagefilledellipse($rs,300,200,100,300,$blue); //输出 header('content-type:image/jpeg'); imagejpeg($rs); //销毁对象 imagedestroy($rs); ?>
<?php //画圆弧 //画布 $rs=imagecreatetruecolor(600,400); //颜料 $gray=imagecolorallocate($rs,200,200,200); $red=imagecolorallocate($rs,255,0,0); $green=imagecolorallocate($rs,0,255,0); $blue=imagecolorallocate($rs,0,0,255); //绘画 //画矩形 imagerectangle($rs,100,50,500,350,$gray); //填充颜色 imagefill($rs,0,0,$red); //画圆弧 imagearc($rs,300,200,200,150,90,180,$green); //如果填充颜色用 imagefilledarc($rs,300,200,200,150,185,275,$blue,1+4); //输出 header('content-type:image/jpeg'); imagejpeg($rs); //销毁对象 imagedestroy($rs); ?>
相关文章推荐
- EL表达式与JSTL
- Python 多重列表解析里for的顺序
- struts2自定义类型转换器
- Socket编程
- UI编程:UIView及其子类
- ListView中getChildAt(index)的使用注意事项
- LeetCode Reverse Words in a String
- HDU - 4738 Caocao's Bridges(桥)
- Uber创始人:一个优秀创业者应具八种特质
- 1085. Perfect Sequence (25)
- Testlink 使用步骤
- Android的广播机制——Broadcast Reciver
- Intersection - POJ 1410(线段与矩形是否相交)
- JQuery
- afinal post get 请求
- ThinkPad T430i黑苹果Yosemite 10.10.3成功显卡驱动
- 从零开始编写图片加载库(四)之图片缓存MemoryCache
- 输入三个数字使用指针进行排序(冒泡原理)
- 最长回文子串(Longest Palindromic Substring )
- DHML中的其他对象