Storyboard Lua Canvas API
The Storyboard canvas API provides an interface for clients to perform their own basic drawing operations into an in-memory buffer.
To access the drawing operations, a canvas render extension must be created first and given a unique name within the application. Once a canvas render extension is created, a Lua canvas object can be accessed using the gre.get_canvas() call.
In this documentation, the object returned from the gre.get_canvas() function will be identified as a CANVAS object. Methods associated with the CANVAS object must be invoked using the Lua colon (:) notation, for example CANVAS:stroke_rect().
The Lua canvas API is dependent on both the Lua plugin
(libgre-plugin-lua) and the canvas render extension plugin
(libgre-plugin-canvas).
CANVAS:clear_rect
Make transparent a rectangle defined by the bounding area of x1,y2 to x2,y2.
CANVAS:draw_image
Draw an image within the canvas directed by the user specified properties.
CANVAS:draw_text
Draw a string within the canvas directed by the user specified properties.
CANVAS:fill
Flood fill the entire canvas with a specific color.
CANVAS:fill_arc
Draw a filled arc defined by the center position (x,y), with x radius radiusx, y radius radiusy, start and end angles (startangle, endangle), rotation angle rotation, and with the color color.
CANVAS:fill_circle
Draw a filled circle defined by the center position (x,y), with radius radius, and with the color color.
CANVAS:fill_ellipse
Draw a filled ellipse defined by the center position (x,y), with x radius radiusx, y radius radiusy, rotation angle rotation, and with the color color.
CANVAS:fill_poly
Fill the content of a polygon through the points defined in the xytable with a specific color. The polygon must be a closed simple polygon.
CANVAS:fill_rect
Fill a rectangle defined by the bounding area of x1,y2 to x2,y2 with a specific color.
CANVAS:get_dimensions
Return the width and height of a canvas object.
CANVAS:set_alpha
Set the transparency level with which subsequent draw operations should be performed. The default value for alpha is 255 (fully opaque).
CANVAS:set_line_width
Set the line width in pixels that all subsequent stroke operations should use. The default value for line width is 1.
CANVAS:set_pixel
Set the pixel value at x, y to the specified color. This is equivalent to drawing a 1x1 filled rectangle.
CANVAS:stroke_arc
Draw a stroked arc defined by the center position (x,y), with x radius radiusx, y radius radiusy, start and end angles (startangle, endangle), rotation angle rotation, and with the color color.
CANVAS:stroke_circle
Draw a stroked circle defined by the center position (x,y), with radius radius, and with the color color.
CANVAS:stroke_ellipse
Draw a stroked ellipse defined by the center position (x,y), with x radius radiusx, y radius radiusy, rotation angle rotation, and with the color color.
CANVAS:stroke_line
Stroke a line between the points x1,y1 to x2,y2 with a specific color. The width of the line is the last value passed to CANVAS:setlinewidth or 1 if no width has ever been specified.
CANVAS:stroke_poly
Stroke a polygon through the points defined in xytable with a specific color. The width of the line is the last value passed to CANVAS:setlinewidth() or 1 if no width has ever been specified.
CANVAS:stroke_rect
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:setlinewidth() or 1 if no width has ever been specified.
gre.get_canvas
Get a canvas object handle by name.