首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

imagefilledrectangle

(PHP 4, PHP 5, PHP 7)

imagefilledrectangle - 绘制一个填充的矩形

描述

代码语言:javascript
复制
bool imagefilledrectangle ( resource $image , int $x1 , int $y1 , int $x2 , int $y2 , int $color )

创建一个矩形,填充color在给定的image开始点1和结束点2处。0,0是图像的左上角。

参数

代码语言:txt
复制
`image`   

一个图像资源,由图像创建函数之一返回,如imagecreatetruecolor()。

x1

点1的x坐标。

y1

点1的y坐标。

x2

点2的x坐标。

y2

点2的y坐标。

color

填充颜​​色。使用imagecolorallocate()创建的颜色标识符。

返回值

返回TRUE成功或失败时返回FALSE

例子

Example #1 imagefilledrectangle() usage

代码语言:javascript
复制
<?php
// Create a 55x30 image
$im = imagecreatetruecolor(55, 30);
$white = imagecolorallocate($im, 255, 255, 255);

// Draw a white rectangle
imagefilledrectangle($im, 4, 4, 50, 25, $white);

// Save the image
imagepng($im, './imagefilledrectangle.png');
imagedestroy($im);
?>

上面的例子会输出类似于:

← imagefilledpolygon

imagefilltoborder →

扫码关注腾讯云开发者

领取腾讯云代金券