UNPKG

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