Class UIRenderContext

Namespace
Forma
Assembly
Forma.dll

SpriteBatch-backed drawing surface used by controls. Applications can subclass controls to draw custom content.

public sealed class UIRenderContext : IDisposable
Inheritance
UIRenderContext
Implements
Inherited Members

Properties

CompositorDiagnostics

Deduplicated runtime composition-limit reports retained for this device context.

public IReadOnlyList<string> CompositorDiagnostics { get; }

Property Value

IReadOnlyList<string>

Drawing

Backend-neutral vector drawing operations for foundational visuals.

public DrawingContext Drawing { get; }

Property Value

DrawingContext

GraphicsDevice

public GraphicsDevice GraphicsDevice { get; }

Property Value

GraphicsDevice

SpriteBatch

public SpriteBatch SpriteBatch { get; }

Property Value

SpriteBatch

Theme

public Theme Theme { get; }

Property Value

Theme

Methods

Begin()

public void Begin()

Border(Rectangle, Color, int)

public void Border(Rectangle rectangle, Color color, int width = 1)

Parameters

rectangle Rectangle
color Color
width int

Dispose()

public void Dispose()

DrawScalableImage(ScalableImageSource, Rectangle, Color, ImageSamplingMode)

Draws a scalable image through the exact-size device cache.

public bool DrawScalableImage(ScalableImageSource source, Rectangle destination, Color color, ImageSamplingMode samplingMode = ImageSamplingMode.Linear)

Parameters

source ScalableImageSource
destination Rectangle
color Color
samplingMode ImageSamplingMode

Returns

bool

End()

public void End()

Fill(Rectangle, Color)

public void Fill(Rectangle rectangle, Color color)

Parameters

rectangle Rectangle
color Color

FillRounded(Rectangle, Color, int)

Fills a deterministic pixel-rounded rectangle without requiring an external texture asset.

public void FillRounded(Rectangle rectangle, Color color, int radius)

Parameters

rectangle Rectangle
color Color
radius int

Icon(ThemeIcon, Rectangle, Color)

Draws a theme-owned atlas region into a pixel-rounded logical rectangle.

public void Icon(ThemeIcon icon, Rectangle destination, Color color)

Parameters

icon ThemeIcon
destination Rectangle
color Color

Icon(ThemeIcon, Vector2, Color)

Draws a theme-owned atlas region at its stable logical size.

public void Icon(ThemeIcon icon, Vector2 position, Color color)

Parameters

icon ThemeIcon
position Vector2
color Color

PopClip()

Restores the parent clip previously installed with PushClip(Rectangle).

public void PopClip()

PushClip(Rectangle)

Clips subsequent drawing to the intersection of this rectangle and all active parent clips.

public void PushClip(Rectangle rectangle)

Parameters

rectangle Rectangle

Text(TextLayout, Vector2, Color)

Draws an immutable layout without repeating measurement or line breaking.

public void Text(TextLayout layout, Vector2 position, Color color)

Parameters

layout TextLayout
position Vector2
color Color

Text(UIFont, string, Vector2, Color)

public void Text(UIFont font, string text, Vector2 position, Color color)

Parameters

font UIFont
text string
position Vector2
color Color

Text(SpriteFont, string, Vector2, Color)

public void Text(SpriteFont font, string text, Vector2 position, Color color)

Parameters

font SpriteFont
text string
position Vector2
color Color

Text(SpriteFont, string, Vector2, Color, float)

Draws SpriteFont text at a deterministic uniform scale for controls with a font-size override.

public void Text(SpriteFont font, string text, Vector2 position, Color color, float scale)

Parameters

font SpriteFont
text string
position Vector2
color Color
scale float

TexturedFan(Texture2D, Vector2, Vector2, IReadOnlyList<Vector2>, IReadOnlyList<Vector2>, Color)

Draws a texture-clipped triangle fan while preserving the active UI clip and batch state.

public void TexturedFan(Texture2D texture, Vector2 center, Vector2 centerUv, IReadOnlyList<Vector2> boundary, IReadOnlyList<Vector2> uvs, Color color)

Parameters

texture Texture2D
center Vector2
centerUv Vector2
boundary IReadOnlyList<Vector2>
uvs IReadOnlyList<Vector2>
color Color