ImagickDraw::getStrokeMiterLimit()函数是PHP中的一个内置函数,用于获取斜接限制。当两个线段以锐角相遇时,斜接点的延伸范围将远远超过抚摸路径的线的厚度。
用法:
int ImagickDraw::getStrokeMiterLimit( void )
参数:此函数不接受任何参数。
返回值:该函数返回一个包含斜接限制的整数值。
异常:该函数在错误时引发ImagickException。
下面给出的程序说明了PHP中的ImagickDraw::getStrokeMiterLimit()函数:
示例1:
<?php
// Create a new ImagickDraw object
$draw = new ImagickDraw();
// Get the stroke miter limit
$miterLimit = $draw->getStrokeMiterLimit();
echo $miterLimit;
?>
输出:
10
示例2:
<?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 stroke color
$draw->setStrokeColor('green');
// Set the stroke opacity
$draw->setStrokeOpacity(0.6);
// Set the fill color
$draw->setFillColor('white');
// Set the stroke width
$draw->setStrokeWidth(10);
// Set the stroke Line Join
$draw->setStrokeLineJoin(Imagick::LINEJOIN_MITER);
// Set the stroke miter limit
$draw->setStrokeMiterLimit(0);
// Create a polygon
$draw->polygon([
['x' => 100, 'y' => 60],
['x' => 60, 'y' => 80],
['x' => 400, 'y' => 100]
]);
// Set the font size
$draw->setFontSize(20);
// Decrease the stroke width so that text can be printed
$draw->setStrokeWidth(1);
// Print the text
$draw->annotation(450, 100, 'The strokeMiterLimit here is '
. $draw->getStrokeMiterLimit());
// Set the stroke width back to 10
$draw->setStrokeWidth(10);
// Set the stroke miter limit
$draw->setStrokeMiterLimit(40);
// Create a polygon
$draw->polygon([
['x' => 100, 'y' => 160],
['x' => 60, 'y' => 180],
['x' => 400, 'y' => 180]
]);
// Decrease the stroke width so that text can be printed
$draw->setStrokeWidth(1);
// Print the text
$draw->annotation(450, 180, 'The strokeMiterLimit here is '
. $draw->getStrokeMiterLimit());
// 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.getstrokemiterlimit.php
相关用法
- PHP ImagickDraw arc()用法及代码示例
- PHP ImagickDraw pop()用法及代码示例
- PHP ImagickDraw getTextEncoding()用法及代码示例
- PHP ImagickDraw getTextAlignment()用法及代码示例
- PHP ImagickDraw getStrokeDashOffset()用法及代码示例
- PHP ImagickDraw destroy()用法及代码示例
- PHP ImagickDraw setFontWeight()用法及代码示例
- PHP ImagickDraw getFillRule()用法及代码示例
- PHP ImagickDraw setTextEncoding()用法及代码示例
- PHP ImagickDraw color()用法及代码示例
- PHP ImagickDraw getClipPath()用法及代码示例
- PHP ImagickDraw setStrokeMiterLimit()用法及代码示例
- PHP ImagickDraw comment()用法及代码示例
- PHP ImagickDraw polyline()用法及代码示例
- PHP ImagickDraw setClipPath()用法及代码示例
注:本文由纯净天空筛选整理自gurrrung大神的英文原创作品 PHP | ImagickDraw getStrokeMiterLimit() Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。