Vixen
dd8b0a81
csharp
public enum MaskComposite

How one entry of a mask list combines with the entries below it.

Read the guide page for this →

Remarks

⚠ The numbering is the wire format and Add is deliberately zero. ui-mask.frag reads this out of the storage buffer as an integer and branches on it, so the values here are not an implementation detail of the enum — they are the contract. GradientShape is the cautionary tale: its zero is None, the shader was written against a zero-based numbering of its own, and every linear mask took the radial branch and drew a plausible round fade. This enum has no None for that reason, and its zero is the operator CSS Masking 1 § 5.4 gives as the initial value — so a default UiMask composites the way an unstated mask-composite does rather than in whichever way the first name happened to sort.

Each operator is Porter-Duff on the coverage alone, with the entry as the source and the already-composed entries below it as the backdrop. There is no colour here to composite — see UiMask's first remark — so the four are four one-line expressions rather than four blend equations.

Fields and properties (4)

  • Add

    source-over: s + b(1 - s). CSS's initial value.

  • Subtract

    source-out: s(1 - b) — the entry, with everything below it punched out.

  • Intersect

    source-in: s·b — what Tailwind's edge ramps combine with.

  • Exclude

    xor: s(1 - b) + b(1 - s).

Used by (4)

  • DrawListBuilderVixen.Ui
  • MaskGradientTestsVixen.Ui.Controls.Tests
  • UiCompositingTestsVixen.Graphics.Golden.Tests
  • UiMaskVixen.Ui