Class: Renderer

me. Renderer

new Renderer(canvas, width, height, options)

a base renderer object
Parameters:
Name Type Argument 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 Argument 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
Source:
renderer.js, line 30

Extends

Members

<static> settings :Object

The given constructor options
Type:
  • Object
Source:
renderer.js, line 37

Methods

<static> getBlendMode() → {String}

returns the current blend mode for this renderer
Source:
renderer.js, line 131
Returns:
blend mode
Type
String

<static> getCanvas() → {HTMLCanvasElement}

return a reference to the system canvas
Source:
renderer.js, line 97
Returns:
Type
HTMLCanvasElement

<static> getColor(current)

get the current fill & stroke style color.
Parameters:
Name Type Description
current me.Color global color
Source:
renderer.js, line 212

<static> getContext2d(canvas, transparent) → {Context2d}

Returns the 2D Context object of the given Canvas
Also configures anti-aliasing and blend modes based on constructor options.
Parameters:
Name Type Argument Default Description
canvas HTMLCanvasElement
transparent Boolean <optional>
true use false to disable transparency
Source:
renderer.js, line 142
Returns:
Type
Context2d

<static> getHeight() → {Number}

return the height of the system Canvas
Source:
renderer.js, line 201
Returns:
Type
Number

<static> getScreenCanvas() → {HTMLCanvasElement}

return a reference to the screen canvas
Source:
renderer.js, line 108
Returns:
Type
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)
Source:
renderer.js, line 119
Returns:
Type
Context2d

<static> getWidth() → {Number}

return the width of the system Canvas
Source:
renderer.js, line 190
Returns:
Type
Number

<static> globalAlpha() → {Number}

return the current global alpha
Source:
renderer.js, line 223
Returns:
Type
Number

<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
Source:
renderer.js, line 234

<static> setAntiAlias(context, enable)

enable/disable image smoothing (scaling interpolation) for the given context
Parameters:
Name Type Argument Default Description
context Context2d
enable Boolean <optional>
false
Source:
renderer.js, line 251