ImagickDraw::polyline

(PECL imagick 2, PECL imagick 3)

ImagickDraw::polyline線分群を描画する

説明

publicImagickDraw::polyline(array$coordinates): bool
警告

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

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

パラメータ

coordinates

x 座標および y 座標の配列。 array( array( 'x' => 4, 'y' => 6 ), array( 'x' => 8, 'y' => 10 ) ) のような形式となります。

戻り値

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

例1 ImagickDraw::polyline() の例

<?php
function polyline($strokeColor, $fillColor, $backgroundColor) {
$draw = new \ImagickDraw();

$draw->setStrokeOpacity(1);
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);

$draw->setStrokeWidth(5);

$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->polyline($points);

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

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

?>
To Top