ImagickDraw::getStrokeLineJoin()函數是PHP中的一個內置函數,用於獲取在筆觸路徑時在拐角處使用的形狀。這通常會影響筆觸的外邊和轉彎。
用法:
int ImagickDraw::getStrokeLineJoin( void )
參數:此函數不接受任何參數。
返回值:此函數返回與LINEJOIN常量之一相對應的整數值。
LINEJOIN常量列表如下:
- imagick::LINEJOIN_UNDEFINED(0)
- imagick::LINEJOIN_MITER(1)
- imagick::LINEJOIN_ROUND(2)
- imagick::LINEJOIN_BEVEL(3)
異常:該函數在錯誤時引發ImagickException。
以下示例程序旨在說明PHP中的ImagickDraw::getStrokeLineJoin()函數:
程序1:
<?php
// Create a new ImagickDraw object
$draw = new ImagickDraw();
// Get the stroke line join
$lineJoin = $draw->getStrokeLineJoin();
echo $lineJoin;
?>
輸出:
1 // Which corresponds to imagick::LINEJOIN_MITER
程序2:
<?php
// Create a new ImagickDraw object
$draw = new ImagickDraw();
// Set the stroke line join
$draw->setStrokeLineJoin(3);
// Get the stroke line join
$lineJoin = $draw->getStrokeLineJoin();
echo $lineJoin;
?>
輸出:
3 // Which corresponds to imagick::LINEJOIN_BEVEL
程序3:
<?php
// Create a new ImagickDraw object
$draw = new ImagickDraw();
// Create a new imagick object
$imagick = new Imagick();
// Create a image on imagick object
$imagick->newImage(800, 250, 'white');
// Create a new ImagickDraw object
$draw = new ImagickDraw();
// Set the fill color
$draw->setFillColor('white');
// Set the color of stroke
$draw->setStrokeColor('blue');
// Set the stroke width
$draw->setStrokeWidth(4);
// Set the font size
$draw->setFontSize(25);
// Set the stroke dash array
$draw->setStrokeDashArray([20]);
// Draw a rectangle
$draw->rectangle(100, 50, 225, 175);
// Annotate a text
$draw->annotation(10, 220, 'The strokeLineJoin here is '
. $draw->getStrokeLineJoin());
// Set the stroke line join
$draw->setStrokeLineJoin(2);
// Draw a rectangle
$draw->rectangle(500, 50, 625, 175);
// Annotate a text
$draw->annotation(400, 220, 'The strokeLineJoin here is '
. $draw->getStrokeLineJoin());
// Render the draw commands
$imagick->drawImage($draw);
// Show the output
$imagick->setImageFormat('png');
header("Content-Type: image/png");
echo $imagick->getImageBlob();
?>
輸出:
參考: https://www.php.net/manual/en/imagickdraw.getstrokelinejoin.php
相關用法
- PHP ImagickDraw arc()用法及代碼示例
- PHP ImagickDraw pop()用法及代碼示例
- PHP ImagickDraw pathCurveToQuadraticBezierRelative()用法及代碼示例
- PHP ImagickDraw getFont()用法及代碼示例
- PHP ImagickDraw setTextInterlineSpacing()用法及代碼示例
- PHP ImagickDraw clone()用法及代碼示例
- PHP ImagickDraw popPattern()用法及代碼示例
- PHP ImagickDraw resetVectorGraphics()用法及代碼示例
- PHP ImagickDraw setFillAlpha()用法及代碼示例
- PHP ImagickDraw setStrokeMiterLimit()用法及代碼示例
- PHP ImagickDraw getTextInterwordSpacing()用法及代碼示例
- PHP ImagickDraw setFillOpacity()用法及代碼示例
- PHP ImagickDraw getFontWeight()用法及代碼示例
- PHP ImagickDraw getTextEncoding()用法及代碼示例
- PHP ImagickDraw setTextEncoding()用法及代碼示例
注:本文由純淨天空篩選整理自gurrrung大神的英文原創作品 PHP | ImagickDraw getStrokeLineJoin() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。