Skip to content

Drawer

interludesoftware.tick

Interlude.Tick

Drawer Class

public class Drawer : Interlude.Tick.IDrawer, System.IDisposable

Inheritance System.Object → Drawer

Implements IDrawer, System.IDisposable

Constructors

Drawer(IGUIResourceProvider) Constructor

Initialises the drawer, creating all materials and batchers from the provided resource provider.

public Drawer(Interlude.Tick.IGUIResourceProvider resourceProvider);

Parameters

resourceProvider IGUIResourceProvider

Methods

Drawer.Dispose() Method

Releases all native and managed resources owned by this drawer.

public void Dispose();

Implements Dispose()

Drawer.DrawCommands(List\<DrawCommand>) Method

Appends a pre-built list of draw commands to the current frame's command queue.

public void DrawCommands(System.Collections.Generic.List<Interlude.Tick.DrawCommand> commands);

Parameters

commands System.Collections.Generic.List<DrawCommand>

Implements DrawCommands(List<DrawCommand>)

Drawer.DrawCustomShape(Rect, string, Gradient, Vector4, Vector4, float, Matrix4x4) Method

Queues a custom SDF shape draw command using a caller-supplied shader identified by shaderName.

public Interlude.Tick.DrawCommand DrawCustomShape(Rect rect, string shaderName, Interlude.Tick.Gradient gradient, Vector4 params0, Vector4 params1, float rotationDeg, Matrix4x4 transform);

Parameters

rect UnityEngine.Rect

shaderName System.String

gradient Gradient

params0 UnityEngine.Vector4

params1 UnityEngine.Vector4

rotationDeg System.Single

transform UnityEngine.Matrix4x4

Implements DrawCustomShape(Rect, string, Gradient, Vector4, Vector4, float, Matrix4x4)

Returns

DrawCommand

Drawer.DrawFrosted(Rect, float, CornerRadius, Color, Matrix4x4) Method

Queues a frosted-glass (blur + tint) draw command over the given rect.

public Interlude.Tick.DrawCommand DrawFrosted(Rect rect, float blur, Interlude.Tick.CornerRadius radius, Color tint, Matrix4x4 transform);

Parameters

rect UnityEngine.Rect

blur System.Single

radius CornerRadius

tint UnityEngine.Color

transform UnityEngine.Matrix4x4

Implements DrawFrosted(Rect, float, CornerRadius, Color, Matrix4x4)

Returns

DrawCommand

Drawer.DrawLinePixel(Vector2, Vector2, Color, Color) Method

Queues a one-pixel-wide line draw command from start to end with per-endpoint colors.

public Interlude.Tick.DrawCommand DrawLinePixel(Vector2 start, Vector2 end, Color colorStart, Color colorEnd);

Parameters

start UnityEngine.Vector2

end UnityEngine.Vector2

colorStart UnityEngine.Color

colorEnd UnityEngine.Color

Implements DrawLinePixel(Vector2, Vector2, Color, Color)

Returns

DrawCommand

Drawer.DrawLinesPixel(ReadOnlySpan\<Vector2>, Color) Method

Queues a one-pixel-wide polyline draw command connecting all points in points with a uniform color.

public Interlude.Tick.DrawCommand DrawLinesPixel(System.ReadOnlySpan<Vector2> points, Color color);

Parameters

points System.ReadOnlySpan<UnityEngine.Vector2>

color UnityEngine.Color

Implements DrawLinesPixel(ReadOnlySpan<Vector2>, Color)

Returns

DrawCommand

Drawer.DrawPolygon(Vector2, Vector2, List\<Vector2>, List\<Color>, Matrix4x4) Method

Queues a filled polygon draw command, triangulating points with per-vertex colors.

public Interlude.Tick.DrawCommand DrawPolygon(Vector2 offset, Vector2 scale, System.Collections.Generic.List<Vector2> points, System.Collections.Generic.List<Color> colors, Matrix4x4 transform=default(Matrix4x4));

Parameters

offset UnityEngine.Vector2

scale UnityEngine.Vector2

points System.Collections.Generic.List<UnityEngine.Vector2>

colors System.Collections.Generic.List<UnityEngine.Color>

transform UnityEngine.Matrix4x4

