Class: CanvasTinter

PIXI. CanvasTinter

Utility methods for Sprite/Texture tinting.

Members

staticPIXI.CanvasTinter.cacheStepsPerColorChannel

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

staticPIXI.CanvasTinter.canUseMultiply

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

staticPIXI.CanvasTinter.convertTintToImage

Tint cache boolean flag.

staticPIXI.CanvasTinter.tintMethod

The tinting method that will be used.

Methods

staticPIXI.CanvasTinter.getTintedTexture(sprite, color){HTMLCanvasElement}

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

Name Type Description
sprite PIXI.Sprite

the sprite to tint

color number

the color to use to tint the sprite with

Returns:
Type Description
HTMLCanvasElement The tinted canvas

staticPIXI.CanvasTinter.roundColor(color)

Rounds the specified color according to the CanvasTinter.cacheStepsPerColorChannel.

Name Type Description
color number

the color to round, should be a hex color

staticPIXI.CanvasTinter.tintWithMultiply(texture, color, canvas)

Tint a texture using the 'multiply' operation.

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

staticPIXI.CanvasTinter.tintWithOverlay(texture, color, canvas)

Tint a texture using the 'overlay' operation.

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

staticPIXI.CanvasTinter.tintWithPerPixel(texture, color, canvas)

Tint a texture pixel per pixel.

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