1 | import { MASK_TYPES } from '@pixi/constants';
|
2 | import type { MSAA_QUALITY } from '@pixi/constants';
|
3 | import type { Matrix, Rectangle } from '@pixi/math';
|
4 | import type { IFilterTarget } from '../filters/IFilterTarget';
|
5 | import type { ISpriteMaskFilter } from '../filters/spriteMask/SpriteMaskFilter';
|
6 | import type { Renderer } from '../Renderer';
|
7 | export interface IMaskTarget extends IFilterTarget {
|
8 | renderable: boolean;
|
9 | isSprite?: boolean;
|
10 | worldTransform: Matrix;
|
11 | isFastRect?(): boolean;
|
12 | getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle;
|
13 | render(renderer: Renderer): void;
|
14 | }
|
15 | /**
|
16 | * Component for masked elements.
|
17 | *
|
18 | * Holds mask mode and temporary data about current mask.
|
19 | * @memberof PIXI
|
20 | */
|
21 | export declare class MaskData {
|
22 | /** Mask type */
|
23 | type: MASK_TYPES;
|
24 | /**
|
25 | * Whether we know the mask type beforehand
|
26 | * @default true
|
27 | */
|
28 | autoDetect: boolean;
|
29 | /**
|
30 | * Which element we use to mask
|
31 | * @member {PIXI.DisplayObject}
|
32 | */
|
33 | maskObject: IMaskTarget;
|
34 | /** Whether it belongs to MaskSystem pool */
|
35 | pooled: boolean;
|
36 | /** Indicator of the type (always true for {@link PIXI.MaskData} objects) */
|
37 | isMaskData: boolean;
|
38 | /**
|
39 | * Resolution of the sprite mask filter.
|
40 | * If set to `null` or `0`, the resolution of the current render target is used.
|
41 | * @default null
|
42 | */
|
43 | resolution: number | null;
|
44 | /**
|
45 | * Number of samples of the sprite mask filter.
|
46 | * If set to `null`, the sample count of the current render target is used.
|
47 | * @default PIXI.Filter.defaultMultisample
|
48 | */
|
49 | multisample: MSAA_QUALITY | null;
|
50 | /** If enabled is true the mask is applied, if false it will not. */
|
51 | enabled: boolean;
|
52 | /**
|
53 | * Color mask.
|
54 | * @see PIXI.COLOR_MASK_BITS
|
55 | */
|
56 | colorMask: number;
|
57 | /**
|
58 | * The sprite mask filter wrapped in an array.
|
59 | * @private
|
60 | */
|
61 | _filters: ISpriteMaskFilter[];
|
62 | /**
|
63 | * Stencil counter above the mask in stack
|
64 | * @private
|
65 | */
|
66 | _stencilCounter: number;
|
67 | /**
|
68 | * Scissor counter above the mask in stack
|
69 | * @private
|
70 | */
|
71 | _scissorCounter: number;
|
72 | /**
|
73 | * Scissor operation above the mask in stack.
|
74 | * Null if _scissorCounter is zero, rectangle instance if positive.
|
75 | * @private
|
76 | */
|
77 | _scissorRect: Rectangle;
|
78 | /**
|
79 | * pre-computed scissor rect
|
80 | * does become _scissorRect when mask is actually pushed
|
81 | * @private
|
82 | */
|
83 | _scissorRectLocal: Rectangle;
|
84 | /**
|
85 | * pre-computed color mask
|
86 | * @private
|
87 | */
|
88 | _colorMask: number;
|
89 | /**
|
90 | * Targeted element. Temporary variable set by MaskSystem
|
91 | * @member {PIXI.DisplayObject}
|
92 | * @private
|
93 | */
|
94 | _target: IMaskTarget;
|
95 | /**
|
96 | * Create MaskData
|
97 | * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask
|
98 | */
|
99 | constructor(maskObject?: IMaskTarget);
|
100 | /**
|
101 | * The sprite mask filter.
|
102 | * If set to `null`, the default sprite mask filter is used.
|
103 | * @default null
|
104 | */
|
105 | get filter(): ISpriteMaskFilter;
|
106 | set filter(value: ISpriteMaskFilter);
|
107 | /** Resets the mask data after popMask(). */
|
108 | reset(): void;
|
109 | /**
|
110 | * Copies counters from maskData above, called from pushMask().
|
111 | * @param maskAbove
|
112 | */
|
113 | copyCountersOrReset(maskAbove?: MaskData): void;
|
114 | }
|