imageellipse

(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)

imageellipse画椭圆

说明

imageellipse(
    GdImage$image,
    int$center_x,
    int$center_y,
    int$width,
    int$height,
    int$color
): bool

绘制以指定坐标为中心的椭圆。

参数

image

由图象创建函数(例如imagecreatetruecolor())返回的 GdImage 对象。

center_x

中间的 x 坐标。

center_y

中间的 y 坐标。

width

椭圆的宽度。

height

椭圆的高度。

color

椭圆的颜色。颜色标识符使用 imagecolorallocate() 创建。

返回值

成功时返回 true, 或者在失败时返回 false

更新日志

版本说明
8.0.0image 现在需要 GdImage 实例;之前需要有效的 gdresource

示例

示例 #1 imageellipse() 示例

<?php

// 新建一个空白图像
$image = imagecreatetruecolor(400, 300);

// 填充背景色
$bg = imagecolorallocate($image, 0, 0, 0);

// 选择椭圆的颜色
$col_ellipse = imagecolorallocate($image, 255, 255, 255);

// 画一个椭圆
imageellipse($image, 200, 150, 300, 200, $col_ellipse);

// 输出图像
header("Content-type: image/png");
imagepng($image);


?>

以上示例的输出类似于:

示例输出:imageellipse()

注释

注意:

imageellipse() 忽略 imagesetthickness()

参见

To Top