pixi-reels

DrawableMaskStrategy

pixi-reels


pixi-reels / index / DrawableMaskStrategy

Interface: DrawableMaskStrategy

Defined in: core/maskStrategies.ts:19

A MaskStrategy that can draw into a Graphics somebody else owns.

build/update each assume the strategy owns its Graphics, which makes two strategies impossible to combine: you get two objects and a viewport that accepts one. Splitting the drawing out fixes that, and every built-in strategy implements it, so composeMasks and inset can wrap any of them without reaching into private state.

A strategy that only implements build/update still works everywhere a MaskStrategy is accepted; composeMasks falls back to nesting its Graphics as a child, which unions correctly but costs an extra node.

Extends#

Properties#

PropertyModifierTypeDescriptionInherited fromDefined in
versionreadonly2Must equal MASK_STRATEGY_VERSION. Validated by ReelSetBuilder.maskStrategy().MaskStrategy.versioncore/ReelViewport.ts:101

Methods#

build()#

build(ctx: MaskContext): Graphics;

Defined in: core/ReelViewport.ts:103

Build (or rebuild) the mask graphic. Returns the Graphics to use as the mask.

Parameters#

ParameterType
ctxMaskContext

Returns#

Graphics

Inherited from#

MaskStrategy.build


draw()#

draw(g: Graphics, ctx: MaskContext): void;

Defined in: core/maskStrategies.ts:21

Draw this strategy’s shapes into g. Must not call g.clear().

Parameters#

ParameterType
gGraphics
ctxMaskContext

Returns#

void


update()#

update(graphics: Graphics, ctx: MaskContext): void;

Defined in: core/ReelViewport.ts:105

Update the mask when reel boxes resize (e.g. MultiWays reshape).

Parameters#

ParameterType
graphicsGraphics
ctxMaskContext

Returns#

void

Inherited from#

MaskStrategy.update