Image & Canvas canvasDrawLine

$canvasDrawLine

Draws a line between two points using Bresenham's algorithm with configurable thickness

Syntax
$canvasDrawLine[x1;y1;x2;y2;color;thickness;blend?;container?]

Parameters

Parameter Type Required Default Description
x1 integer check_circle Required Start point X coordinate
y1 integer check_circle Required Start point Y coordinate
x2 integer check_circle Required End point X coordinate
y2 integer check_circle Required End point Y coordinate
color color check_circle Required Line color
thickness integer check_circle Required Line width in pixels (clamped to 1–100). Thickness > 1 expands perpendicular to the line direction.
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.

Lines are drawn using Bresenham’s algorithm for precision. When thickness is greater than 1, the line expands perpendicular to its direction, creating a band. Thickness is clamped between 1 and 100 pixels. Use blend modes like overlay or multiply to create subtle dividers and accent lines without fully opaque colors.

Examples

Thin separator line

$canvasDrawLine[20;100;380;100;#AAAAAA;1]

Thick accent line

$canvasDrawLine[0;0;200;200;E53935;4;overlay]