Images
Images to draw with ImGui. Gone with the plugin.
dimensions(): Wraith.Image.Sizetexture(): Wraith.TextureRefdestroy(): voiddimensions(): Wraith.Image.Sizetexture(): Wraith.TextureRefdestroy()Wraith.Image.Size Dimensions()Wraith.TextureRef Texture()void Destroy()Wraith::Image_Size dimensions() constWraith::TextureRef texture() constvoid destroy() constpub fn dimensions(&self) -> wraith::ImageSizepub fn texture(&self) -> wraith::TextureRefpub fn destroy(&self)fn dimensions(self: Wraith.Image) Wraith.Image.Sizefn texture(self: Wraith.Image) Wraith.TextureReffn destroy(self: Wraith.Image) voidWraith_Image_Size Wraith_Image_dimensions(Wraith_Image self)Wraith_TextureRef Wraith_Image_texture(Wraith_Image self)void Wraith_Image_destroy(Wraith_Image self)dimensions
Section titled “dimensions”Zero once it’s destroyed. Any thread.
Uses Image.Size.
texture
Section titled “texture”For the current ImGui frame only. Render thread.
Uses TextureRef.
destroy
Section titled “destroy”Its GPU copies go over the next frames. Fine to call twice.
Images
Section titled “Images”Get it with Api.images().
create(width: number, height: number, rgba: Array<number>): Wraith.Imagedecode(bytes: Array<number>): Wraith.Imageload(path: string): Promise<Wraith.Image>draw(image: Wraith.Image | null, size: import("salamander").Given<Wraith.ImVec2>): voidcreate(width: integer, height: integer, rgba: (integer)[]): Wraith.Imagedecode(bytes: (integer)[]): Wraith.Imageload(path: string): salamander.Promisedraw(image: Wraith.Image|nil, size: Wraith.ImVec2)Wraith.Image? Create(uint width, uint height, System.ReadOnlySpan<byte> rgba)Wraith.Image? Decode(System.ReadOnlySpan<byte> bytes)System.Threading.Tasks.Task<Wraith.Image?> LoadAsync(string path, System.Threading.CancellationToken cancel = default)void Draw(Wraith.Image? image, Wraith.ImVec2 size)sal::Result<Wraith::Image, Wraith::ImageError> create(uint32_t width, uint32_t height, std::span<const uint8_t> rgba) constsal::Result<Wraith::Image, Wraith::ImageError> decode(std::span<const uint8_t> bytes) constsal::Future<Wraith::Image, Wraith::ImageError> load(std::string_view path) constvoid draw(Wraith::Image image, Wraith::ImVec2 size) constpub fn create(&self, width: u32, height: u32, rgba: &[u8]) -> Result<wraith::Image, wraith::ImageError>pub fn decode(&self, bytes: &[u8]) -> Result<wraith::Image, wraith::ImageError>pub fn load(&self, path: &str) -> salamander::Future<wraith::Image, wraith::ImageError>pub fn draw(&self, image: wraith::Image, size: wraith::ImVec2)fn create(self: Wraith.Images, width: u32, height: u32, rgba: []const u8) (Wraith.ImageError || rt.Failure)!Wraith.Imagefn decode(self: Wraith.Images, bytes: []const u8) (Wraith.ImageError || rt.Failure)!Wraith.Imagefn load(self: Wraith.Images, path: []const u8) rt.Promise((Wraith.ImageError || rt.Failure)!Wraith.Image, Wraith.ImageErrorCode)fn draw(self: Wraith.Images, image: Wraith.Image, size: Wraith.ImVec2) voiduint32_t Wraith_Images_create(Wraith_Images self, uint32_t width, uint32_t height, Slice_u8 rgba, Wraith_Image *out)uint32_t Wraith_Images_decode(Wraith_Images self, Slice_u8 bytes, Wraith_Image *out)sal_Promise Wraith_Images_load(Wraith_Images self, sal_string path)void Wraith_Images_draw(Wraith_Images self, Wraith_Image image, Wraith_ImVec2 size)create
Section titled “create”Packed RGBA pixels, copied. Any thread.
Fails with ImageError. Uses Image.
decode
Section titled “decode”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.
ImageError
Section titled “ImageError”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” |
TextureRef
Section titled “TextureRef”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: numberid: bigintdata: integerid: integernuint Dataulong Iduintptr_t datauint64_t idpub data: usizepub id: u64data: usizeid: u64uintptr_t datauint64_t idImage.Size
Section titled “Image.Size”A struct, 0x8 bytes, aligned to 4.
| Offset | Field | Type | |
|---|---|---|---|
| 0x0 | width |
u32 |
|
| 0x4 | height |
u32 |
width: numberheight: numberwidth: integerheight: integeruint Widthuint Heightuint32_t widthuint32_t heightpub width: u32pub height: u32width: u32height: u32uint32_t widthuint32_t heightwraith.io · Mods on the Hub · Get Wraith
Made with ♥ by Asgard
