Class: CanvasTinter

Tiny. CanvasTinter

Utility methods for Sprite/Texture tinting.

Members

staticTiny.CanvasTinter.cacheStepsPerColorChannelnumber

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

staticTiny.CanvasTinter.canUseMultiplyboolean

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

staticTiny.CanvasTinter.convertTintToImageboolean

Tint cache boolean flag.

staticTiny.CanvasTinter.tintMethodtintMethodFunctionType

The tinting method that will be used.

Methods

staticTiny.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 Tiny.Sprite

the sprite to tint

color number

the color to use to tint the sprite with

Returns:
Type Description
HTMLCanvasElement The tinted canvas

staticTiny.CanvasTinter.roundColor(color){number}

Rounds the specified color according to the CanvasTinter.cacheStepsPerColorChannel.

Name Type Description
color number

the color to round, should be a hex color

Returns:
Type Description
number The rounded color.

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

Tint a texture using the 'multiply' operation.

Name Type Description
texture Tiny.Texture

the texture to tint

color number

the color to use to tint the sprite with

canvas HTMLCanvasElement

the current canvas

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

Tint a texture using the 'overlay' operation.

Name Type Description
texture Tiny.Texture

the texture to tint

color number

the color to use to tint the sprite with

canvas HTMLCanvasElement

the current canvas

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

Tint a texture pixel per pixel.

Name Type Description
texture Tiny.Texture

the texture to tint

color number

the color to use to tint the sprite with

canvas HTMLCanvasElement

the current canvas

Type Definitions

Tiny.CanvasTinter.tintMethodFunctionType(texture, color, canvas)

The tintMethod type.

Name Type Description
texture Tiny.Texture

the texture to tint

color number

the color to use to tint the sprite with

canvas HTMLCanvasElement

the current canvas

Documentation generated by JSDoc 3.4.3 on Mon Dec 03 2018 17:48:51 GMT+0800 (CST)