Module canvas

A layer the user can draw on

Canvas extends BoundObject

Properties

alpha Alpha value of the canvas from 0 to 1
angle_threshold The angle difference required for the path simplifier to recognize a new vertex.
angle_color An {r, g, b, a} vector representing the color for the line between the first and last point of the draw action.
angle_z The z value for the angle line.
bg_color An {r, g, b, a} vector representing the Canvas background color.
bg_z The z value for the canvas background.
distance_threshold The minimum distance required for the path simplifier to recognize a new vertex.
draw_color An {r, g, b, a} vector representing the Canvas draw color.
draw_z The z value for the canvas draw path.
draw_width Draw render width in pixels
enabled (bool) Whether the canvas is currently accepting input.
simplified_path_color An {r, g, b, a} vector representing the simplified path.
simplified_path_z The z value for the simplified path.
shape_matcher A ShapeMatcher hosted by the Canvas

Class Methods

Canvas:new () Create a new Canvas

Instance Methods

canvas:empty () Empty the canvas.

Hooks

finish (self, angle, distance) Called when the Canvas finishes drawing


Properties

Properties. Significant fields on an instance.
alpha
Alpha value of the canvas from 0 to 1
angle_threshold
The angle difference required for the path simplifier to recognize a new vertex. In degrees
angle_color
An {r, g, b, a} vector representing the color for the line between the first and last point of the draw action.
angle_z
The z value for the angle line.

Default -7.0

bg_color
An {r, g, b, a} vector representing the Canvas background color.
bg_z
The z value for the canvas background.

Default -120.0

distance_threshold
The minimum distance required for the path simplifier to recognize a new vertex. In pixels
draw_color
An {r, g, b, a} vector representing the Canvas draw color.
draw_z
The z value for the canvas draw path.

Default -9.0

draw_width
Draw render width in pixels
enabled
(bool) Whether the canvas is currently accepting input.
simplified_path_color
An {r, g, b, a} vector representing the simplified path.
simplified_path_z
The z value for the simplified path.

Default -8.0

shape_matcher
A ShapeMatcher hosted by the Canvas

Class Methods

Class Methods. Must be called on Class, with a capital leading character. e.g. Class:method("foo")
Canvas:new ()
Create a new Canvas

Returns:

    Canvas

Instance Methods

Instance Methods. Must be called on an instance of Class. e.g. instance:method("foo")
canvas:empty ()
Empty the canvas.

Returns:

    nil

Hooks

Hooks. Callbacks implemented in subclasses to customize behavior. Hooks are called on individual instances.
finish (self, angle, distance)
Called when the Canvas finishes drawing

Parameters:

  • self Canvas The Canvas instance
  • angle The angle between the touch and release points in degrees
  • distance The distance between the touch and release points in pixels
generated by LDoc 1.3.12