UNPKG

1.7 kBJavaScriptView Raw
1"use strict";
2var constants = require("@pixi/constants"), Filter = require("../filters/Filter.js");
3class MaskData {
4 /**
5 * Create MaskData
6 * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask
7 */
8 constructor(maskObject = null) {
9 this.type = constants.MASK_TYPES.NONE, this.autoDetect = !0, this.maskObject = maskObject || null, this.pooled = !1, this.isMaskData = !0, this.resolution = null, this.multisample = Filter.Filter.defaultMultisample, this.enabled = !0, this.colorMask = 15, this._filters = null, this._stencilCounter = 0, this._scissorCounter = 0, this._scissorRect = null, this._scissorRectLocal = null, this._colorMask = 15, this._target = null;
10 }
11 /**
12 * The sprite mask filter.
13 * If set to `null`, the default sprite mask filter is used.
14 * @default null
15 */
16 get filter() {
17 return this._filters ? this._filters[0] : null;
18 }
19 set filter(value) {
20 value ? this._filters ? this._filters[0] = value : this._filters = [value] : this._filters = null;
21 }
22 /** Resets the mask data after popMask(). */
23 reset() {
24 this.pooled && (this.maskObject = null, this.type = constants.MASK_TYPES.NONE, this.autoDetect = !0), this._target = null, this._scissorRectLocal = null;
25 }
26 /**
27 * Copies counters from maskData above, called from pushMask().
28 * @param maskAbove
29 */
30 copyCountersOrReset(maskAbove) {
31 maskAbove ? (this._stencilCounter = maskAbove._stencilCounter, this._scissorCounter = maskAbove._scissorCounter, this._scissorRect = maskAbove._scissorRect) : (this._stencilCounter = 0, this._scissorCounter = 0, this._scissorRect = null);
32 }
33}
34exports.MaskData = MaskData;
35//# sourceMappingURL=MaskData.js.map