Added explaination of how beziersmooth works.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@335724 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Dan Ackroyd 2015-01-12 16:45:28 +00:00
parent b6bd53672f
commit 3dd3c7bfb8
2 changed files with 130 additions and 3 deletions

View file

@ -13,7 +13,7 @@
<methodparam><type>float</type><parameter>x</parameter></methodparam>
<methodparam><type>float</type><parameter>y</parameter></methodparam>
</methodsynopsis>
&warn.undocumented.func;
<para>
Draws a quadratic Bezier curve (using absolute coordinates) from the
current point to (x,y). The control point is assumed to be the reflection
@ -26,8 +26,12 @@
coincident with the current point.). At the end of the command, the new
current point becomes the final (x,y) coordinate pair used in the polybezier.
</para>
<para>
This function cannot be used to continue a cubic Bezier curve smoothly. It can only continue from a quadratic curve smoothly.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
@ -50,7 +54,7 @@
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
@ -59,6 +63,65 @@
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>
<methodname>ImagickDraw::pathCurveToQuadraticBezierSmoothAbsolute</methodname>
</title>
<programlisting role="php">
<![CDATA[
<?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();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -27,6 +27,10 @@
current point becomes the final (x, y) coordinate pair used in the
polybezier.
</para>
<para>
This function cannot be used to continue a cubic Bezier curve smoothly. It can only continue from a quadratic curve smoothly.
</para>
</refsect1>
<refsect1 role="parameters">
@ -60,6 +64,66 @@
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>
<methodname>ImagickDraw::pathCurveToQuadraticBezierSmoothRelative</methodname>
</title>
<programlisting role="php">
<![CDATA[
<?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();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file