more powerful rounded rectangles


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:

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.


Robin Berjon <>
Research Scientist, Expway
7FC0 6F5F D864 EFB8 08CE  8E74 58E6 D5DB 4889 2488

Received on Wednesday, 10 September 2003 15:28:46 UTC