Image & Canvas
canvasDrawRoundedRect
$canvasDrawRoundedRect
Draws a rectangle with rounded corners — filled or outline
Syntax
$canvasDrawRoundedRect[x;y;width;height;radius;color;fill;blend?;container?]
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| x | integer | check_circle Required | — | Top-left X coordinate |
| y | integer | check_circle Required | — | Top-left Y coordinate |
| width | integer | check_circle Required | — | Rectangle width |
| height | integer | check_circle Required | — | Rectangle height |
| radius | integer | check_circle Required | — | Corner radius in pixels (clamped to min(width, height) / 2) |
| color | color | check_circle Required | — | Fill or outline color |
| fill | boolean | check_circle Required | — | true = filled, false = outline |
| blend | string | Optional | — |
Blend mode
multiply
screen
overlay
darken
lighten
difference
hardLight
softLight
|
| container | string | Optional | — | Container name |
Return Value
canvas
Modifies the canvas in-place.
The corner radius is automatically clamped to at most half the smaller dimension (min(width, height) / 2) to prevent overlap between adjacent corners. This makes it ideal for card backgrounds, button shapes, and UI containers. For outline-only mode, the outline follows the rounded path at 1-pixel width.
Examples
Card background
$canvasCreate[card;400;200;#1a1a2e]
$canvasDrawRoundedRect[10;10;380;180;16;#23272A;true]
$canvasDrawText[Content here;30;100;16;white]
$attachImage[card]