PIXI. CanvasTinter

new CanvasTinter()

Utility methods for Sprite/Texture tinting.

Source - pixi/renderers/canvas/utils/CanvasTinter.js, line 5

Members

<static> cacheStepsPerColorChannel :Number

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

Source - pixi/renderers/canvas/utils/CanvasTinter.js, line 209

<static> canUseMultiply :Boolean

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

Source - pixi/renderers/canvas/utils/CanvasTinter.js, line 227

<static> convertTintToImage :Boolean

Tint cache boolean flag.

Source - pixi/renderers/canvas/utils/CanvasTinter.js, line 218

Methods

<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 - 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 - pixi/renderers/canvas/utils/CanvasTinter.js, line 189

<static> tintMethod()

The tinting method that will be used.

Source - pixi/renderers/canvas/utils/CanvasTinter.js, line 236

<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 - pixi/renderers/canvas/utils/CanvasTinter.js, line 143

<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 - pixi/renderers/canvas/utils/CanvasTinter.js, line 60

<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 - pixi/renderers/canvas/utils/CanvasTinter.js, line 107
Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Thu Dec 04 2014 11:33:05 GMT-0000 (GMT) using the DocStrap template.