me.Renderer(canvas, width, height, optionsopt)

new Renderer(canvas, width, height, optionsopt)

a base renderer object

Parameters:
Name Type Attributes Description
canvas HTMLCanvasElement

The html canvas tag to draw to on screen.

width Number

The width of the canvas without scaling

height Number

The height of the canvas without scaling

options Object <optional>

The renderer parameters

Properties
Name Type Attributes Default Description
doubleBuffering Boolean <optional>
false

Whether to enable double buffering

antiAlias Boolean <optional>
false

Whether to enable anti-aliasing, use false (default) for a pixelated effect.

failIfMajorPerformanceCaveat Boolean <optional>
true

If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.

transparent Boolean <optional>
false

Whether to enable transparency on the canvas (performance hit when enabled)

blendMode Boolean <optional>
"normal"

the default blend mode to use ("normal", "multiply")

subPixel Boolean <optional>
false

Whether to enable subpixel rendering (performance hit when enabled)

verbose Boolean <optional>
false

Enable the verbose mode that provides additional details as to what the renderer is doing

zoomX Number <optional>
width

The actual width of the canvas with scaling applied

zoomY Number <optional>
height

The actual height of the canvas with scaling applied

Extends

Classes

Texture

Members

static settings :Object

The given constructor options

Methods

static clearMask()

disable (remove) the rendering mask set through setMask.

See:
  • setMask

static clearTint()

clear the rendering tint set through setTint.

See:
  • setTint

static drawShape()

Deprecated:
  • since 6.3.0
See:

static fill(shape)

fill the given shape

Parameters:
Name Type Description
shape me.Rect | me.Polygon | me.Line | me.Ellipse

a shape object to fill

static getBlendMode() → {String}

returns the current blend mode for this renderer

Returns:
String -

blend mode

static getCanvas() → {HTMLCanvasElement}

return a reference to the system canvas

Returns:
HTMLCanvasElement

static getColor(current)

get the current fill & stroke style color.

Parameters:
Name Type Description
current me.Color

global color

static getContext2d(canvas, transparentopt) → {Context2d}

Returns the 2D Context object of the given Canvas
Also configures anti-aliasing and blend modes based on constructor options.

Parameters:
Name Type Attributes Default Description
canvas HTMLCanvasElement
transparent Boolean <optional>
true

use false to disable transparency

Returns:
Context2d

static getHeight() → {Number}

return the height of the system Canvas

Returns:
Number

static getScreenCanvas() → {HTMLCanvasElement}

return a reference to the screen canvas

Returns:
HTMLCanvasElement

static getScreenContext() → {Context2d}

return a reference to the screen canvas corresponding 2d Context
(will return buffered context if double buffering is enabled, or a reference to the Screen Context)

Returns:
Context2d

static getWidth() → {Number}

return the width of the system Canvas

Returns:
Number

static globalAlpha() → {Number}

return the current global alpha

Returns:
Number

static overlaps(rect) → {boolean}

check if the given rectangle overlaps with the renderer screen coordinates

Parameters:
Name Type Description
rect me.Rect
Returns:
boolean -

true if overlaps

static resize(width, height)

resizes the system canvas

Parameters:
Name Type Description
width Number

new width of the canvas

height Number

new height of the canvas

static setAntiAlias(context, enableopt)

enable/disable image smoothing (scaling interpolation) for the given context

Parameters:
Name Type Attributes Default Description
context Context2d
enable Boolean <optional>
false

static setMask(maskopt)

A mask limits rendering elements to the shape and position of the given mask object. So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible. Mask are not preserved through renderer context save and restore.

Parameters:
Name Type Attributes Description
mask me.Rect | me.Polygon | me.Line | me.Ellipse <optional>

the shape defining the mask to be applied

static setTint(tintopt)

set a rendering tint (WebGL only) for sprite based renderables.

Parameters:
Name Type Attributes Description
tint me.Color <optional>

the tint color

static stroke(shape)

stroke the given shape

Parameters:
Name Type Description
shape me.Rect | me.Polygon | me.Line | me.Ellipse

a shape object to stroke