Skip to content

IDrawer

interludesoftware.tick

Interlude.Tick

IDrawer Interface

The drawing back-end that UI queues primitives into during DoUI, then flushes through RecordInto(CommandBuffer) when the render-pipeline integration is ready to issue draw calls.

The package ships a single concrete implementation (Drawer) and the typical user never needs to interact with this interface directly; it is exposed so custom integrations and tests can substitute their own implementation. The shipped integrations (TickURPInjector, TickBIRPInjector, TickRenderTextureInjector) all forward through TickRecorder to the UI's drawer.

Coordinates: every Draw* method except DrawLinePixel(Vector2, Vector2, Color, Color) and DrawLinesPixel(ReadOnlySpan<Vector2>, Color) takes screen-space pixels (the result of UI.LayoutToScreen). The two pixel-named methods are also pixel-space; they exist for primitives that bypass the layout system (e.g. debugger overlays).

public interface IDrawer

Derived
Drawer

Methods

IDrawer.DrawCommands(List\<DrawCommand>) Method

Appends a pre-built list of commands to the drawer's queue. Used when a panel has cached its commands across frames and is replaying them.

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

Parameters

commands System.Collections.Generic.List<DrawCommand>

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

Queues a draw using a custom shader looked up by shaderName from the active IGUIResourceProvider. The shader must include imgui_shape_base.cginc and define a Frag function that reads from the ShapeInstance structured buffer.

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

Returns

DrawCommand

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

Queues a frosted-glass region: the drawer grabs the current target into a temporary RT, blurs it, and composites it tinted by tint within rect. The grab happens at record time, so each frosted call sees everything drawn before it.

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

Returns

DrawCommand

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

Queues a 1-pixel line between start and end (screen pixels). Used for debugger overlays and primitives that bypass the layout system; for normal UI lines prefer DrawSegment(Vector2, Vector2, float, Color, Color, Cap, Matrix4x4).

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

Returns

DrawCommand

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

Queues a pixel-space polyline through points in a single UnityEngine.Color. Same conventions as DrawLinePixel(Vector2, Vector2, Color, Color).

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

Parameters

points System.ReadOnlySpan<UnityEngine.Vector2>

color UnityEngine.Color

Returns

DrawCommand

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

