CANVAS:stroke_line

CANVAS:stroke_line(x1, y1, x2, y2, color)

Stroke a line between the points x1,y2 to x2,y2 with a specific color. The width of the line is the last value passed to CANVAS:set_line_width or 1 if no width has ever been specified.


Parameters:
    x1      The x position of the first corner
    y1      The y position of the first corner
    x2      The x position of the second corner
    y2      The y position of the second corner
    color   An RGB color value as an integer value.
                    

-- Stroke a triangle with three different colored line segments
function StrokeRGB(name)
    local canvas = gre.get_canvas(name)
    local size = canvas:get_dimensions()
    local mid = size.width / 2

    -- Shrink the bounds to make the lines visible
    size.height = size.height - 2
    size.width = size.width - 2

    canvas:stroke_line(2, 2, mid, size.height, 0xff0000)
    canvas:stroke_line(mid, size.height, size.width, 2, 0x00ff00)
    canvas:stroke_line(2, 2, size.width, 2, 0x0000ff)
end