ImagickDraw::pathCurveToQuadraticBezierSmoothAbsolute()函数是PHP中的内置函数,用于绘制二次Bezier曲线,该曲线为参数曲线。此函数可以从二次曲线平滑地延续曲线。
用法:
bool ImagickDraw::pathCurveToQuadraticBezierSmoothAbsolute( float $x, float $y )
参数:该函数接受上述和以下描述的两个参数:
- $x:它指定结束的x坐标
- $y:它指定结束的y坐标
返回值:成功时此函数返回TRUE。
异常:该函数在错误时引发ImagickException。
下面给出的程序说明了PHP中的ImagickDraw::pathCurveToQuadraticBezierSmoothAbsolute()函数:
程序1:
<?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();
$draw->setFillColor('black');
// Set the stroke color
$draw->setStrokeColor('red');
// Draw curves to Quadratic Bezier Smooth Absolute (without pathClose())
$draw->pathStart();
$draw->pathCurveToQuadraticBezierSmoothAbsolute(3950, 250);
$draw->pathCurveToQuadraticBezierSmoothAbsolute(2950, 250);
$draw->pathCurveToQuadraticBezierSmoothAbsolute(390, 250);
$draw->pathFinish();
// Render the draw commands
$imagick->drawImage($draw);
// Show the output
$imagick->setImageFormat('png');
header("Content-Type:image/png");
echo $imagick->getImageBlob();
?>
输出:
程序2:
<?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();
$draw->setFillColor('black');
// Set the stroke color
$draw->setStrokeColor('yellow');
// Draw curves to Quadratic Bezier Smooth Absolute (with pathClose())
$draw->pathStart();
$draw->pathCurveToQuadraticBezierSmoothAbsolute(3950, 250);
$draw->pathCurveToQuadraticBezierSmoothAbsolute(950, 250);
$draw->pathCurveToQuadraticBezierSmoothAbsolute(2390, 250);
$draw->pathClose();
$draw->pathFinish();
// 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.pathcurvetoquadraticbeziersmoothabsolute.php
相关用法
- PHP ImagickDraw arc()用法及代码示例
- PHP ImagickDraw pop()用法及代码示例
- PHP ImagickDraw setStrokeMiterLimit()用法及代码示例
- PHP ImagickDraw getStrokeMiterLimit()用法及代码示例
- PHP ImagickDraw setStrokeLineCap()用法及代码示例
- PHP ImagickDraw setFillOpacity()用法及代码示例
- PHP ImagickDraw setFontSize()用法及代码示例
- PHP ImagickDraw pathStart()用法及代码示例
- PHP ImagickDraw getStrokeLineJoin()用法及代码示例
- PHP ImagickDraw getStrokeLineCap()用法及代码示例
- PHP ImagickDraw setFontWeight()用法及代码示例
- PHP ImagickDraw polygon()用法及代码示例
- PHP ImagickDraw setTextAntialias()用法及代码示例
- PHP ImagickDraw setTextDecoration()用法及代码示例
- PHP ImagickDraw setTextUnderColor()用法及代码示例
注:本文由纯净天空筛选整理自gurrrung大神的英文原创作品 PHP | ImagickDraw pathCurveToQuadraticBezierSmoothAbsolute() Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。