1 | import Color from '../style-spec/util/color';
|
2 |
|
3 | import type {BlendFuncType, ColorMaskType} from './types';
|
4 |
|
5 | const ZERO = 0x0000;
|
6 | const ONE = 0x0001;
|
7 | const ONE_MINUS_SRC_ALPHA = 0x0303;
|
8 |
|
9 | class ColorMode {
|
10 | blendFunction: BlendFuncType;
|
11 | blendColor: Color;
|
12 | mask: ColorMaskType;
|
13 |
|
14 | constructor(blendFunction: BlendFuncType, blendColor: Color, mask: ColorMaskType) {
|
15 | this.blendFunction = blendFunction;
|
16 | this.blendColor = blendColor;
|
17 | this.mask = mask;
|
18 | }
|
19 |
|
20 | static Replace: BlendFuncType;
|
21 |
|
22 | static disabled: Readonly<ColorMode>;
|
23 | static unblended: Readonly<ColorMode>;
|
24 | static alphaBlended: Readonly<ColorMode>;
|
25 | }
|
26 |
|
27 | ColorMode.Replace = [ONE, ZERO];
|
28 |
|
29 | ColorMode.disabled = new ColorMode(ColorMode.Replace, Color.transparent, [false, false, false, false]);
|
30 | ColorMode.unblended = new ColorMode(ColorMode.Replace, Color.transparent, [true, true, true, true]);
|
31 | ColorMode.alphaBlended = new ColorMode([ONE, ONE_MINUS_SRC_ALPHA], Color.transparent, [true, true, true, true]);
|
32 |
|
33 | export default ColorMode;
|