Implements DrawPolygon(Vector2, Vector2, List<Vector2>, List<Color>, Matrix4x4)

Returns

DrawCommand

Drawer.DrawRectangle(Rect, Color, Color, CornerRadius, Matrix4x4) Method

Queues a vertical two-color gradient rounded rectangle draw command.

public Interlude.Tick.DrawCommand DrawRectangle(Rect rect, Color top, Color bottom, Interlude.Tick.CornerRadius radius, Matrix4x4 transform);

Parameters

rect UnityEngine.Rect

top UnityEngine.Color

bottom UnityEngine.Color

radius CornerRadius

transform UnityEngine.Matrix4x4

Implements DrawRectangle(Rect, Color, Color, CornerRadius, Matrix4x4)

Returns

DrawCommand

Drawer.DrawRectangle(Rect, Color, CornerRadius, Matrix4x4) Method

Queues a solid-color rounded rectangle draw command.

public Interlude.Tick.DrawCommand DrawRectangle(Rect rect, Color top, Interlude.Tick.CornerRadius radius, Matrix4x4 transform);

Parameters

rect UnityEngine.Rect

top UnityEngine.Color

radius CornerRadius

transform UnityEngine.Matrix4x4

Implements DrawRectangle(Rect, Color, CornerRadius, Matrix4x4)

Returns

DrawCommand

Drawer.DrawRectangle(Rect, Color, Matrix4x4) Method

Queues a solid-color rectangle draw command.

public Interlude.Tick.DrawCommand DrawRectangle(Rect rect, Color top, Matrix4x4 transform);

Parameters

rect UnityEngine.Rect

top UnityEngine.Color

transform UnityEngine.Matrix4x4

Implements DrawRectangle(Rect, Color, Matrix4x4)

Returns

DrawCommand

Drawer.DrawRectangle(Rect, Gradient, CornerRadius, Matrix4x4) Method

Queues a gradient rounded rectangle draw command.

public Interlude.Tick.DrawCommand DrawRectangle(Rect rect, Interlude.Tick.Gradient gradient, Interlude.Tick.CornerRadius radius=default(Interlude.Tick.CornerRadius), Matrix4x4 transform=default(Matrix4x4));

Parameters

rect UnityEngine.Rect

gradient Gradient

radius CornerRadius

transform UnityEngine.Matrix4x4

Implements DrawRectangle(Rect, Gradient, CornerRadius, Matrix4x4)

Returns

DrawCommand

Drawer.DrawSegment(Vector2, Vector2, float, Color, Color, Cap, Matrix4x4) Method

Queues a thick line segment draw command with per-endpoint colors and configurable end caps.

public Interlude.Tick.DrawCommand DrawSegment(Vector2 a, Vector2 b, float thickness, Color colorStart, Color colorEnd, Interlude.Tick.DrawCommand.Cap cap, Matrix4x4 transform);

Parameters

a UnityEngine.Vector2

b UnityEngine.Vector2

thickness System.Single

colorStart UnityEngine.Color

colorEnd UnityEngine.Color

cap Interlude.Tick.DrawCommand.Cap

transform UnityEngine.Matrix4x4

Implements DrawSegment(Vector2, Vector2, float, Color, Color, Cap, Matrix4x4)

Returns

DrawCommand

Drawer.DrawShadow(Rect, Vector2, float, float, CornerRadius, Color, Matrix4x4) Method

Queues a drop shadow draw command for the given rect with configurable offset, blur, spread, and corner radius.

public Interlude.Tick.DrawCommand DrawShadow(Rect rect, Vector2 offset, float blur, float spread, Interlude.Tick.CornerRadius radius, Color color, Matrix4x4 transform);

Parameters

rect UnityEngine.Rect

offset UnityEngine.Vector2

blur System.Single

spread System.Single

radius CornerRadius

color UnityEngine.Color

transform UnityEngine.Matrix4x4

Implements DrawShadow(Rect, Vector2, float, float, CornerRadius, Color, Matrix4x4)

Returns

DrawCommand

Drawer.DrawShape(Rect, SdfShape, Gradient, Vector4, Vector4, float, Matrix4x4) Method

Queues a built-in SDF shape draw command with gradient fill and per-shape shader parameters.

public Interlude.Tick.DrawCommand DrawShape(Rect rect, Interlude.Tick.SdfShape shapeType, Interlude.Tick.Gradient gradient, Vector4 params0, Vector4 params1, float rotationDeg, Matrix4x4 transform);

Parameters

rect UnityEngine.Rect

shapeType Interlude.Tick.SdfShape

gradient Gradient

params0 UnityEngine.Vector4

params1 UnityEngine.Vector4

rotationDeg System.Single

transform UnityEngine.Matrix4x4

Implements DrawShape(Rect, SdfShape, Gradient, Vector4, Vector4, float, Matrix4x4)

Returns

DrawCommand

Drawer.DrawTarget(RenderTexture, Rect, CornerRadius, Matrix4x4) Method

Queues a draw command that composites a UnityEngine.RenderTexture render target into the current frame.

public Interlude.Tick.DrawCommand DrawTarget(RenderTexture texture, Rect rect, Interlude.Tick.CornerRadius radius=default(Interlude.Tick.CornerRadius), Matrix4x4 transform=default(Matrix4x4));

Parameters

texture UnityEngine.RenderTexture

rect UnityEngine.Rect

radius CornerRadius

transform UnityEngine.Matrix4x4

Implements DrawTarget(RenderTexture, Rect, CornerRadius, Matrix4x4)

Returns

DrawCommand

Drawer.DrawText(string, int, string, TextAlign, Color, Rect, Rect, Wrap, Matrix4x4, TextEffects) Method

Queues a text draw command with a solid fill color.

public Interlude.Tick.DrawCommand DrawText(string fontName, int size, string text, Interlude.Tick.TextAlign align, Color color, Rect layoutRect, Rect screenRect, Interlude.Tick.Wrap wrap, Matrix4x4 transform=default(Matrix4x4), Interlude.Tick.UI.TextEffects effects=default(Interlude.Tick.UI.TextEffects));

Parameters

fontName System.String

size System.Int32

text System.String

align Interlude.Tick.TextAlign

color UnityEngine.Color

layoutRect UnityEngine.Rect

screenRect UnityEngine.Rect

wrap Interlude.Tick.Wrap

transform UnityEngine.Matrix4x4

effects Interlude.Tick.UI.TextEffects

Implements DrawText(string, int, string, TextAlign, Color, Rect, Rect, Wrap, Matrix4x4, TextEffects)

Returns

DrawCommand

Drawer.DrawText(string, int, string, TextAlign, Gradient, Rect, Rect, Wrap, Matrix4x4, TextEffects) Method

Queues a text draw command with a gradient fill; builds or retrieves a cached mesh for the text.

public Interlude.Tick.DrawCommand DrawText(string fontName, int size, string text, Interlude.Tick.TextAlign align, Interlude.Tick.Gradient gradient, Rect layoutRect, Rect screenRect, Interlude.Tick.Wrap wrap, Matrix4x4 transform=default(Matrix4x4), Interlude.Tick.UI.TextEffects effects=default(Interlude.Tick.UI.TextEffects));

Parameters

fontName System.String

size System.Int32

text System.String

align Interlude.Tick.TextAlign

gradient Gradient

layoutRect UnityEngine.Rect

screenRect UnityEngine.Rect

wrap Interlude.Tick.Wrap

transform UnityEngine.Matrix4x4

effects Interlude.Tick.UI.TextEffects

Implements DrawText(string, int, string, TextAlign, Gradient, Rect, Rect, Wrap, Matrix4x4, TextEffects)

Returns

DrawCommand

Drawer.DrawTexture(string, Rect, Color, float, CornerRadius, Matrix4x4) Method

Queues a texture draw command identified by resource name; the texture is resolved from the resource provider at record time.

public Interlude.Tick.DrawCommand DrawTexture(string name, Rect rect, Color tint, float angleDeg, Interlude.Tick.CornerRadius radius=default(Interlude.Tick.CornerRadius), Matrix4x4 transform=default(Matrix4x4));

Parameters

name System.String

rect UnityEngine.Rect

tint UnityEngine.Color

angleDeg System.Single

radius CornerRadius

transform UnityEngine.Matrix4x4

Implements DrawTexture(string, Rect, Color, float, CornerRadius, Matrix4x4)

Returns

DrawCommand

Drawer.DrawTexture(Texture2D, Rect, Color, float, CornerRadius, Matrix4x4) Method

