« ImagickDraw::setStrokeColor
ImagickDraw::setStrokeDashOffset »

ImagickDraw::setStrokeDashArray

(PECL imagick 2, PECL imagick 3)

ImagickDraw::setStrokeDashArray — パスの描画に使用する破線のパターンを指定する

説明

public function ImagickDraw::setStrokeDashArray(?array $dashes): bool
警告

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

パスの描画に使用する破線のパターンを指定します。 strokeDashArray は数値の配列で、 互い違いに並べる破線と空白の長さをピクセルで表したものです。 If an odd number of values is provided, then the list of values is repeated to yield an even number of values. 既存の配列を削除するには、number_elements にゼロ、そして dash_array に null を渡します。 典型的な strokeDashArray_ 配列のメンバーは 5 3 2 となります。

パラメータ

dashes

float の配列。

戻り値

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

例

例1 ImagickDraw::setStrokeDashArray() の例

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

    $draw = new \ImagickDraw();

    $draw->setStrokeColor($strokeColor);
    $draw->setFillColor($fillColor);
    $draw->setStrokeWidth(4);

    $draw->setStrokeDashArray([10, 10]);
    $draw->rectangle(100, 50, 225, 175);

    $draw->setStrokeDashArray([20, 5, 20, 5, 5, 5,]);
    $draw->rectangle(275, 50, 400, 175);

    $draw->setStrokeDashArray([20, 5, 20, 5, 5]);
    $draw->rectangle(100, 200, 225, 350);

    $draw->setStrokeDashArray([1, 1, 1, 1, 2, 2, 3, 3, 5, 5, 8, 8, 13, 13, 21, 21, 34, 34, 55, 55, 89, 89, 144, 144, 233, 233, 377, 377, 610, 610, 987, 987, 1597, 1597, 2584, 2584, 4181, 4181,]);

    $draw->rectangle(275, 200, 400, 350);

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

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

?>

関連キーワード:
draw   setStrokeDashArray   ImagickDraw   image   破線   描画   パターン   rectangle   number   values   setStrokeColor   imagick   dashes   strokeDashArray   strokeColor   fillColor   backgroundColor   setStrokeDashOffset   詳細   記述   数値   空白   ピクセル   provided   list
関連する関数・ページ:
imagickdraw.setstrokecolor   imagickdraw.setstrokedashoffset   imagickdraw.setstrokewidth   imagickdraw.setfillcolor   imagickdraw.setstrokealpha   imagickdraw.popdefs