Skip to content
Image & Canvas canvasDrawRect

$canvasDrawRect[]

When fill is false, the rectangle is drawn as a 1-pixel wide outline — there is no thickness parameter. For thicker outlines, use multiple overlapping rectangles or $canvasDrawLine calls. For rectangles with rounded corners, prefer $canvasDrawRoundedRect. The blend mode enables per-pixel compositing for effects like shadows and overlays.

Syntax

bdfd
$canvasDrawRect[x;y;width;height;color;fill;blend?;container?]

Examples

Draw Rounded Accent Box

$canvasCreate[boxCanvas;400;160;#121212]
$canvasDrawRect[20;20;360;120;#9B30FF;true;source-over;boxCanvas]
$canvasDrawText[boxCanvas;Alert Box;50;85;24;#FFFFFF]
$attachImage[boxCanvas]
$sendMessage[Rendered rectangular accent box.]