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);

// 上で選択した色で背景を塗ります
imagefill($image, 0, 0, $bg);

// 楕円の色を選択します
$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