DrawImage

Draw a texture on screen with optional tint, rounding, and UVs.

Syntax

Susano.DrawImage(texId, x, y, w, h [, r,g,b,a [, rounding [, u0,v0,u1,v1]]]) -> void

Parameters

texId (number): Texture handle.

x, y (number): Top-left in screen pixels.

w, h (number): Size in pixels.

r, g, b, a (number, optional): Tint color. Default 1,1,1,1.

rounding (number, optional): Corner radius in px. Default 0.

u0, v0, u1, v1 (number, optional): UV rectangle. Default 0,0,1,1.

Return(s)

None

Behavior

Draws via ImGui AddImage (or AddImageRounded when rounding>0).

Uses the exact pixels of w x h; no aspect correction.

UVs allow cropping or atlas regions.

Fails if texId is invalid or released.

Example(s)

-- basic
local id,w,h = Susano.LoadTexture("logo.png")
Susano.BeginFrame()
Susano.DrawImage(id, 40, 40, w, h)

-- tinted, rounded, scaled
Susano.DrawImage(id, 40, 40+h+12, 128, 128, 1,1,1,1, 10)

-- crop left half via UVs
Susano.DrawImage(id, 200, 40, 128, 128, 1,1,1,1, 0, 0,0,0.5,1)
Susano.SubmitFrame()

Last updated