UNPKG

1.04 kBPlain TextView Raw
1import Color from '../style-spec/util/color';
2
3import type {BlendFuncType, ColorMaskType} from './types';
4
5const ZERO = 0x0000;
6const ONE = 0x0001;
7const ONE_MINUS_SRC_ALPHA = 0x0303;
8
9class 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
27ColorMode.Replace = [ONE, ZERO];
28
29ColorMode.disabled = new ColorMode(ColorMode.Replace, Color.transparent, [false, false, false, false]);
30ColorMode.unblended = new ColorMode(ColorMode.Replace, Color.transparent, [true, true, true, true]);
31ColorMode.alphaBlended = new ColorMode([ONE, ONE_MINUS_SRC_ALPHA], Color.transparent, [true, true, true, true]);
32
33export default ColorMode;