Queues an arbitrary polygon. points are in unit space (the polygon's local frame), then mapped to screen by offset and scale. colors length must match points; each vertex receives the corresponding colour.

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

Returns

DrawCommand

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

Queues a vertically gradient-filled rectangle with optional rounded corners. top shades the top edge, bottom the bottom edge.

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

Parameters

rect UnityEngine.Rect

top UnityEngine.Color

bottom UnityEngine.Color

radius CornerRadius

transform UnityEngine.Matrix4x4

Returns

DrawCommand

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

Queues a solid-colour rectangle with rounded corners. rect is in screen pixels; cornerRadius is in screen pixels per corner.

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

Parameters

rect UnityEngine.Rect

top UnityEngine.Color

cornerRadius CornerRadius

transform UnityEngine.Matrix4x4

Returns

DrawCommand

IDrawer.DrawRectangle(Rect, Color, Matrix4x4) Method

Queues a solid-colour rectangle. rect is in screen pixels.

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

Parameters

rect UnityEngine.Rect

top UnityEngine.Color

transform UnityEngine.Matrix4x4

Returns

DrawCommand

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

Queues a gradient-filled rectangle with optional rounded corners. Supports multi-stop Linear, Radial, and Box gradient types.

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

Returns

DrawCommand

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

Queues a thick line segment from a to b (screen pixels), with the colour gradient interpolated along its length and the chosen end-cap style.

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

Returns

DrawCommand

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

Queues a Gaussian-style drop shadow projected from rect. offset shifts the shadow, blur softens its edge, and spread dilates the shadow shape before blurring. All arguments are in screen pixels.

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

Returns

DrawCommand

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

Queues a solid-colour SDF shape draw. shapeType selects the shape; params0 and params1 carry shape-specific parameters (see Interlude.Tick.SdfShape for conventions). rotationDeg rotates the shape about its centre.

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

Returns

DrawCommand

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

Queues a quad sampling a UnityEngine.RenderTexture. Used by the debugger and by integrations that composite an off-screen UI surface back into a screen-space draw.

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

Returns

DrawCommand

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

Queues a glyph mesh for the given text. layoutRect is in layout space (pre-resolution scaling) and is used as the mesh-cache key; screenRect is the same rect after UI.LayoutToScreen and drives the actual draw position. effects applies outline / shadow / glow at the shader stage; default is UI.TextEffects.None.

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

Returns

DrawCommand

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

Like DrawText(string, int, string, TextAlign, Color, Rect, Rect, Wrap, Matrix4x4, TextEffects) but fills glyphs with a gradient instead of a solid colour.

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

Returns

DrawCommand

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

Queues a textured quad sampling a texture resolved by name through the active IGUIResourceProvider chain. The lookup is deferred to record time, so registering the texture between this call and RecordInto(CommandBuffer) is fine.

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

Returns

DrawCommand

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

Queues a textured quad. rect is in screen pixels; tint multiplies the sampled colour; angleDeg rotates the quad about its centre.

Interlude.Tick.DrawCommand DrawTexture(Texture2D texture, Rect rect, Color tint, float angleDeg, 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

Returns

DrawCommand

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

Same as the simpler DrawTexture(Texture2D, Rect, Color, float, CornerRadius, Matrix4x4) overload, but samples only the sub-region of texture defined by sourceUV (0..1 across the texture).

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

Returns

DrawCommand

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

Queues a 9-slice draw of texture into rect. borderPx defines the slice borders in pixels (left, bottom, right, top).

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

Returns

DrawCommand

IDrawer.Frame() Method

Per-frame housekeeping: prunes the unused-glyph mesh cache and resets transient state. Called once per frame from EndFrame(); integrations do not call this directly.

void Frame();

IDrawer.HasFontAtSize(string, int) Method

Returns true if the active resource provider has the named font loaded at exactly size. Used by MeasureFitFontSize(Rect, string, string, int, int, TextAlign, Wrap) so the binary search lands on a size that actually has a glyph atlas to measure against, instead of a phantom size that MeasureTextLines(string, int, string, TextAlign, Rect, Wrap, ReadOnlySpan<Rect>, int) would silently report as zero-bounds.

bool HasFontAtSize(string fontName, int size);

Parameters

fontName System.String

size System.Int32

Returns

System.Boolean

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

Returns the screen-space bounding rect that text would occupy under rect, and (via characterRects) the per-character rects. Builds no draw command. Used to size dynamic layouts before draw - for example, scroll-view content height.

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>

Returns

UnityEngine.Rect

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

Like MeasureTextExact(string, int, string, TextAlign, Rect, Wrap, ReadOnlySpan<Rect>) but additionally fills lineCount with the number of wrapped lines under the given wrap mode. Used when the caller needs per-line advancement (for example a vertical scroll view).

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

Returns

UnityEngine.Rect

IDrawer.NewFrame() Method

Drops the previous frame's queued draw commands so the upcoming frame starts clean. Called from the top of BeginFrame(Vector2Int). Skipping this call (e.g. while the editor is paused and DoUI is not running) keeps the prior queue around so RecordInto(CommandBuffer) can replay it on subsequent repaints.

void NewFrame();

IDrawer.RecordInto(CommandBuffer) Method

Replays every queued DrawCommand into target, in order, then clears the queue. The integration calls this once per frame after EndFrame().

void RecordInto(CommandBuffer target);

Parameters

target UnityEngine.Rendering.CommandBuffer

IDrawer.SetClipRectangle(Nullable\<Rect>) Method

Sets the active scissor rectangle for subsequent draw commands until the next SetClipRectangle(Nullable<Rect>) call. Pass null to clear the scissor. Coordinates are in screen pixels.

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

Parameters

rect System.Nullable<UnityEngine.Rect>

IDrawer.SetDrawCommandCache(List\<DrawCommand>) Method

Supplies a reusable list the drawer borrows for command bookkeeping during the frame, avoiding per-frame allocation of internal buffers. Called once during UI construction; integrations do not normally call this themselves.

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

Parameters

cache System.Collections.Generic.List<DrawCommand>

IDrawer.SetFrameSize(Vector2Int) Method

Sets the frame size - the pixel extent the integrator passed to BeginFrame(Vector2Int). Drives the `_FrameSize` shader global, which the vertex stage divides by to produce NDC. Decoupling this from the actual render-target size lets UI fill the full target even when the two diverge (URP render scale ≠ 1, DRS, post-processing intermediate, etc.). Called once per frame from BeginFrame(Vector2Int); integrations do not call this directly.

void SetFrameSize(Vector2Int size);

Parameters

size UnityEngine.Vector2Int

IDrawer.SetLayoutSize(Vector2Int) Method

Sets the reference layout resolution for the current frame. Used by HandleDrawText to convert layout-pixel vertex positions to render-target pixels. Called once per frame from BeginFrame(Vector2Int); integrations do not call this directly.

void SetLayoutSize(Vector2Int size);

Parameters

size UnityEngine.Vector2Int

IDrawer.SetRenderTarget(RenderTargetIdentifier, Vector2Int, bool) Method

Tells the drawer which render target the next RecordInto(CommandBuffer) will write into and the target's pixel dimensions, so the pixel-to-NDC conversion in shaders matches the actual target rather than Screen.*. Integrations call this once per frame before RecordInto(CommandBuffer).

isOffscreen tells the drawer whether the target is an off-screen RT that needs the shader Y-flip cancelled on D3D-like APIs. Set true when rendering into a pure RenderTexture consumed via Tick UI's own texture sampler; set false for a camera backbuffer or a user-set camera.targetTexture that the user samples themselves.

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

Parameters

target UnityEngine.Rendering.RenderTargetIdentifier

size UnityEngine.Vector2Int

isOffscreen System.Boolean

IDrawer.SetScale(float) Method

Tells the drawer the active Scale for the current frame. Most primitives go through UI.LayoutToScreen which already includes Scale, but the text path normalises mesh vertices by the reference resolution and rebuilds the screen scale inside the shader from the target size - Scale would otherwise drop out. Called from BeginFrame(Vector2Int) after the scale cache is refreshed; integrations do not call this directly.

void SetScale(float Scale);

Parameters

Scale System.Single