PHP 8.3.4 Released!

ImagickDraw::polygon

(PECL imagick 2, PECL imagick 3)

ImagickDraw::polygon多角形を描画する

説明

public ImagickDraw::polygon(array $coordinates): bool
警告

この関数は、 現在のところ詳細な情報はありません。引数のリストのみが 記述されています。

現在の線と線幅、そして塗りつぶし色あるいはテクスチャを使用して、 指定した座標配列から多角形を描画します。

パラメータ

coordinates

多次元配列。 array( array( 'x' => 3, 'y' => 4 ), array( 'x' => 2, 'y' => 6 ) ); のような形式となります。

戻り値

成功した場合に true を返します。

例1 ImagickDraw::polygon() の例

<?php
function polygon($strokeColor, $fillColor, $backgroundColor) {

$draw = new \ImagickDraw();

$draw->setStrokeOpacity(1);
$draw->setStrokeColor($strokeColor);
$draw->setStrokeWidth(4);

$draw->setFillColor($fillColor);

$points = [
[
'x' => 40 * 5, 'y' => 10 * 5],
[
'x' => 20 * 5, 'y' => 20 * 5],
[
'x' => 70 * 5, 'y' => 50 * 5],
[
'x' => 60 * 5, 'y' => 15 * 5],
];

$draw->polygon($points);

$image = new \Imagick();
$image->newImage(500, 300, $backgroundColor);
$image->setImageFormat("png");
$image->drawImage($draw);

header("Content-Type: image/png");
echo
$image->getImageBlob();
}

?>

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top