一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

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

时间:2010-12-20 编辑:简简单单 来源:一聚教程网

//发送头文件
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);
//输出图像
imagepng($im);
/*
执行该代码将生成一幅png图像,并在图像上显示hello。

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

返回值: 整数

函数种类: 图形处理


 
 
内容说明


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

热门栏目