diff --git a/Dalamud/Interface/InterfaceManager.cs b/Dalamud/Interface/InterfaceManager.cs index 54b3548ac..83d496efa 100644 --- a/Dalamud/Interface/InterfaceManager.cs +++ b/Dalamud/Interface/InterfaceManager.cs @@ -148,6 +148,19 @@ namespace Dalamud.Interface return null; } + public TextureWrap LoadImageRaw(byte[] imageData, int width, int height, int numChannels) + { + try + { + return this.scene?.LoadImageRaw(imageData, width, height, numChannels) ?? null; + } + catch (Exception ex) + { + Log.Error(ex, "Failed to load image from raw data"); + } + return null; + } + private IntPtr PresentDetour(IntPtr swapChain, uint syncInterval, uint presentFlags) { if (this.scene == null) diff --git a/Dalamud/Interface/UiBuilder.cs b/Dalamud/Interface/UiBuilder.cs index d07512c23..5ad397845 100644 --- a/Dalamud/Interface/UiBuilder.cs +++ b/Dalamud/Interface/UiBuilder.cs @@ -58,6 +58,17 @@ namespace Dalamud.Interface public TextureWrap LoadImage(byte[] imageData) => this.interfaceManager.LoadImage(imageData); + /// + /// Loads an image from raw unformatted pixel data, with no type or header information. To load formatted data, use . + /// + /// A byte array containing the raw pixel data. + /// The width of the image contained in . + /// The height of the image contained in . + /// The number of channels (bytes per pixel) of the image contained in . This should usually be 4. + /// A object wrapping the created image. Use inside ImGui.Image() + public TextureWrap LoadImageRaw(byte[] imageData, int width, int height, int numChannels) => + this.interfaceManager.LoadImageRaw(imageData, width, height, numChannels); + /// /// Event that is fired when the plugin should open its configuration interface. /// diff --git a/lib/ImGuiScene b/lib/ImGuiScene index d0c03cd31..b096e5b2e 160000 --- a/lib/ImGuiScene +++ b/lib/ImGuiScene @@ -1 +1 @@ -Subproject commit d0c03cd31dac7a3eede52a467ef81def69f87ef9 +Subproject commit b096e5b2e9826525394a0c00b987aad1f2c4eccb