imagerectangle() 是 PHP 中 GD 图像库提供的一个函数,用于在图像上绘制矩形。
bool imagerectangle(
GdImage $image,
int $x1,
int $y1,
int $x2,
int $y2,
int $color
)
参数
- $image 图像资源(由 imagecreate()、imagecreatetruecolor() 等函数创建)
- $x1 矩形左上角的 X 坐标
- $y1 矩形左上角的 Y 坐标
- $x2 矩形右下角的 X 坐标
- $y2 矩形右下角的 Y 坐标
- $color 使用 imagecolorallocate() 创建的颜色标识符
在 imagerectangle() 中,所有坐标参数 $x1, $y1, $x2, $y2 都是以图像的左上角为原点 (0, 0) 的像素坐标:
$x1, $y1:矩形左上角的像素坐标
$x2, $y2:矩形右下角的像素坐标