imageellipse

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

imageellipse — 画一个椭圆

说明

imageellipse(
    resource $image,
    int $cx,
    int $cy,
    int $width,
    int $height,
    int $color
): bool

在指定的坐标上画一个椭圆。

参数

image

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

cx

中间的 X 坐标。

cy

中间的 Y 坐标。

width

椭圆的宽度。

height

椭圆的高度。

color

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

返回值

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

范例

示例 #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()

注释

注意:

本函数需要 GD 2.0.2 或更高版本。

参见