PHP Conference Japan 2024

ImagickDraw::pathCurveToQuadraticBezierSmoothAbsolute

(PECL imagick 2, PECL imagick 3)

ImagickDraw::pathCurveToQuadraticBezierSmoothAbsolute绘制二次贝塞尔曲线

描述

public ImagickDraw::pathCurveToQuadraticBezierSmoothAbsolute(float $x, float $y): bool

从当前点到 (x,y) 绘制二次贝塞尔曲线(使用绝对坐标)。控制点假定为先前命令中控制点的反射,相对于当前点。(如果没有先前的命令,或者如果先前的命令不是 DrawPathCurveToQuadraticBezierAbsolute、DrawPathCurveToQuadraticBezierRelative、DrawPathCurveToQuadraticBezierSmoothAbsolut 或 DrawPathCurveToQuadraticBezierSmoothRelative,则假定控制点与当前点重合)。在命令结束时,新的当前点将成为多贝塞尔曲线中使用的最终 (x,y) 坐标对。

此函数不能用于平滑地继续三次贝塞尔曲线。它只能从二次曲线平滑地继续。

参数

x

结束 x 坐标

y

结束 y 坐标

返回值

不返回值。

范例

示例 #1 ImagickDraw::pathCurveToQuadraticBezierSmoothAbsolute() 示例

<?php
$draw
= new \ImagickDraw();

$draw->setStrokeOpacity(1);
$draw->setStrokeColor("black");
$draw->setFillColor("blue");

$draw->setStrokeWidth(2);
$draw->setFontSize(72);

$draw->pathStart();
$draw->pathMoveToAbsolute(50,250);

// This specifies a quadratic bezier curve with the current position as the start
// point, the control point is the first two params, and the end point is the last two params.
$draw->pathCurveToQuadraticBezierAbsolute(
150,50,
250,250
);

// This specifies a quadratic bezier curve with the current position as the start
// point, the control point is mirrored from the previous curves control point
// and the end point is defined by the x, y values.
$draw->pathCurveToQuadraticBezierSmoothAbsolute(
450,250
);

// This specifies a quadratic bezier curve with the current position as the start
// point, the control point is mirrored from the previous curves control point
// and the end point is defined relative from the current position by the x, y values.
$draw->pathCurveToQuadraticBezierSmoothRelative(
200,-100
);

$draw->pathFinish();

$imagick = new \Imagick();
$imagick->newImage(700, 500, $backgroundColor);
$imagick->setImageFormat("png");

$imagick->drawImage($draw);

header("Content-Type: image/png");
echo
$imagick->getImageBlob();
?>

添加注释

用户贡献的注释

此页面没有用户贡献的注释。
To Top