natiny.render.rounded_rectangle
natiny.render.rounded_rectangle(x, y, w, h, radius_tl [, radius_tr [, radius_br [, radius_bl]]])
Draws a filled rectangle with each corner rounded by a radius of its own, on
the currently bound render target, using the current drawing color set by
natiny.render.set_color().
Radii are ordered top-left, top-right, bottom-right, bottom-left. In Lua, one radius is shorthand for the same value on all four corners.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
x |
number |
Left edge X position | |
y |
number |
Top edge Y position | |
w |
number |
Width | |
h |
number |
Height | |
radius_tl |
number |
Top-left corner radius | |
radius_tr |
number |
radius_tl |
Top-right corner radius |
radius_br |
number |
radius_tl |
Bottom-right corner radius |
radius_bl |
number |
radius_tl |
Bottom-left corner radius |
Example
natiny.render.rounded_rectangle(40, 40, 240, 140, 14)
Notes
- Negative radii become
0; a zero or negative width or height draws nothing. - If adjacent radii do not fit a side, all four are scaled down by one common factor until they fit. All-zero radii produce a plain rectangle.
- UV coordinates run from
0to1across the rectangle bounds.