note 42815 added to function.imagefilledrectangle
| From: | michaldotkocarekatseznamdotcz at rn2 dot php dot net | Date: | Sun, 30 May 2004 17:18:38 +0000 |
| Subject: | note 42815 added to function.imagefilledrectangle | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-70313@lists.php.net to get a copy of this message | ||
If you want to draw a rectangle with rounded corners, you can use this simple function...
Rectangle starts at x1y1 and ends at x2y2. $radius defines radius of circled corner.
<?
function ImageRectangleWithRoundedCorners(&$im, $x1, $y1, $x2, $y2, $radius, $color) {
// draw rectangle without corners
imagefilledrectangle($im, $x1+$radius, $y1, $x2-$radius, $y2, $color);
imagefilledrectangle($im, $x1, $y1+$radius, $x2, $y2-$radius, $color);
// draw circled corners
imagefilledellipse($im, $x1+$radius, $y1+$radius, $radius*2, $radius*2, $color);
imagefilledellipse($im, $x2-$radius, $y1+$radius, $radius*2, $radius*2, $color);
imagefilledellipse($im, $x1+$radius, $y2-$radius, $radius*2, $radius*2, $color);
imagefilledellipse($im, $x2-$radius, $y2-$radius, $radius*2, $radius*2, $color);
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.imagefilledrectangle.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42815
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42815&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42815&report=yes
Search -- http://master.php.net/manage/user-notes.php