如果您將筆劃寬度設為 0,通常還是會有髮線。若要移除此髮線,請使用透明度,例如使用
setStrokeColor("#00000000")
十六進位 0-6 = 顏色 -> 黑色
十六進位 6-8 = 不透明度 -> 完全透明
(PECL imagick 2, PECL imagick 3)
ImagickDraw::setStrokeWidth — 設定繪製物件外框所用筆劃的寬度
此函式目前沒有文件記錄;只有其引數列表可用。
設定繪製物件外框所用筆劃的寬度。
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();
}
?>
如果您將筆劃寬度設為 0,通常還是會有髮線。若要移除此髮線,請使用透明度,例如使用
setStrokeColor("#00000000")
十六進位 0-6 = 顏色 -> 黑色
十六進位 6-8 = 不透明度 -> 完全透明