rounded rectangle graphics
This is my attempt to add functionality for additional canvas shape, rounded rectangle.
I don't think this approach is flexible enough. For example, I would expect drawing a square with a very high border radius to result in a circle. This is what happens in iced::Border::rounded and also in CSS. However, in your implementation, a buggy shape is drawn.
For example, here's the result of drawing examples/graphics with a radius of 80:
Hmm, so what should flexible solution do instead? I can make radius relative to the width of the rectangle or disallow too big radius.
Hmm, so what should flexible solution do instead?
It looks like, at the very least, you want something like:
radius = min(radius, min(height / 2, width / 2))
See:
- https://www.w3.org/TR/css-backgrounds-3/#the-border-radius
- https://www.w3.org/Style/CSS/Tracker/issues/29
It would also be nice to be able to specify horizontal and vertical radius, and to specify individual radii for each of the 4 corners, by using or extending the existing iced::Border::Radius.
One commit implement just min check, other use Radius as argument, so it is possible to specify different radius for each corner.
This looks okay to me right now, but I'm not a maintainer so you'll have to wait for one to look at this.