mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
expose imguiscene method to load textures from raw pixel data; underlying handling may change, but UIBuilder api can probably remain this way
This commit is contained in:
parent
c9d7846d4c
commit
a80218d741
3 changed files with 25 additions and 1 deletions
|
|
@ -148,6 +148,19 @@ namespace Dalamud.Interface
|
||||||
return null;
|
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)
|
private IntPtr PresentDetour(IntPtr swapChain, uint syncInterval, uint presentFlags)
|
||||||
{
|
{
|
||||||
if (this.scene == null)
|
if (this.scene == null)
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,17 @@ namespace Dalamud.Interface
|
||||||
public TextureWrap LoadImage(byte[] imageData) =>
|
public TextureWrap LoadImage(byte[] imageData) =>
|
||||||
this.interfaceManager.LoadImage(imageData);
|
this.interfaceManager.LoadImage(imageData);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Loads an image from raw unformatted pixel data, with no type or header information. To load formatted data, use <see cref="LoadImage(byte[])"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="imageData">A byte array containing the raw pixel data.</param>
|
||||||
|
/// <param name="width">The width of the image contained in <paramref name="imageData"/>.</param>
|
||||||
|
/// <param name="height">The height of the image contained in <paramref name="imageData"/>.</param>
|
||||||
|
/// <param name="numChannels">The number of channels (bytes per pixel) of the image contained in <paramref name="imageData"/>. This should usually be 4.</param>
|
||||||
|
/// <returns>A <see cref="TextureWrap"/> object wrapping the created image. Use <see cref="TextureWrap.ImGuiHandle"/> inside ImGui.Image()</returns>
|
||||||
|
public TextureWrap LoadImageRaw(byte[] imageData, int width, int height, int numChannels) =>
|
||||||
|
this.interfaceManager.LoadImageRaw(imageData, width, height, numChannels);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Event that is fired when the plugin should open its configuration interface.
|
/// Event that is fired when the plugin should open its configuration interface.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit d0c03cd31dac7a3eede52a467ef81def69f87ef9
|
Subproject commit b096e5b2e9826525394a0c00b987aad1f2c4eccb
|
||||||
Loading…
Add table
Add a link
Reference in a new issue