Re: Rounded rectangle in php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It is certainly possible, but to my knowledge, there is no built-in method
for doing so.

After a quick Google, it looks like this has been done before:
http://www.assemblysys.com/dataServices/php_roundedCorners.php
http://us3.php.net/manual/en/function.imagefilledrectangle.php#42815


But if you're looking to reinvent the wheel:

1.) Given any three noncolinear points, you can construct a circle. (whose
center is at the intersection of perpendicular bisectors of line segments
connecting these points)
2.) Using imageline(), you can draw the sides of your rectangle, minus the
corners.  At the "empty space" where each corner would be you would  have
the ends of two lines--two points.


3.) Then you need to choose a third point that is "between" those two.
(there is a certain line that the "between" point should lie on)

4.) Once you have three points, you can calculate the center and radius of
the circle that passes through them.  Then use imagearc() to draw the
"rounded corner".


-- Greg


On Thu, Jan 29, 2009 at 8:36 AM, Jônatas Zechim <zechim.php@xxxxxxxxx>wrote:

> Hi there, is it possible do make a rounded rectangle in php, i can do a
> ellipse, but i need a space between the corners, i need to make something
> like this:
>
> http://superbrush.files.wordpress.com/2008/03/086.jpg
>
> not the color and the shadows, only the form.
>
>
> zechim
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux