note 50795 added to function.pdf-curveto
| From: | rune at zedeler dot dk | Date: | Thu, 10 Mar 2005 03:51:18 +0000 |
| Subject: | note 50795 added to function.pdf-curveto | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-86190@lists.php.net to get a copy of this message | ||
Rod's function does not work (the thing produced is not even symmetrical).
Here is one that produces a correct approximation to an ellipse:
function pdf_ellipse ($pdfobj,$x,$y,$width,$height) {
// Function to draw an ellipse inscribed in a rectangle
// described by lower left (x,y) with width and height.
$fac = (4*sqrt(2)-4)/3;
$dx = $width*(1-$fac)/2;
$dy = $height*(1-$fac)/2;
pdf_moveto($pdfobj, $x,$y+$height/2);
pdf_curveto($pdfobj, $x,$y+$height-$dy, $x+$dx,$y+$height, $x+$width/2,$y+$height);
pdf_curveto($pdfobj, $x+$width-$dx,$y+$height, $x+$width,$y+$height-$dy, $x+$width,$y+$height/2);
pdf_curveto($pdfobj, $x+$width,$y+$dy, $x+$width-$dx,$y, $x+$width/2,$y);
pdf_curveto($pdfobj, $x+$dx,$y, $x,$y+$dy, $x,$y+$height/2);
}
----
Manual Page -- http://www.php.net/manual/en/function.pdf-curveto.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50795
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50795&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50795&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50795&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50795&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50795&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50795&report=yes
Search -- http://master.php.net/manage/user-notes.php