Vixen
02b45cc4
csharp
public readonly struct DrawContext

What an element is given to draw itself with.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The escape hatch out of the declarative side. A stylesheet describes boxes, and most of an interface is boxes; a chart, a sparkline, a knob and a hand-drawn icon are not, and there is no font-family for those. OnDraw is where a control draws whatever it is, and this is the surface it draws on.

Everything is in document space, the same as the rest of the draw list. Bounds is where the element ended up, so a control that wants to draw inside itself starts from there rather than from an origin it has to be handed.

A struct passed by value, not a class handed out per element per frame. It is three references' worth of state and it exists for the length of one virtual call.

Fields and properties (4)

  • public UiElement Element

    The element being drawn.

  • public DrawList List

    The list being filled, for anything this does not wrap.

  • public Rectangle Bounds

    Where the element is, in document space.

  • public Color4 Foreground

    The element's color, which is what a control draws itself in by default.

Methods (8)

Used by (35)

  • CodeEditorVixen.Ui.Controls.Advanced
  • CodeOverlayVixen.Ui.Controls.Advanced
  • ColorFieldVixen.Ui.Controls.Advanced
  • ColorStripVixen.Ui.Controls.Advanced
  • ColorSwatchVixen.Ui.Controls.Advanced
  • CurveEditorVixen.Ui.Controls.Advanced
  • DrawListBuilderVixen.Ui
  • GradientBarVixen.Ui.Controls.Advanced
  • GradientRailVixen.Ui.Controls.Advanced
  • IconVixen.Ui.Controls
  • ImageVixen.Ui.Controls
  • NodeCanvasVixen.Ui.Controls.Advanced
  • NodeMinimapVixen.Ui.Controls.Advanced
  • NodeWireLayerVixen.Ui.Controls.Advanced
  • PathTestsVixen.Ui.Tests
  • ProgressBarVixen.Ui.Controls
  • RangeBaseVixen.Ui.Controls
  • RangeSliderVixen.Ui.Controls
  • ScrollBarVixen.Ui.Controls
  • SliderVixen.Ui.Controls
  • SpinnerVixen.Ui.Controls
  • TextFieldVixen.Ui.Controls
  • TimelineLanesVixen.Ui.Controls.Advanced
  • TimelineRulerVixen.Ui.Controls.Advanced
  • TreeRowVixen.Ui.Controls.Advanced
  • TriangleVixen.Ui.Tests
  • UiElementVixen.Ui
  • ViewportVixen.Ui.Controls.Advanced
  • ViewportGizmoVixen.Ui.Controls.Advanced
  • FontAtlasViewVixen.Editor.AssetEditors
  • MarqueeOverlayVixen.Editor.SceneView
  • NodeGraphViewVixen.Editor.NodeGraph
  • NodePreviewLayerVixen.Editor.NodeGraph
  • StateMapViewVixen.Editor.AssetEditors
  • VfxPreviewViewVixen.Editor.AssetEditors