首页> 基础笔记 >PHP基础学习 >GD库图像处理 GD库图像处理

GD库绘制图像相关函数

作者:小萝卜 2019-08-20 浏览 870

简介imagefill -- 区域填充 ,imagesetpixel -- 画一个单一像素 ,imageline -- 画一条线段,imagerectangle -- 画一个矩形 ,imagefilledrectangle -- 画一矩形并填充 ,imagepolygon -- 画一个多边形 ,imagefilledpolygon -- 画一多边形并填充 ,imageellipse -- 画一个椭圆 

GD库绘制图像相关函数

imagefill -- 区域填充 
语法:bool imagefill(resource image,int x,int y, int color) 
imagefill() 在 image 图像的坐标 x,y(图像左上角为 0, 0)处用 color 颜色执行区域填充(即与 x, y 点颜色相同且相邻的点都会被填充)。 
 
imagesetpixel -- 画一个单一像素 
语法:bool imagesetpixel ( resource image, int x, int y, int color ) 
imagesetpixel() 在 image 图像中用 color 颜色在 x,y 坐标(图像左上角为 0,0)上画一个点。
 
imageline -- 画一条线段
语法:bool imageline ( resource image, int x1, int y1, int x2, int y2, int color ) 
imageline() 用 color 颜色在图像 image 中从坐标 x1,y1 到 x2,y2(图像左上角为 0, 0)画一条线段。
 
imagerectangle -- 画一个矩形 
语法:bool imagerectangle ( resource image, int x1, int y1, int x2, int y2, int col )
imagerectangle() 用 col 颜色在 image 图像中画一个矩形,其左上角坐标为 x1, y1,右下角坐标为 x2, y2。图像的左上角坐标为 0, 0。 
 
imagefilledrectangle -- 画一矩形并填充 
语法:bool imagefilledrectangle ( resource image, int x1, int y1, int x2, int y2, int color )
imagefilledrectangle() 在 image 图像中画一个用 color 颜色填充了的矩形,其左上角坐标为 x1,y1,右下角坐标为 x2,y2。0, 0 是图像的最左上角。
 
imagepolygon -- 画一个多边形 
语法:bool imagepolygon ( resource image, array points, int num_points, int color )
imagepolygon() 在图像中创建一个多边形。points 是一个 PHP 数组,包含了多边形的各个顶点坐标,即 points[0] = x0,points[1] = y0,points[2] = x1,points[3] = y1,以此类推。num_points 是顶点的总数。 
 
imagefilledpolygon -- 画一多边形并填充 
语法:bool imagefilledpolygon ( resource image, array points, int num_points, int color )
imagefilledpolygon() 在 image 图像中画一个填充了的多边形。points 参数是一个按顺序包含有多边形各顶点的 x 和 y 坐标的数组。 num_points 参数是顶点的总数,必须大于 3。

imageellipse -- 画一个椭圆 
语法:bool imageellipse ( resource image, int cx, int cy, int w, int h, int color )
imageellipse() 在 image 所代表的图像中画一个中心为 cx,cy(图像左上角为 0, 0)的椭圆。w 和 h 分别指定了椭圆的宽度和高度,椭圆的颜色由 color 指定。 

imagefilledellipse -- 画一椭圆并填充 
语法:bool imagefilledellipse ( resource image, int cx, int cy, int w, int h, int color )
imagefilledellipse() 在 image 所代表的图像中以 cx,cy(图像左上角为 0, 0)为中心画一个椭圆。w 和 h 分别指定了椭圆的宽和高。椭圆用 color 颜色填充。如果成功则返回 TRUE,失败则返回 FALSE。 

imagearc -- 画椭圆弧 
bool imagearc ( resource image, int cx, int cy, int w, int h, int s, int e, int color )
imagearc() 以 cx,cy(图像左上角为 0, 0)为中心在 image 所代表的图像中画一个椭圆弧。w 和 h 分别指定了椭圆的宽度和高度,起始和结束点以 s 和 e 参数以角度指定。0°位于三点钟位置,以顺时针方向绘画。 

imagefilledarc -- 画一椭圆弧且填充 
bool imagefilledarc ( resource image, int cx, int cy, int w, int h, int s, int e, int color, int style )
imagefilledarc() 在 image 所代表的图像中以 cx,cy(图像左上角为 0, 0)画一椭圆弧。如果成功则返回 TRUE,失败则返回 FALSE。w 和 h 分别指定了椭圆的宽和高,s 和 e 参数以角度指定了起始和结束点。style 可以是下列值按位或(OR)后的值:
IMG_ARC_PIE IMG_ARC_CHORD
IMG_ARC_NOFILL IMG_ARC_EDGED
  

很赞哦! (0)

文章评论

    高端网站建设