Vixen
dd8b0a81
csharp
public readonly record struct UiLayer

A subtree drawn into a surface of its own, and composited back once.

Read the guide page for this →

Remarks

⚠ The offscreen surface is the size of the whole viewport, not of , and that is the decision that keeps the two renderers honest. A surface the size of the group would need every vertex inside it translated by the group's origin, on both paths, in the same direction, with the same rounding — and a disagreement there is a subtree drawn a pixel off, which no unit test would be looking at and which the goldens would report as a diff somewhere else entirely. At viewport size there is no translation to get wrong: a layer's contents are drawn at exactly the coordinates they would have had, and the composite samples the texel under each pixel. What it costs is memory, on a frame that has a translucent group at all.

⚠ is the ink, not the element's box. Opacity does not clip — CSS Compositing 1 § 3 isolates a group, it does not bound it — so a child overflowing its half-opaque parent must still be composited. The bounds are therefore computed from the vertices the group actually emitted, which is the only description of "everything it drew" available at this stage, and are what the composite quad covers. Sizing it to the element's rectangle instead would cut off exactly the overflow that overflow: visible promises to keep.

Fields and properties (22)

  • public int First

    The index of its first UiDraw.

  • public int Count

    How many draws it covers. Its composite draw is the one after them.

  • public Rectangle Bounds

    The part of the surface it actually inks, in document pixels, already rounded out to whole ones, already widened by Blur where there is one, and already narrowed by the clip that was in force where it opened.

  • public float Alpha

    What the composite is faded by.

  • public ulong Image

    The number the composite draw names its surface by.

  • public float Blur

    The standard deviation of the Gaussian its surface is blurred by, in document pixels.

  • public UiBlendMode Blend

    How its composite is mixed with the picture already under it.

  • public UiColorMatrix? Filter

    The colour transform its surface is put through, or null where there is none.

  • public int MaskFirst

    Where this group's mask list starts in Masks.

  • public int MaskCount

    How many entries of Masks this group is masked by.

  • public UiDropShadow? Shadow

    The shadow this group's filter: drop-shadow() casts, or null where there is none.

  • public ulong ShadowImage

    The number the shadow's surface is named by. Meaningless when Shadow is null.

  • public UiBackdrop? Backdrop

    What this group's backdrop-filter does to the picture behind it, or null.

  • public ulong BackdropImage

    The number the backdrop's surface is named by. Meaningless when Backdrop is null.

  • public Rectangle BackdropBounds

    The rectangle the filtered backdrop is drawn in — the group's border box, clipped. Meaningless when Backdrop is null.

  • public Rectangle BackdropBox

    The element's border box before the clip, which is what BackdropRadius rounds. Meaningless when Backdrop is null.

  • public float BackdropRadius

    The uniform corner radius BackdropBox is rounded by, in document pixels. Zero for square corners. Meaningless when Backdrop is null.

  • public UiTransform? Transform

    The affine this group's rotate and scale place its surface under.

  • public int Composite

    Where this group's own composite draw sits in Draws.

  • public int BackdropDraw

    Where this group's backdrop quad sits. Meaningless when Backdrop is null.

  • public int ShadowDraw

    Where this group's shadow quad sits. Meaningless when Shadow is null.

  • public const int MaximumKernel

    The widest kernel either executor will run, in texels each side of the centre.

Methods (2)

  • public UiLayer(int First, int Count, Rectangle Bounds, float Alpha)

    A subtree drawn into a surface of its own, and composited back once.

  • public static int KernelRadius(float blur, float scale)

    How many texels each side of the centre a blur of this width reads.

Used by (15)

  • BackdropFilterTestsVixen.Ui.Controls.Tests
  • FilterBlurTestsVixen.Ui.Controls.Tests
  • FilterColourTestsVixen.Ui.Controls.Tests
  • FilterDropShadowTestsVixen.Ui.Controls.Tests
  • FrameVixen.Ui.Testing
  • GroupOpacityTestsVixen.Ui.Controls.Tests
  • MaskGradientTestsVixen.Ui.Controls.Tests
  • MixBlendModeTestsVixen.Ui.Controls.Tests
  • TransformPaintTestsVixen.Ui.Controls.Tests
  • UiCompositingTestsVixen.Graphics.Golden.Tests
  • UiGeometryVixen.Ui
  • UiGeometryBuilderVixen.Ui
  • UiRavenAgreementTestsVixen.Graphics.Golden.Tests
  • UiRendererVixen.Ui.Renderer
  • UiTransformProjectiveTestsVixen.Ui.Tests