Class: CanvasTinter

CanvasTinter


new CanvasTinter()

Utility methods for Sprite/Texture tinting.

Source:

Members


<static> cacheStepsPerColorChannel

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

Source:

<static> canUseMultiply

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

Source:

<static> convertTintToImage

Tint cache boolean flag.

Source:

<static> tintMethod

The tinting method that will be used.

Source:

Methods


<static> getTintedTexture(sprite, color)

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

Parameters:
Name Type Description
sprite Sprite

the sprite to tint

color number

the color to use to tint the sprite with

Source:
Returns:

The tinted canvas

Type
HTMLCanvasElement

<static> roundColor(color)

Rounds the specified color according to the CanvasTinter.cacheStepsPerColorChannel.

Parameters:
Name Type Description
color number

the color to round, should be a hex color

Source:

<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:

<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:

<static> tintWithPerPixel(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: