Vixen
dd8b0a81
csharp
public readonly record struct GradientStops

Where a gradient's three stops sit along its ramp, as fractions.

Read the guide page for this →

Remarks

⚠ Positions, not colours, and that is a whole capability rather than a refinement. The shader's parameter runs zero to one across the box, so from-10% to-40% cannot be honoured by moving a colour: the ramp has to be remapped before the interpolation, and everything outside [From, To] is the flat end colour. Painting the stops at the ends instead puts the transition in the wrong place over the whole box.

⚠ The all-zero value means Default, and that is the same argument GradientAxis makes for its own zero. Three stops all at zero put every pixel at or past the last one, which is a flat fill of the end colour — not a gradient anybody can mean, so the value is free to carry "nobody said". That is what lets default(BoxStyle) and a hand-written Vertical describe the natural 0 / 50% / 100% ramp without either of them having to spell it.

Fields and properties (4)

  • public float From

    The first stop. Zero at the near end.

  • public float Via

    The middle stop, read only when there is one.

  • public float To

    The last stop. One at the far end.

  • public static GradientStops Default

    The natural ramp: the ends, and the middle halfway between them.

Methods (2)

  • public GradientStops(float From, float Via, float To)

    Where a gradient's three stops sit along its ramp, as fractions.

  • public GradientStops OrNatural()

    This ramp, with the all-zero value read as Default.

Used by (10)

  • BackgroundGradientVixen.Ui
  • BoxStyleVixen.Ui
  • GradientReaderVixen.Ui
  • GradientTestsVixen.Ui.Tests
  • UiCompositingTestsVixen.Graphics.Golden.Tests
  • UiMaskVixen.Ui
  • UiRendererVixen.Ui.Renderer
  • UiShapeVixen.Ui
  • UiShapeLayoutTestsVixen.Ui.Tests
  • EditorUiCompositingDeviceTestsVixen.Editor.App.Tests