ImagickDraw::getStrokeColor()函数是PHP中的内置函数,用于获取用于抚摸对象轮廓的颜色。
用法:
ImagickPixel ImagickDraw::getStrokeColor( void )
参数:此函数不接受任何参数。
返回值:此函数返回包含笔触颜色的ImagickPixel。
以下示例程序旨在说明PHP中的ImagickDraw::getStrokeColor()函数:
示例1:
<?php
// Create a new ImagickDraw object
$draw = new ImagickDraw();
// Get the stroke color
$strokeColor = $draw->getStrokeColor()->getColorAsString();
echo $strokeColor;
?>
输出:
srgba(255, 255, 255, 0)
示例2:
<?php
// Create a new ImagickDraw object
$draw = new ImagickDraw();
// Set the stroke color
$draw->setStrokeColor('grey');
// Get the stroke color
$strokeColor = $draw->getStrokeColor()->getColorAsString();
echo $strokeColor;
?>
输出:
srgb(190, 190, 190)
示例3:
<?php
// Create a new imagick object
$imagick = new Imagick();
// Create a image on imagick object
$imagick->newImage(800, 250, 'black');
// Create a new ImagickDraw object
$draw = new ImagickDraw();
// Set the fill color
$draw->setFillColor('black');
// Set the width of stroke
$draw->setStrokeWidth(1);
// Set the color of stroke
$draw->setStrokeColor('red');
// Set the font size
$draw->setFontSize(40);
// Get the stroke color
$strokecolor = $draw->getStrokeColor()->getColorAsString();
// Annotate a text
$draw->annotation(50, 100,
'The stroke color here is ' . $strokecolor);
// Set the color of stroke
$draw->setStrokeColor('green');
// Get the stroke color
$strokecolor = $draw->getStrokeColor()->getColorAsString();
// Annotate a text
$draw->annotation(50, 200,
'The stroke color here is ' . $strokecolor);
// 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.getstrokecolor.php
相关用法
- PHP GmagickDraw getstrokecolor()用法及代码示例
- PHP ImagickDraw arc()用法及代码示例
- PHP ImagickDraw pop()用法及代码示例
- PHP ImagickDraw pathStart()用法及代码示例
- PHP ImagickDraw pathFinish()用法及代码示例
- PHP ImagickDraw getStrokeLineCap()用法及代码示例
- PHP ImagickDraw pathEllipticArcRelative()用法及代码示例
- PHP ImagickDraw getTextDecoration()用法及代码示例
- PHP ImagickDraw getStrokeLineJoin()用法及代码示例
- PHP ImagickDraw clear()用法及代码示例
- PHP ImagickDraw pathLineToHorizontalAbsolute()用法及代码示例
- PHP ImagickDraw pathLineToRelative()用法及代码示例
- PHP ImagickDraw bezier()用法及代码示例
- PHP ImagickDraw affine()用法及代码示例
- PHP ImagickDraw circle()用法及代码示例
注:本文由纯净天空筛选整理自gurrrung大神的英文原创作品 PHP | ImagickDraw getStrokeColor() Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。