W3C home > Mailing lists > Public > www-svg@w3.org > September 2003

more powerful rounded rectangles

From: Robin Berjon <robin.berjon@expway.fr>
Date: Wed, 10 Sep 2003 21:30:46 +0200
Message-ID: <3F5F7BE6.5050306@expway.fr>
To: www-svg@w3.org

Hi,

I've been doing quite a bit of SVG these days in which I've wanted to have 
<rect>s that had only certain of their corners rounded. There's a bunch of ways 
of doing that by clipping or with paths, but none are all that pleasant when all 
you really want to work with are rectangles.

So I went the obvious route and implemented my own RCC rectangle with more 
powerful corner-rounding:

   http://www.expway.com/robin/round-rect/roundRect.svg

and it appears to work ok (even if it's a hack codewise). I've added eight 
attributes for rx1-rx4 and ry1-ry4 to select the corners in clockwise order, 
starting from the top-left one.

Since I was having fun I got carried away and added five more called ri1-ri4 and 
ri which defaults the non-specified riN. The "i" is for invert, better names are 
welcome. What it does is swap the angle so that the rounding is inside the 
rectable (as can be seen in that demo).

Am I the only one to have wanted that? Should this be considered for the spec? 
The implementation I made mirrors the description in the spec of how to 
implement a rectangle over a path, with just a few small changes.

Thoughts?

-- 
Robin Berjon <robin.berjon@expway.fr>
Research Scientist, Expway      http://expway.com/
7FC0 6F5F D864 EFB8 08CE  8E74 58E6 D5DB 4889 2488
Received on Wednesday, 10 September 2003 15:28:46 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:25 GMT