Class: Canvas

Canvas(widthopt, heightopt)

Manages the HTML5 Canvas element, its drawing contexts, and global drawing states.

Constructor

new Canvas(widthopt, heightopt)

Parameters:
Name Type Attributes Default Description
width number <optional>
640 The width of the canvas.
height number <optional>
480 The height of the canvas.
Source:

Classes

Canvas

Members

alpha

The global alpha value (not currently implemented in drawing operations).
Source:

alpha

Source:

autoMidHandle

Source:

autoMidHandle

Whether automatic mid-handling is enabled.
Source:

clsColor

The color used by the Cls command.
Source:

context

The currently active 2D rendering context (either the screen or an image buffer).
Source:

drawColor

The currently active drawing color.
Source:

element

The underlying HTMLCanvasElement.
Source:

focus

Source:

height

The height of the main canvas.
Source:

scale

The global scale value (not currently implemented in drawing operations).
Source:

scale

Source:

width

The width of the main canvas.
Source:

Methods

readPixel(x, y) → {Object}

Reads the color data of a single pixel from the main canvas.
Parameters:
Name Type Description
x number The x-coordinate of the pixel.
y number The y-coordinate of the pixel.
Source:
Returns:
An object with the RGBA color components.
Type
Object

setBlendMode(mode)

Sets the composition mode for all subsequent drawing operations.
Parameters:
Name Type Description
mode string The blend mode to apply (e.g., "add", "multiply", "screen"). Defaults to "default".
Source:

setTarget(jmageOrNull)

Sets the active drawing target.
Parameters:
Name Type Description
jmageOrNull object | null The Jmage instance to draw to, or null to draw to the screen.
Source: