@vestra-player/sdk - v1.11.3
    Preparing search index...

    Interface ImageRef

    An image file for a Slint image property, made by Ui.image.

    Opaque: pass it where the Slint type is image, with View.set or View.bind: the whole value of an image property or, an image field at any depth, such as the logo of each row of a list. Making the reference does not read the file: the player checks and decodes it each time it receives the value (a property write, a window opening; Ui.image has the rules and limits).

    A reference belongs to the Scope that created it. Once that scope is disposed, writing the reference fails with invalid (reported to Scope.onError); an image already on screen stays until the property changes or the view closes.

    A window opens showing cover.png, which the plugin saved in its data directory. ui.image only makes a reference, without reading the file; the player checks and decodes the file when it receives the value, so a missing file fails that write with missing (here: show rejects, as it is an initial property). A missing image nested inside a value is drawn empty instead.

    const cover = plugin.windows.create("ui/cover.slint");
    // `art` is an `image` property in ui/cover.slint.
    cover.set({ art: plugin.ui.image(`${plugin.dataDirectory}/cover.png`) });
    await cover.show();

    Each row of the list draws its own small logo next to its name. An ImageRef may sit in any field of a property value, so the rows carry their icons; maxSide: 64 decodes each logo at most 64 px wide, which keeps the view's image memory small.

    export struct Row { key: string, name: string, icon: image }
    
    const items = [{ id: "a", name: "A", iconPath: `${plugin.dataDirectory}/a.png` }];
    const list = plugin.windows.create("ui/list.slint");
    list.bind(() => ({
    rows: items.map((item) => ({
    key: item.id,
    name: item.name,
    // About twice the drawn size (32 px) stays sharp on dense screens.
    icon: plugin.ui.image(item.iconPath, { maxSide: 64 }),
    })),
    }));

    1.0.0

    interface ImageRef {
        path: string;
        __vestraImage: true;
    }
    Index
    path: string

    The path given to Ui.image, unchanged.

    __vestraImage: true

    Brand that marks the value as an image reference; never construct one yourself.