Queues a full-texture draw command with optional tint, rotation, and corner rounding.

public Interlude.Tick.DrawCommand DrawTexture(Texture2D texture, Rect rect, Color tint, float angleDeg=0f, Interlude.Tick.CornerRadius radius=default(Interlude.Tick.CornerRadius), Matrix4x4 transform=default(Matrix4x4));

Parameters

texture UnityEngine.Texture2D

rect UnityEngine.Rect

tint UnityEngine.Color

angleDeg System.Single

radius CornerRadius

transform UnityEngine.Matrix4x4

Implements DrawTexture(Texture2D, Rect, Color, float, CornerRadius, Matrix4x4)

Returns

DrawCommand

Drawer.DrawTexture(Texture2D, Rect, Rect, Color, float, CornerRadius, Matrix4x4) Method

Queues a sub-region texture draw command; sourceUV selects the source region in normalised 0–1 UV space.

public Interlude.Tick.DrawCommand DrawTexture(Texture2D texture, Rect rect, Rect sourceUV, Color tint, float angleDeg=0f, Interlude.Tick.CornerRadius radius=default(Interlude.Tick.CornerRadius), Matrix4x4 transform=default(Matrix4x4));

Parameters

texture UnityEngine.Texture2D

rect UnityEngine.Rect

sourceUV UnityEngine.Rect

tint UnityEngine.Color

angleDeg System.Single

radius CornerRadius

transform UnityEngine.Matrix4x4

Implements DrawTexture(Texture2D, Rect, Rect, Color, float, CornerRadius, Matrix4x4)

Returns

DrawCommand

Drawer.DrawTexture9Slice(Texture, Rect, Vector4, Color, Matrix4x4) Method

Queues a 9-slice texture draw command; borderPx defines the fixed border widths in screen pixels as (left, right, top, bottom).

public Interlude.Tick.DrawCommand DrawTexture9Slice(Texture texture, Rect rect, Vector4 borderPx, Color tint, Matrix4x4 transform);

Parameters

texture UnityEngine.Texture

rect UnityEngine.Rect

borderPx UnityEngine.Vector4

tint UnityEngine.Color

transform UnityEngine.Matrix4x4

Implements DrawTexture9Slice(Texture, Rect, Vector4, Color, Matrix4x4)

Returns

DrawCommand

Drawer.Frame() Method

Performs per-frame housekeeping such as evicting stale cached text meshes.

public void Frame();

Implements Frame()

Drawer.HasFontAtSize(string, int) Method

Returns true if the resource provider has a font registered for fontName at exactly size.

public bool HasFontAtSize(string fontName, int size);

Parameters

fontName System.String

size System.Int32

Implements HasFontAtSize(string, int)

Returns

System.Boolean

Drawer.MeasureTextExact(string, int, string, TextAlign, Rect, Wrap, ReadOnlySpan\<Rect>) Method

Returns the tight bounding rect of the rendered glyphs and populates characterRects with per-character bounds.

public Rect MeasureTextExact(string fontName, int size, string text, Interlude.Tick.TextAlign align, Rect rect, Interlude.Tick.Wrap wrap, ref System.ReadOnlySpan<Rect> characterRects);

Parameters

fontName System.String

size System.Int32

text System.String

align Interlude.Tick.TextAlign

rect UnityEngine.Rect

wrap Interlude.Tick.Wrap

characterRects System.ReadOnlySpan<UnityEngine.Rect>

Implements MeasureTextExact(string, int, string, TextAlign, Rect, Wrap, ReadOnlySpan<Rect>)

Returns

UnityEngine.Rect

Drawer.MeasureTextLines(string, int, string, TextAlign, Rect, Wrap, ReadOnlySpan\<Rect>, int) Method

Returns the line-snapped bounding rect of the rendered text and writes per-character bounds and the line count to the out parameters.

public Rect MeasureTextLines(string fontName, int size, string text, Interlude.Tick.TextAlign align, Rect rect, Interlude.Tick.Wrap wrap, ref System.ReadOnlySpan<Rect> characterRects, ref int lineCount);

Parameters

fontName System.String

size System.Int32

text System.String

align Interlude.Tick.TextAlign

rect UnityEngine.Rect

wrap Interlude.Tick.Wrap

characterRects System.ReadOnlySpan<UnityEngine.Rect>

lineCount System.Int32

Implements MeasureTextLines(string, int, string, TextAlign, Rect, Wrap, ReadOnlySpan<Rect>, int)

Returns

UnityEngine.Rect

Drawer.NewFrame() Method

Drop the previous frame's queued commands and promote any pending debug-capture flag. Called once per live UI frame from the start of BeginFrame(Vector2Int); not called when the editor is paused, so the queue persists across pause repaints and RecordInto(CommandBuffer) can replay last-known-good content without a re-DoUI pass.

public void NewFrame();

Implements NewFrame()

Drawer.RecordInto(CommandBuffer) Method

Sets global shader uniforms and records all queued draw commands into target for GPU execution.

public void RecordInto(CommandBuffer target);

Parameters

target UnityEngine.Rendering.CommandBuffer

Implements RecordInto(CommandBuffer)

Drawer.SetClipRectangle(Nullable\<Rect>) Method

Sets the scissor clip rectangle applied to subsequently queued commands; pass null to disable clipping.

public void SetClipRectangle(System.Nullable<Rect> rect);

Parameters

rect System.Nullable<UnityEngine.Rect>

Implements SetClipRectangle(Nullable<Rect>)

Drawer.SetDrawCommandCache(List\<DrawCommand>) Method

Redirects subsequent draw commands into cache instead of the default command list; pass null to restore normal routing.

public void SetDrawCommandCache(System.Collections.Generic.List<Interlude.Tick.DrawCommand> cache);

Parameters

cache System.Collections.Generic.List<DrawCommand>

Implements SetDrawCommandCache(List<DrawCommand>)

Drawer.SetFrameSize(Vector2Int) Method

Sets the visible UI extent as declared by the integrator via BeginFrame; used for NDC conversion in vertex shaders.

public void SetFrameSize(Vector2Int size);

Parameters

size UnityEngine.Vector2Int

Implements SetFrameSize(Vector2Int)

Drawer.SetLayoutSize(Vector2Int) Method

Sets the reference layout resolution used to map layout-space coordinates to screen pixels.

public void SetLayoutSize(Vector2Int size);

Parameters

size UnityEngine.Vector2Int

Implements SetLayoutSize(Vector2Int)

Drawer.SetRenderTarget(RenderTargetIdentifier, Vector2Int, bool) Method

Sets the render target that RecordInto(CommandBuffer) will write to, along with its pixel dimensions and whether it is an off-screen RT.

public void SetRenderTarget(RenderTargetIdentifier target, Vector2Int size, bool isOffscreen);

Parameters

target UnityEngine.Rendering.RenderTargetIdentifier

size UnityEngine.Vector2Int

isOffscreen System.Boolean

Implements SetRenderTarget(RenderTargetIdentifier, Vector2Int, bool)

Drawer.SetScale(float) Method

Sets the UI scale factor applied when converting layout coordinates to screen pixels.

public void SetScale(float scale);

Parameters

scale System.Single

Implements SetScale(float)

Drawer.TryGetFont(string, int, Font) Method

Attempts to retrieve an exact-sized font from the resource provider.

public bool TryGetFont(string fontName, int size, out Interlude.Tick.Font foundFont);

Parameters

fontName System.String

size System.Int32

foundFont Font

Returns

System.Boolean

Drawer.TryGetFontScaled(string, int, Font) Method

Attempts to retrieve the best available font at the requested size, using the resource provider's scaling logic.

public bool TryGetFontScaled(string fontName, int size, out Interlude.Tick.Font foundFont);

Parameters

fontName System.String

size System.Int32

foundFont Font

Returns

System.Boolean

Drawer.TryGetImage(string, Texture) Method

Attempts to retrieve a named image texture from the resource provider.

public bool TryGetImage(string imageName, out Texture foundImage);

Parameters

imageName System.String

foundImage UnityEngine.Texture

Returns

System.Boolean

Drawer.TryGetSprite(string, Sprite) Method

Attempts to retrieve a named sprite from the resource provider.

public bool TryGetSprite(string spriteName, out Sprite foundSprite);

Parameters

spriteName System.String

foundSprite UnityEngine.Sprite

Returns

System.Boolean