Add support for loading images for use in ImGui windows

This commit is contained in:
meli 2020-01-23 13:45:40 -08:00
parent c95b39b6e8
commit cc676a25f5
3 changed files with 43 additions and 1 deletions

View file

@ -26,6 +26,22 @@ namespace Dalamud.Interface
this.interfaceManager.OnDraw -= OnDraw;
}
/// <summary>
/// Loads an image from the specified file.
/// </summary>
/// <param name="filePath">The full filepath to the image.</param>
/// <returns>A <see cref="TextureWrap"/> object wrapping the created image. Use <see cref="TextureWrap.ImGuiHandle"/> inside ImGui.Image()</returns>
public TextureWrap LoadImage(string filePath) =>
this.interfaceManager.LoadImage(filePath);
/// <summary>
/// Loads an image from a byte stream, such as a png downloaded into memory.
/// </summary>
/// <param name="imageData">A byte array containing the raw image data.</param>
/// <returns>A <see cref="TextureWrap"/> object wrapping the created image. Use <see cref="TextureWrap.ImGuiHandle"/> inside ImGui.Image()</returns>
public TextureWrap LoadImage(byte[] imageData) =>
this.interfaceManager.LoadImage(imageData);
private void OnDraw() {
ImGui.PushID(this.namespaceName);
OnBuildUi?.Invoke();