CANVAS:stroke_poly

CANVAS:stroke_poly(xytable, color)

Stroke a polygon through the points defined in the xytable 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:
    xytable A Lua table {{x=x1,y=y1},{x=x2,y=y2}...}.  Alternatively two tables of parameters containing an
            array of points may be provided as in {x1,x2,..}, {y1,y2,..} similar to the section called “gre.poly_string”
    color   An RGB color value as an integer value.
                    

-- Stroke a triangle using a polygon
function StrokeRedTrianglePoly(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

    local pts = {}
    table.insert(pts, {x=2,y=2})
    table.insert(pts, {x=mid,y=size.height})
    table.insert(pts, {x=size.width,y=2})
    table.insert(pts, pts[1])               --Close the polygon
    canvas:stroke_poly(pts, 0xff0000)
end