Class: CanvasRenderTarget

PIXI.utils.CanvasRenderTarget

Creates a Canvas element of the given size to be used as a target for rendering to.

new PIXI.utils.CanvasRenderTarget (width, height, resolution)

Name Type Attributes Default Description
width number

the width for the newly created canvas

height number

the height for the newly created canvas

resolution number <optional>
PIXI.settings.RESOLUTION

The resolution / device pixel ratio of the canvas

Members

canvas HTMLCanvasElement

The Canvas object that belongs to this CanvasRenderTarget.

context CanvasRenderingContext2D

A CanvasRenderingContext2D object representing a two-dimensional rendering context.

height number

The height of the canvas buffer in pixels.

resolution number

The resolution / device pixel ratio of the canvas

Default Value:
  • 1

width number

The width of the canvas buffer in pixels.

Methods

destroy () void

Destroys this canvas.

resize (desiredWidth, desiredHeight) void

Resizes the canvas to the specified width and height.

Name Type Description
desiredWidth number

the desired width of the canvas

desiredHeight number

the desired height of the canvas