PHP Conference Japan 2024

ImagickDraw::setStrokeWidth

(PECL imagick 2, PECL imagick 3)

ImagickDraw::setStrokeWidth設定繪製物件外框所用筆劃的寬度

說明

public ImagickDraw::setStrokeWidth(float $stroke_width): bool
警告

此函式目前沒有文件記錄;只有其引數列表可用。

設定繪製物件外框所用筆劃的寬度。

參數

stroke_width

筆劃寬度

回傳值

沒有回傳值。

範例

範例 1 ImagickDraw::setStrokeWidth() 範例

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

$draw = new \ImagickDraw();

$draw->setStrokeWidth(1);
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->line(100, 100, 400, 145);
$draw->rectangle(100, 200, 225, 350);
$draw->setStrokeWidth(5);
$draw->line(100, 120, 400, 165);
$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();
}

?>

新增註解

使用者貢獻註解 2 則註解

2
Peter - the Pete - de Pijd
15 年前
如果您將筆劃寬度設為 0,通常還是會有髮線。若要移除此髮線,請使用透明度,例如使用
setStrokeColor("#00000000")
十六進位 0-6 = 顏色 -> 黑色
十六進位 6-8 = 不透明度 -> 完全透明
1
r dot vinke at gmail dot com
16 年前
請注意,只有在先呼叫 setStrokeColor() 時,此函式才會生效(也就是筆劃寬度會變更)。
To Top