PIXI.CanvasExtract

class CanvasExtract

The extract manager provides functionality to export content from the renderers.

An instance of this class is automatically created by default, and can be found at renderer.plugins.extract

Constructor


new PIXI.CanvasExtract(renderer: PIXI.CanvasRenderer) → {}
Parameters:
Name Type Description
renderer PIXI.CanvasRenderer

A reference to the current renderer

Summary


Properties from CanvasExtract

PIXI.CanvasRenderer
renderer

A reference to the current renderer

Methods from CanvasExtract

string
base64(target: PIXI.DisplayObject | PIXI.RenderTexture, format: string, quality: number)
HTMLCanvasElement
canvas(target: PIXI.DisplayObject | PIXI.RenderTexture, frame: PIXI.Rectangle)
void
destroy()

Destroys the extract

HTMLImageElement
image(target: PIXI.DisplayObject | PIXI.RenderTexture, format: string, quality: number)
Uint8ClampedArray
pixels(target: PIXI.DisplayObject | PIXI.RenderTexture, frame: PIXI.Rectangle)

Public Properties


renderer CanvasExtract.ts:25
renderer: PIXI.CanvasRenderer

A reference to the current renderer

Public Methods


base64 CanvasExtract.ts:53
base64(target: PIXI.DisplayObject | PIXI.RenderTexture, format: string, quality: number) → {string}

Will return a base64 encoded string of this target. It works by calling CanvasExtract.getCanvas and then running toDataURL on that.

Parameters:
Name Type Attributes Description
target PIXI.DisplayObject | PIXI.RenderTexture

<optional>

A displayObject or renderTexture to convert. If left empty will use the main renderer

format string

<optional>

Image format, e.g. "image/jpeg" or "image/webp".

quality number

<optional>

JPEG or Webp compression from 0 to 1. Default is 0.92.

Returns:
Type Description
string

A base64 encoded string of the texture.

canvas CanvasExtract.ts:67
canvas(target: PIXI.DisplayObject | PIXI.RenderTexture, frame: PIXI.Rectangle) → {HTMLCanvasElement}

Creates a Canvas element, renders this target to it and then returns it.

Parameters:
Name Type Attributes Description
target PIXI.DisplayObject | PIXI.RenderTexture

<optional>

A displayObject or renderTexture to convert. If left empty will use the main renderer

frame PIXI.Rectangle

<optional>

The frame the extraction is restricted to.

Returns:
Type Description
HTMLCanvasElement

A Canvas element with the texture rendered on.

destroy CanvasExtract.ts:180
destroy() → {void}

Destroys the extract

Returns:
Type Description
void
image CanvasExtract.ts:36
image(target: PIXI.DisplayObject | PIXI.RenderTexture, format: string, quality: number) → {HTMLImageElement}

Will return a HTML Image of the target

Parameters:
Name Type Attributes Description
target PIXI.DisplayObject | PIXI.RenderTexture

<optional>

A displayObject or renderTexture to convert. If left empty will use the main renderer

format string

<optional>

Image format, e.g. "image/jpeg" or "image/webp".

quality number

<optional>

JPEG or Webp compression from 0 to 1. Default is 0.92.

Returns:
Type Description
HTMLImageElement

HTML Image of the target

pixels CanvasExtract.ts:126
pixels(target: PIXI.DisplayObject | PIXI.RenderTexture, frame: PIXI.Rectangle) → {Uint8ClampedArray}

Will return a one-dimensional array containing the pixel data of the entire texture in RGBA order, with integer values between 0 and 255 (included).

Parameters:
Name Type Attributes Description
target PIXI.DisplayObject | PIXI.RenderTexture

<optional>

A displayObject or renderTexture to convert. If left empty will use the main renderer

frame PIXI.Rectangle

<optional>

The frame the extraction is restricted to.

Returns:
Type Description
Uint8ClampedArray

One-dimensional array containing the pixel data of the entire texture


Powered by webdoc!