加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > PHP > 正文

php imagerectangle()函数

发布时间:2020-05-25 02:24:49 所属栏目:PHP 来源:互联网
导读:php imagerectangle()函数创建一个从指定坐标开始的矩形。 本文章向大家介绍php imagerectangle()函数的基本使用方法和实例,需要的朋友可以参考一下。

imagerectangle()创建一个从指定坐标开始的矩形。

句法

PHP imagerectangle()函数具有以下语法。

bool imagerectangle ( resource $image,int $x1,int $y1,int $x2,int $y2,int $color )

参数

PHP imagerectangle()函数具有以下参数。

image - 由图像创建函数(如imagecreatetruecolor())返回的图像资源。

x1 - 左上角x坐标。

y1 - 左上y坐标0,0是图像的左上角。

x2 - 右下角x坐标。

y2 - 右下y坐标。

color - 使用imagecolorallocate()创建的颜色标识符。

返回值

成功时返回TRUE,失败时返回FALSE。

实例

/*

http://www.manongjc.com/article/1757.html

作者:脚本之家教程

*/

// Create a 200 x 200 image

$canvas = imagecreatetruecolor(200,200);

// Allocate colors

$pink = imagecolorallocate($canvas,255,105,180);

$white = imagecolorallocate($canvas,255);

$green = imagecolorallocate($canvas,132,135,28);

// Draw three rectangles each with its own color

imagerectangle($canvas,50,150,$pink);

imagerectangle($canvas,45,60,120,100,$white);

imagerectangle($canvas,75,160,$green);

// Output and free from memory

header('Content-Type: image/jpeg');

imagejpeg($canvas);

imagedestroy($canvas);

?>

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读