UI module

draw_rect

procedureextensionexperimentalsince 0.31.0Source

Fill rect with color; radius rounds the corners and border draws an outline inside.

Example↗
ui := headless();
defer free_ui(*ui);
draw_rect(*ui, .{ 10, 10, 100, 40 }, rgb(40, 40, 60), radius = 6, border = 1, border_color = rgb(90, 90, 120));
assert(ui.draw.cmds.count == 1);
draw_rect :: (
    ui: *UI_State,
    rect: Rect,
    color: Color,
    radius: float = 0,
    border: float = 0,
    border_color: Color = .{}
)

Fill rect with color; radius rounds the corners and border draws an outline inside.

Parameters

ui: *UI_State
the UI whose display list gets the entry.
rect: Rect
the area to fill, in points.
color: Color
the fill colour.
radius: float = 0
corner radius in points.
border: float = 0
outline width in points.
border_color: Color = .{}
outline colour.
Example↗
ui := headless();
defer free_ui(*ui);
draw_rect(*ui, .{ 10, 10, 100, 40 }, rgb(40, 40, 60), radius = 6, border = 1, border_color = rgb(90, 90, 120));
assert(ui.draw.cmds.count == 1);

See also