UNPKG

1.52 kBJavaScriptView Raw
1import { MASK_TYPES } from '@pixi/constants';
2import { Filter } from '../filters/Filter.mjs';
3
4class MaskData {
5 constructor(maskObject = null) {
6 this.type = MASK_TYPES.NONE;
7 this.autoDetect = true;
8 this.maskObject = maskObject || null;
9 this.pooled = false;
10 this.isMaskData = true;
11 this.resolution = null;
12 this.multisample = Filter.defaultMultisample;
13 this.enabled = true;
14 this.colorMask = 15;
15 this._filters = null;
16 this._stencilCounter = 0;
17 this._scissorCounter = 0;
18 this._scissorRect = null;
19 this._scissorRectLocal = null;
20 this._colorMask = 15;
21 this._target = null;
22 }
23 get filter() {
24 return this._filters ? this._filters[0] : null;
25 }
26 set filter(value) {
27 if (value) {
28 if (this._filters) {
29 this._filters[0] = value;
30 } else {
31 this._filters = [value];
32 }
33 } else {
34 this._filters = null;
35 }
36 }
37 reset() {
38 if (this.pooled) {
39 this.maskObject = null;
40 this.type = MASK_TYPES.NONE;
41 this.autoDetect = true;
42 }
43 this._target = null;
44 this._scissorRectLocal = null;
45 }
46 copyCountersOrReset(maskAbove) {
47 if (maskAbove) {
48 this._stencilCounter = maskAbove._stencilCounter;
49 this._scissorCounter = maskAbove._scissorCounter;
50 this._scissorRect = maskAbove._scissorRect;
51 } else {
52 this._stencilCounter = 0;
53 this._scissorCounter = 0;
54 this._scissorRect = null;
55 }
56 }
57}
58
59export { MaskData };
60//# sourceMappingURL=MaskData.mjs.map