首页 > php图像处理 > php imagefilledrectangle在图片画一矩形并填充

php imagefilledrectangle在图片画一矩形并填充

执行该代码将生成一幅png图像,并在图像上显示hello.

语法:int imagefilledrectangle(int im, int x1, int y1, int x2, int y2, int col);

返回值:整数

函数种类:图形处理

内容说明:本函数将图片的封闭长方形区域着色,参数 x1、y1 及 x2、y2 分别为矩形对角线的坐标,参数 col 表示欲涂上的颜色.

//发送头文件 
header("content-type: image/png"); 
//创建真彩色图像 
$im=imagecreatetruecolor(100,50); 
//定义黑色 
$black=imagecolorallocate($im,0,0,0); 
//定义白色 
$white=imagecolorallocate($im,255,255,255); 
//画一矩形并填充 
imagefilledrectangle($im,0,0,99,49, $white); 
//定义字体 
imagestring($im,2,0,0,"hello",$black); 
//开源代码phprm.com 
//输出图像 
imagepng($im); 
/*

   


文章链接:http://www.phprm.com/tuxiang/fs5664.html

随便收藏,请保留本文地址!

标签:imagefilledrectangle php画一矩形

发表留言