public readonly struct DrawContextWhat 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)
Methods (8)
public void Fill(PathBuilder path, Color4 color, PathFillRule rule = NonZero)Fills a path.
public void FillField(PathBuilder path, Vector2 origin, Color4 color, PathFillRule rule = NonZero)Fills a small path as a cached distance field, rather than tessellating it.
public void Stroke(PathBuilder path, Color4 color, float thickness, LineJoin join = Miter, LineCap cap = Butt, float miterLimit = 0, Vector2 origin = default(Vector2))Strokes a path.
public void FillRectangle(Rectangle rectangle, Color4 color, float radius = 0)Fills a rectangle, with optional rounded corners.
public void DrawImage(Rectangle rectangle, ulong image, Color4 tint = default(Color4), Rectangle source = default(Rectangle))Draws a texture over a rectangle.
public void DrawNineSlice(Rectangle rectangle, ulong image, NineSlice border, NineSlice sourceBorder, Color4 tint = default(Color4), Rectangle source = default(Rectangle), bool hollowCentre = false)Draws a texture over a rectangle with its borders held at their own size.
public void FillRectangle(Rectangle rectangle, Color4 color, BoxStyle style)Fills a rectangle with per-corner radii, a gradient, or both.
public void StrokeRectangle(Rectangle rectangle, Color4 color, float thickness, BoxStyle style = default(BoxStyle))Draws a border inside a rectangle's edges, with per-corner radii.
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