Class: CanvasContextSystem

PIXI.CanvasContextSystem

System that manages the canvas 2d contexts

new PIXI.CanvasContextSystem (renderer)

Name Type Description
renderer PIXI.CanvasRenderer

A reference to the current renderer

Implements

Members

_projTransform PIXI.Matrix

Projection transform, passed in render() stored here

Default Value:
  • undefined

The currently active canvas 2d context (could change with renderTextures)

blendModes string[] readonly

Tracks the blend modes useful for this renderer.

The root canvas 2d context that everything is drawn with.

smoothProperty SmoothingEnabledProperties

The canvas property used to set the canvas smoothing property.

Default Value:
  • "imageSmoothingEnabled"

Methods

clear (clearColor, alpha) void

Clear the canvas of renderer.

Name Type Attributes Description
clearColor string <optional>

Clear the canvas with this color, except the canvas is transparent.

alpha number <optional>

Alpha to apply to the background fill color.

initiates the system

invalidateBlendMode () void

Checks if blend mode has changed.

setBlendMode (blendMode, readyForOuterBlend) void

Sets the blend mode of the renderer.

Name Type Attributes Default Description
blendMode number

See PIXI.BLEND_MODES for valid values.

readyForOuterBlend boolean <optional>
false

Some blendModes are dangerous, they affect outer space of sprite. Pass true only if you are ready to use them.

setContextTransform (transform, roundPixels, localResolution) void

Sets matrix of context. called only from render() methods takes care about resolution

Name Type Attributes Description
transform PIXI.Matrix

world matrix of current element

roundPixels boolean <optional>

whether to round (tx,ty) coords

localResolution number <optional>

If specified, used instead of renderer.resolution for local scaling