CanvasTexture¶
The CanvasTexture class represents a drawable canvas within the engine framework, allowing for the creation and manipulation of textures through various drawing operations, making it ideal for dynamic visual content generation and customization in applications requiring real-time graphical updates.
Inherits from¶
Usage¶
To use this class, add the following require at the top of your script:
local CanvasTexture = require 'engine/items/canvastexture'
Reference¶
- class CanvasTexture¶
- module:
- create(attributes)¶
Create a new canvasTexture
- Parameters:
attributes (
table
) – list of attributes. without, the canvasTexture will be created with default values- Returns:
the created canvasTexture
- Return type:
- getMaterial()¶
Get the alpha map of the material.
- Returns:
The alpha map texture.
- Return type:
- clear()¶
- drawRect(left, top, width, height, color, radius)¶
- Parameters:
left (
any
)top (
any
)width (
any
)height (
any
)color (
any
)radius (
any
)
- clearRect(left, top, width, height)¶
- Parameters:
left (
any
)top (
any
)width (
any
)height (
any
)
- drawTexture(texture, left, top, width, height, tint)¶
- Parameters:
texture (
any
)left (
any
)top (
any
)width (
any
)height (
any
)tint (
any
)
- drawText(text, left, top, fontSize, font, color)¶
- Parameters:
text (
any
)left (
any
)top (
any
)fontSize (
any
)font (
any
)color (
any
)
- render()¶
- measureText(text, fontSize, font)¶
- Parameters:
text (
any
)fontSize (
any
)font (
any
)