Skip to content

Images

Images to draw with ImGui. Gone with the plugin.

dimensions(): Wraith.Image.Size
texture(): Wraith.TextureRef
destroy(): void

Zero once it’s destroyed. Any thread.

Uses Image.Size.

For the current ImGui frame only. Render thread.

Uses TextureRef.

Its GPU copies go over the next frames. Fine to call twice.

Get it with Api.images().

create(width: number, height: number, rgba: Array<number>): Wraith.Image
decode(bytes: Array<number>): Wraith.Image
load(path: string): Promise<Wraith.Image>
draw(image: Wraith.Image | null, size: import("salamander").Given<Wraith.ImVec2>): void

Packed RGBA pixels, copied. Any thread.

Fails with ImageError. Uses Image.

A PNG, JPEG, BMP, TGA or GIF’s first frame. Slow, so not on the render thread.

Fails with ImageError. Uses Image.

A file, decoded on a worker. Relative paths are in the plugin’s folder. Any thread.

Async. Fails with ImageError. Uses Image.

Draws it in the current window, in a draw callback. Zero size is its own size.

Uses Image, ImVec2.

What can go wrong, besides Cancelled, Unsupported and Gone.

Code Error
1 InvalidImage Not an image it can read, or pixels that don’t match the size
2 TooBig Wider or taller than 16384
3 Failed
4 NotFound No file there, for load
5 NotDeclared Outside its own folders, and its wraith.json doesn’t list “files” in “permissions”

ImGui’s ImTextureRef. A 0 data can’t be drawn.

A struct, 0x10 bytes, aligned to 8.

Offset Field Type
0x0 data usize
0x8 id u64
data: number
id: bigint

A struct, 0x8 bytes, aligned to 4.

Offset Field Type
0x0 width u32
0x4 height u32
width: number
height: number

Made with ♥ by Asgard