nannou icon indicating copy to clipboard operation
nannou copied to clipboard

Rounded corners on rect

Open tonymullen opened this issue 2 years ago • 2 comments

I'm not seeing any way to add rounded corners for rect shapes. Assuming this is a feature that isn't yet implemented, I'd be grateful if anyone can point me to where I should start looking in order to work on implementing this. I'm new to both Nannou and Rust but I'd be interested to take a stab at contributing some code if possible.

Otherwise, if it is implemented, please let me know how to do it.

tonymullen avatar Apr 22 '22 16:04 tonymullen

You could do this easily by drawing a polyline: https://guide.nannou.cc/tutorials/basics/drawing-2d-shapes.html

maybe you could write a nice addition to the rect.rs or add polyline.rs this this kinda functionality? https://github.com/nannou-org/nannou/blob/master/nannou/src/draw/primitive/rect.rs

mvklingeren avatar Aug 07 '22 19:08 mvklingeren

I have a working implementation that follows along with the approach in ellipse.rs , using an svg_builder to build the path. Will submit a PR shortly. I don't currently grok the testing approach for this part of the library, but the rounded rectangle is implemented in the draw example.

dwcarr avatar Sep 07 '22 20:09 dwcarr