CANVAS:stroke_rect
CANVAS:stroke_rect(x1, y1, x2, y2, color)
Stroke a rectangle outline defined by the bounding area of x1,y2 to x2,y2 with a specific color. The width of the outline is the last value passed to CANVAS:set_line_width() or 1 if no width has ever been specified.
Parameters
| Parameter | Type | Description |
|---|---|---|
x1 | #number | The x position of the first corner. |
y1 | #number | The y position of the first corner. |
x2 | #number | The x position of the second corner. |
y2 | #number | The y position of the second corner. |
color | #number | An RGB color value as an integer value. |
Example
-- Draw three colored outlines across the canvas
function StrokeRGB(name)
local canvas = gre.get_canvas(name)
local size = canvas:get_dimensions()
local rw = size.width / 3
canvas:stroke_rect(0, 0, rw-1, size.height, 0xff0000)
canvas:stroke_rect(rw, 0, 2*rw-1, size.height, 0x00ff00)
canvas:stroke_rect(2*rw, 0, 3*rw-1, size.height, 0x0000ff)
end