Namespace: rlG

rlG

Methods

(static) createCanvas(container, idCanvas, width, height, zIndex, borderWidth, borderStyle, borderColor) → {HTMLCanvasElement}

Create and optionally insert a Canvas element into the given DOM container element.

Parameters:
Name Type Description
container Element | null

the Element into which to insert the created Canvas or null to create a stand-alone canvas

idCanvas string

the desired id to use for the <canvas> within the DOM

width number

the width of the Canvas in pixels

height number

the height of the Canvas in pixels

zIndex number

the zIndex of the Canvas

borderWidth string

width of the border, e.g. "2px"

borderStyle string

style of the border, e.g. "solid", "dotted"

borderColor string

color of the border, e.g. "#100381"

See:
Returns:

the created Canvas

Type
HTMLCanvasElement

(static) getContext2D(canvas) → {CanvasRenderingContext2D|null}

Get the 2D rendering context for a given Canvas (with imageSmoothingEnabled = false).

Parameters:
Name Type Description
canvas string | HTMLCanvasElement

a DOM id of a <canvas> or a HTMLCanvasElement

See:
Returns:

a 2D rendering context or null if none is available

Type
CanvasRenderingContext2D | null

(static) getContextGL(canvas, glContextAttributesopt) → {WebGLRenderingContext|null}

Get the webgl rendering context for a given Canvas.

Parameters:
Name Type Attributes Description
canvas string | HTMLCanvasElement

a DOM id of a <canvas> or a HTMLCanvasElement

glContextAttributes WebGLContextAttributes <optional>

WebGLContextAttributes

See:
Returns:

a webgl rendering context or null if none is available

Type
WebGLRenderingContext | null