DRAWING FUNCTIONS

DrawImage

Draws a loaded texture inside the given rectangle.

Syntax

ONYX.DrawImage(texId, x, y, w, h, r, g, b, a, rounding, u0, v0, u1, v1)

Parameters

  • texId (number) — Texture handle.
  • x, y (number) — Top-left corner in screen pixels.
  • w, h (number) — Size in pixels.
  • r, g, b, a (number (optional)) — Tint colour; default 1,1,1,1.
  • rounding (number (optional)) — Corner radius; default 0.
  • u0, v0, u1, v1 (number (optional)) — UV rectangle; default 0,0,1,1.

Return(s)

None

Behavior

  • Uses the exact pixel size - no aspect correction is applied.
  • UVs allow cropping or atlas regions.
  • Fails quietly when the texture is invalid or released.

Example(s)

local logo = ONYX.LoadTexture("logo.png")
ONYX.BeginFrame()
ONYX.DrawImage(logo, 40, 40, 96, 96, 1, 1, 1, 1, 8)
ONYX.SubmitFrame()