Module canvas
Lua bindings to interact with canvass.
Note The API here is designed to be compatible with that of LÖVE.
Functions
__gc (canvas) | Frees a canvas. |
__eq (f1, f2) | Compares two canvass to see if they are the same. |
new (width, height[, depth=false]) | Opens a new canvas. |
set (arg) | Sets the active canvas. |
dims () | Gets the size of the canvas. |
getTex (canvas) | Gets the texture associated with the canvas. |
clear (canvas, col) | Clears a canvas. |
Functions
- __gc (canvas)
-
Frees a canvas.
Parameters:
- canvas Canvas Canvas to free.
- __eq (f1, f2)
-
Compares two canvass to see if they are the same.
Parameters:
- f1 Canvas Canvas 1 to compare.
- f2 Canvas Canvas 2 to compare.
Returns:
-
boolean
true if both canvass are the same.
- new (width, height[, depth=false])
-
Opens a new canvas.
Parameters:
- width number Width of the new canvas.
- height number Height of the new canvas.
- depth boolean Whether or not to add a depth channel to the canvas. (default false)
Returns:
-
Canvas
New canvas object.
- set (arg)
-
Sets the active canvas.
TODO Add actual graphics state maintenance! For now, just disable the
scissor region.
Parameters:
- arg Canvas or nil Either a canvas object or nil to disable.
- dims ()
-
Gets the size of the canvas.
Returns:
- number Width of the canvas.
- number Height of the canvas.
- getTex (canvas)
-
Gets the texture associated with the canvas.
Parameters:
- canvas Canvas Canvas to get the texture from.
Returns:
-
Tex
Texture associated with the canvas.
- clear (canvas, col)
-
Clears a canvas.
Parameters:
- canvas Canvas Canvas to clear.
- col Colour Colour to clear to.