Canvas object

The Canvas widget draws shapes, text, and images on a window surface

Event Description
Canvas:onClick() Event fired when the user clicks on the Canvas
Canvas:onContext() Event fired when the user right click on the Canvas
Canvas:onCreate() Event fired when Canvas has just been created
Canvas:onHide() Event fired when canvas is hidden
Canvas:onHover() Event fired when the user moves the mouse pointer over the Canvas
Canvas:onLeave() Event fired when the mouse cursor leaves the Canvas
Canvas:onMouseDown() Event fired when the user presses a mouse button over the Canvas
Canvas:onMouseUp() Event fired when the user releases a mouse button over the Canvas
Canvas:onMouseWheel() Event fired when the user rotates the mouse wheel
Canvas:onPaint() Event fired when canvas need to be redrawn
Canvas:onShow() Event fired when canvas is shown
Property Description Access Type
Canvas.align Align the canvas relative to its parent readwrite boolean
Canvas.bgcolor Get/set the canvas actual background color readwrite number
Canvas.color Get/set the canvas actual color for drawing readwrite string
Canvas.enabled Enable/disable the canvas widget readwrite boolean
Canvas.font Get/set the canvas current font readwrite string
Canvas.fontsize Get/set the canvas current font size readwrite number
Canvas.fontstretch Get/set the canvas current font stretch readwrite number
Canvas.fontstyle Get/set the canvas current font style readwrite table
Canvas.fontweight Get/set the canvas current font weigth readwrite number
Canvas.height Get/set the canvas's height readwrite number
Canvas.parent Get the Canvas's parent widget readonly
Canvas.visible Controls whether the canvas appears on screen readwrite boolean
Canvas.width Get/set the canvas's width readwrite number
Canvas.x Get/set the canvas's horizontal position readwrite number
Canvas.y Get/set the canvas's vertical position readwrite number
Methods Description Return value
Canvas:begin() Prepares the Canvas back buffer for drawing -
Canvas:capture() Captures canvas content to file -
Canvas:center() Centers the canvas on the parent widget -
Canvas:circle() Draws a circle -
Canvas:clear() Clears the canvas surface and prepare it for drawing -
Canvas:constructor() Canvas object constructor
Canvas:ellipse() Draws an ellipse -
Canvas:fillcircle() Draws a filled-in circle -
Canvas:fillellipse() Draws a fillled-in ellipse -
Canvas:fillrect() Draws a filled-in rectangle -
Canvas:fillroundrect() Draws a filled-in rounded rectangle -
Canvas:flip() Flips the back buffer and display it -
Canvas:hide() Hides the canvas -
Canvas:identity() Resets Canvas transformations -
Canvas:Image() Creates a new Image
Canvas:line() Draws a line -
Canvas:LinearGradient() Creates a new linear gradient brush
Canvas:measure() Measures the text size on the Canvas table
Canvas:point() Draws a point -
Canvas:print() Draws text on the Canvas -
Canvas:RadialGradient() Creates a new radial gradient brush
Canvas:rect() Draws a rectangle -
Canvas:rotate() Rotates the Canvas -
Canvas:roundrect() Draws a rounded rectangle -
Canvas:scale() Scales the Canvas -
Canvas:show() Shows the canvas -
Canvas:skew() Skews the Canvas -
Canvas:translate() Translates the Canvas -