@zturnlibs/ztron-api


image

Classes

Image

Defined in: image.ts:38

A native image registered in the host. Create with fromPath/fromBytes (and fromRGBA for raw pixels) and pass to tray.setIcon / setIcon.

Properties

rid

readonly rid: number

Defined in: image.ts:40

The host-side image registry id.

Methods

close()

close(): Promise<void>

Defined in: image.ts:112

Releases the image in the host.

Returns

Promise<void>

rgba()

rgba(): Promise<Uint8Array<ArrayBufferLike> | undefined>

Defined in: image.ts:96

The raw RGBA pixels this image was built from. Only images created via Image.fromRGBA/new carry pixels; path/PNG-loaded images resolve to undefined until C-layer decode lands (GAP.md B11).

Returns

Promise<Uint8Array<ArrayBufferLike> | undefined>

size()

size(): Promise<{ height: number; width: number; } | null>

Defined in: image.ts:104

Pixel dimensions (null when unknown — see Image.rgba).

Returns

Promise<{ height: number; width: number; } | null>

fromBytes()

static fromBytes(bytes): Promise<Image>

Defined in: image.ts:54

Loads an image from raw bytes.

Parameters
bytes

number[] | Uint8Array<ArrayBufferLike>

Returns

Promise<Image>

fromPath()

static fromPath(path): Promise<Image>

Defined in: image.ts:47

Loads an image from a file path.

Parameters
path

string

Returns

Promise<Image>

fromRGBA()

static fromRGBA(rgba, width, height): Promise<Image>

Defined in: image.ts:64

Builds an image from RGBA pixel data (upstream name: Image.new).

Parameters
rgba

number[] | Uint8Array<ArrayBufferLike>

width

number

height

number

Returns

Promise<Image>

new()

static new(rgba, width, height): Promise<Image>

Defined in: image.ts:83

Upstream-parity alias of Image.fromRGBA.

Parameters
rgba

number[] | Uint8Array<ArrayBufferLike>

width

number

height

number

Returns

Promise<Image>

Type Aliases

ImageLike

ImageLike = string | Image | Uint8Array | ArrayBuffer | number[] | null

Defined in: image.ts:26

Anything an icon-accepting API takes (path / Image / raw bytes / none).

Functions

fromBase64()

fromBase64(b64): Uint8Array

Defined in: image.ts:18

Decodes a base64 string into bytes (chunked, for large payloads).

Parameters

b64

string

Returns

Uint8Array


toBase64()

toBase64(bytes): string

Defined in: image.ts:8

Converts bytes to a base64 string for the wire.

Parameters

bytes

Uint8Array

Returns

string


transformImage()

transformImage(image): Promise<{ image_id?: number; path?: string; } | null>

Defined in: image.ts:122

Normalizes an icon argument into the wire shape: a path string stays a path, an Image becomes its registry id, and raw bytes are registered (decoded host-side) first — a port of @tauri-apps/api transformImage.

Parameters

image

ImageLike

Returns

Promise<{ image_id?: number; path?: string; } | null>