QuantumBadger / Speedy2D

Rust library for hardware accelerated drawing of 2D shapes, images, and text, with an easy to use API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RoundedRectangle

dennisorlando opened this issue · comments

commented

Would it be ok if I wrote a RoundedRectangle struct parallel to the normal Rectangle?
I would draw it by drawing 2 rectangles in a "cross" and then 4 circles in the corner

It would be better to have a function to draw rounded rectangle without filling with color.

I'm happy for this to be added :) The most efficient way to draw it is to:

  • Use three rectangles instead of two, to avoid unnecessarily drawing the overlapping area
  • Similarly, with the four circles, it's only necessary to draw a quarter of each one -- this can be done using draw_circle_section_triangular_three_color() twice for each corner

It would be better to have a function to draw rounded rectangle without filling with color.

Yeah, this would also be good to add at some point. I think it would need changes to the shader though (so that circles have an "inner" radius in addition to the "outer" radius).

commented

Ok, working on it

commented

#81, might have messed up some trait bounds, especially when using the magnitude