phaser/src/renderer/BlendModes.js

250 lines
6.5 KiB
JavaScript
Raw Normal View History

2018-02-12 16:01:20 +00:00
/**
* @author Richard Davey <rich@photonstorm.com>
2019-01-15 16:20:22 +00:00
* @copyright 2019 Photon Storm Ltd.
2018-02-12 16:01:20 +00:00
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
2018-02-09 13:46:04 +00:00
/**
2018-03-29 15:42:20 +00:00
* Phaser Blend Modes.
*
* @name Phaser.BlendModes
* @enum {integer}
2018-10-10 09:49:13 +00:00
* @memberof Phaser
2018-10-09 12:40:00 +00:00
* @readonly
2018-03-29 15:42:20 +00:00
* @since 3.0.0
2018-02-09 13:46:04 +00:00
*/
module.exports = {
2018-02-09 13:46:04 +00:00
/**
* Skips the Blend Mode check in the renderer.
*
* @name Phaser.BlendModes.SKIP_CHECK
*/
2017-10-17 03:17:04 +00:00
SKIP_CHECK: -1,
2018-02-09 13:46:04 +00:00
/**
2018-11-13 15:10:25 +00:00
* Normal blend mode. For Canvas and WebGL.
* This is the default setting and draws new shapes on top of the existing canvas content.
2018-02-09 13:46:04 +00:00
*
* @name Phaser.BlendModes.NORMAL
*/
NORMAL: 0,
2018-02-09 13:46:04 +00:00
/**
2018-11-13 15:10:25 +00:00
* Add blend mode. For Canvas and WebGL.
* Where both shapes overlap the color is determined by adding color values.
2018-02-09 13:46:04 +00:00
*
* @name Phaser.BlendModes.ADD
*/
ADD: 1,
2018-02-09 13:46:04 +00:00
/**
2018-11-13 15:10:25 +00:00
* Multiply blend mode. For Canvas and WebGL.
* The pixels are of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result.
2018-02-09 13:46:04 +00:00
*
* @name Phaser.BlendModes.MULTIPLY
*/
MULTIPLY: 2,
2018-02-09 13:46:04 +00:00
/**
2018-11-13 15:10:25 +00:00
* Screen blend mode. For Canvas and WebGL.
* The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply)
2018-02-09 13:46:04 +00:00
*
* @name Phaser.BlendModes.SCREEN
*/
SCREEN: 3,
2018-02-09 13:46:04 +00:00
/**
2018-11-13 15:10:25 +00:00
* Overlay blend mode. For Canvas only.
* A combination of multiply and screen. Dark parts on the base layer become darker, and light parts become lighter.
2018-02-09 13:46:04 +00:00
*
* @name Phaser.BlendModes.OVERLAY
*/
OVERLAY: 4,
2018-02-09 13:46:04 +00:00
/**
2018-11-13 15:10:25 +00:00
* Darken blend mode. For Canvas only.
* Retains the darkest pixels of both layers.
2018-02-09 13:46:04 +00:00
*
* @name Phaser.BlendModes.DARKEN
*/
DARKEN: 5,
2018-02-09 13:46:04 +00:00
/**
2018-11-13 15:10:25 +00:00
* Lighten blend mode. For Canvas only.
* Retains the lightest pixels of both layers.
2018-02-09 13:46:04 +00:00
*
* @name Phaser.BlendModes.LIGHTEN
*/
LIGHTEN: 6,
2018-02-09 13:46:04 +00:00
/**
2018-11-13 15:10:25 +00:00
* Color Dodge blend mode. For Canvas only.
* Divides the bottom layer by the inverted top layer.
2018-02-09 13:46:04 +00:00
*
* @name Phaser.BlendModes.COLOR_DODGE
*/
COLOR_DODGE: 7,
2018-02-09 13:46:04 +00:00
/**
2018-11-13 15:10:25 +00:00
* Color Burn blend mode. For Canvas only.
* Divides the inverted bottom layer by the top layer, and then inverts the result.
2018-02-09 13:46:04 +00:00
*
* @name Phaser.BlendModes.COLOR_BURN
*/
COLOR_BURN: 8,
2018-02-09 13:46:04 +00:00
/**
2018-11-13 15:10:25 +00:00
* Hard Light blend mode. For Canvas only.
* A combination of multiply and screen like overlay, but with top and bottom layer swapped.
2018-02-09 13:46:04 +00:00
*
2018-02-22 01:17:54 +00:00
* @name Phaser.BlendModes.HARD_LIGHT
2018-02-09 13:46:04 +00:00
*/
HARD_LIGHT: 9,
2018-02-09 13:46:04 +00:00
/**
2018-11-13 15:10:25 +00:00
* Soft Light blend mode. For Canvas only.
* A softer version of hard-light. Pure black or white does not result in pure black or white.
2018-02-09 13:46:04 +00:00
*
* @name Phaser.BlendModes.SOFT_LIGHT
*/
SOFT_LIGHT: 10,
2018-02-09 13:46:04 +00:00
/**
2018-11-13 15:10:25 +00:00
* Difference blend mode. For Canvas only.
* Subtracts the bottom layer from the top layer or the other way round to always get a positive value.
2018-02-09 13:46:04 +00:00
*
* @name Phaser.BlendModes.DIFFERENCE
*/
DIFFERENCE: 11,
2018-02-09 13:46:04 +00:00
/**
2018-11-13 15:10:25 +00:00
* Exclusion blend mode. For Canvas only.
* Like difference, but with lower contrast.
2018-02-09 13:46:04 +00:00
*
* @name Phaser.BlendModes.EXCLUSION
*/
EXCLUSION: 12,
2018-02-09 13:46:04 +00:00
/**
2018-11-13 15:10:25 +00:00
* Hue blend mode. For Canvas only.
* Preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer.
2018-02-09 13:46:04 +00:00
*
* @name Phaser.BlendModes.HUE
*/
HUE: 13,
2018-02-09 13:46:04 +00:00
/**
2018-11-13 15:10:25 +00:00
* Saturation blend mode. For Canvas only.
* Preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer.
2018-02-09 13:46:04 +00:00
*
* @name Phaser.BlendModes.SATURATION
*/
SATURATION: 14,
2018-02-09 13:46:04 +00:00
/**
2018-11-13 15:10:25 +00:00
* Color blend mode. For Canvas only.
* Preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer.
2018-02-09 13:46:04 +00:00
*
* @name Phaser.BlendModes.COLOR
*/
COLOR: 15,
2018-02-09 13:46:04 +00:00
/**
2018-11-13 15:10:25 +00:00
* Luminosity blend mode. For Canvas only.
* Preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer.
2018-02-09 13:46:04 +00:00
*
* @name Phaser.BlendModes.LUMINOSITY
*/
2018-11-10 04:22:13 +00:00
LUMINOSITY: 16,
/**
2018-11-13 15:10:25 +00:00
* Alpha erase blend mode. For Canvas and WebGL.
2018-11-10 04:22:13 +00:00
*
* @name Phaser.BlendModes.ERASE
*/
2018-11-13 15:10:25 +00:00
ERASE: 17,
/**
* Source-in blend mode. For Canvas only.
* The new shape is drawn only where both the new shape and the destination canvas overlap. Everything else is made transparent.
*
* @name Phaser.BlendModes.SOURCE_IN
*/
SOURCE_IN: 18,
/**
* Source-out blend mode. For Canvas only.
* The new shape is drawn where it doesn't overlap the existing canvas content.
*
* @name Phaser.BlendModes.SOURCE_OUT
*/
SOURCE_OUT: 19,
/**
* Source-out blend mode. For Canvas only.
* The new shape is only drawn where it overlaps the existing canvas content.
*
* @name Phaser.BlendModes.SOURCE_ATOP
*/
SOURCE_ATOP: 20,
/**
* Destination-over blend mode. For Canvas only.
* New shapes are drawn behind the existing canvas content.
*
* @name Phaser.BlendModes.DESTINATION_OVER
*/
DESTINATION_OVER: 21,
/**
* Destination-in blend mode. For Canvas only.
* The existing canvas content is kept where both the new shape and existing canvas content overlap. Everything else is made transparent.
*
* @name Phaser.BlendModes.DESTINATION_IN
*/
DESTINATION_IN: 22,
/**
* Destination-out blend mode. For Canvas only.
* The existing content is kept where it doesn't overlap the new shape.
*
* @name Phaser.BlendModes.DESTINATION_OUT
*/
DESTINATION_OUT: 23,
/**
* Destination-out blend mode. For Canvas only.
* The existing canvas is only kept where it overlaps the new shape. The new shape is drawn behind the canvas content.
*
* @name Phaser.BlendModes.DESTINATION_ATOP
*/
DESTINATION_ATOP: 24,
/**
* Lighten blend mode. For Canvas only.
* Where both shapes overlap the color is determined by adding color values.
*
* @name Phaser.BlendModes.LIGHTER
*/
LIGHTER: 25,
/**
* Copy blend mode. For Canvas only.
* Only the new shape is shown.
*
* @name Phaser.BlendModes.COPY
*/
COPY: 26,
/**
* xor blend mode. For Canvas only.
* Shapes are made transparent where both overlap and drawn normal everywhere else.
*
* @name Phaser.BlendModes.XOR
*/
XOR: 27
};