Back to API Reference
Class

PaintLayerModifier

abstract

Shared engine for paint layers (fill, stroke, shadow, glow, inner-shadow). Resolves a TextPaint from the parameter, precomputes gradient/texture mapping per styled range, and stamps coverage quads through CoverageQuadOps. Thin subclasses only pick a coverage mode and parse their geometry params — all paint/mapping logic lives here once.

Remarks

Parameter grammar: paint, then the subclass's layer-geometry tokens (ParseExtra), then the shared projection overrides [,mapping][,shape][,fit][,angle][,scale][,offset][,corners][,miterLimit][,tint][,blend][,spread]. Projection values affect gradient/texture paints; tint multiplies every paint kind. The paint slot is optional-with-rewind: only a genuine paint token (colour literal or known swatch name) is consumed; anything else rewinds to the geometry slots, so <stroke=2px> reads as a width. Each projection value resolves through the override hierarchy, weakest → strongest: swatch → modifier field → default parameters → tag attribute (ApplyProjection).

Derived Types(5)

Types that inherit from PaintLayerModifier.

Nested Types

protected PaintRef PaintField{ get }

The subclass's own [Parameter] paint, used as the default when the markup carries no paint value.

protected float CoverageModeValue{ get }

Coverage mode written to TEXCOORD2.x (see CoverageMode).

protected Color32 DefaultPaintColor{ get }

Solid colour applied when the paint token is omitted entirely. White for the face/fill; dark layers (stroke, shadow) override so a bare tag still renders sensibly without a paint provider. A present-but-unresolved name still falls back to white, not this.

protected bool ClaimsBase{ get }

When true, the first hit on a glyph recolours the suppressed default base quad instead of emitting a duplicate (fill behaviour).

protected virtual void ParseExtra()

Parses layer-specific tokens (after paint/mapping/shape/angle/scale) into coverage params and an optional quad offset. Read scalars with NextUnitFloat / vectors with NextUnitVector2 and set the matching *Px flag from the unit (Absolute = px), so the value resolves to em at emit.

protected override void OnEnable()
protected override void OnDisable()
protected override void OnDestroy()
protected override void ResetOwnRequests()
protected override void BeforeApply()

Clears the range accumulator AND releases the emitter's held gradient ramp rows — the re-run OnApply re-acquires them immediately, so an animated parameter never leaks a row reference per frame (the atlas sweep's grace period protects the currently displayed mesh). The winner buffer is zeroed here too: a granular re-apply replays without the OnEnable-time PrepareAttribute clear, and stale winner indices would point into the freshly reset ranges list.

protected override void OnApply()

Resolves the range's paint and geometry, then stamps the per-codepoint winner-index buffer: overlapping ranges of one modifier resolve innermost-wins ONCE here (an IsInner compare against the current holder), so the per-glyph hook reads a single buffer slot instead of scanning ranges. The buffer indexes at most 255 applied ranges per layer instance; ranges beyond that keep the earlier winner.

protected override void OnGlyphEffect()

O(1) per glyph: the winning range comes from the per-codepoint winner buffer resolved at apply time; no range scan happens here.

protected override void OnFlush()
protected override void OnEmitQuad()