These docs are for Phaser 2.3.0 Phaser 3 docs can be found on GitHub pages.
Phaser CE docs can be found on the Phaser CE Documentation site.

Constructor

PIXI. CanvasTinter

new CanvasTinter()

Utility methods for Sprite/Texture tinting.

Source code: pixi/renderers/canvas/utils/CanvasTinter.js (Line 5)

Public Properties

<static> cacheStepsPerColorChannel : number

Number of steps which will be used as a cap when rounding colors.

Source code: pixi/renderers/canvas/utils/CanvasTinter.js (Line 250)

<static> canHandleAlpha : boolean

If the browser isn't capable of handling tinting with alpha this will be false. This property is only applicable if using tintWithPerPixel.

Source code: pixi/renderers/canvas/utils/CanvasTinter.js (Line 268)

<static> canUseMultiply : boolean

Whether or not the Canvas BlendModes are supported, consequently the ability to tint using the multiply method.

Source code: pixi/renderers/canvas/utils/CanvasTinter.js (Line 278)

<static> convertTintToImage : boolean

Tint cache boolean flag.

Source code: pixi/renderers/canvas/utils/CanvasTinter.js (Line 259)

Public Methods

<static> checkInverseAlpha()

Checks if the browser correctly supports putImageData alpha channels.

Source code: pixi/renderers/canvas/utils/CanvasTinter.js (Line 222)

<static> getTintedTexture(sprite, color) → {HTMLCanvasElement}

Basically this method just needs a sprite and a color and tints the sprite with the given color.

Parameters
Name Type Description
sprite PIXI.Sprite

the sprite to tint

color Number

the color to use to tint the sprite with

Returns
HTMLCanvasElement -

The tinted canvas

Source code: pixi/renderers/canvas/utils/CanvasTinter.js (Line 15)

<static> roundColor(color)

Rounds the specified color according to the PIXI.CanvasTinter.cacheStepsPerColorChannel.

Parameters
Name Type Description
color Number

the color to round, should be a hex color

Source code: pixi/renderers/canvas/utils/CanvasTinter.js (Line 202)

<static> tintMethod()

The tinting method that will be used.

Source code: pixi/renderers/canvas/utils/CanvasTinter.js (Line 287)

<static> tintPerPixel(texture, color, canvas)

Tint a texture pixel per pixel.

Parameters
Name Type Description
texture PIXI.Texture

the texture to tint

color Number

the color to use to tint the sprite with

canvas HTMLCanvasElement

the current canvas

Source code: pixi/renderers/canvas/utils/CanvasTinter.js (Line 147)

<static> tintWithMultiply(texture, color, canvas)

Tint a texture using the "multiply" operation.

Parameters
Name Type Description
texture PIXI.Texture

the texture to tint

color Number

the color to use to tint the sprite with

canvas HTMLCanvasElement

the current canvas

Source code: pixi/renderers/canvas/utils/CanvasTinter.js (Line 64)

<static> tintWithOverlay(texture, color, canvas)

Tint a texture using the "overlay" operation.

Parameters
Name Type Description
texture PIXI.Texture

the texture to tint

color Number

the color to use to tint the sprite with

canvas HTMLCanvasElement

the current canvas

Source code: pixi/renderers/canvas/utils/CanvasTinter.js (Line 111)