From dc83879c894bb4a3a8732dc13828727908737108 Mon Sep 17 00:00:00 2001 From: goaaats Date: Mon, 14 Apr 2025 21:20:39 +0200 Subject: [PATCH] Texture handle shim --- .../ImGuiBackend/Renderers/Dx11Renderer.cs | 2 +- .../NotificationUtilities.cs | 2 +- .../Internal/Windows/ChangelogWindow.cs | 4 +-- .../Windows/Data/Widgets/FateTableWidget.cs | 8 +++--- .../Windows/Data/Widgets/IconBrowserWidget.cs | 4 +-- .../Windows/Data/Widgets/ImGuiWidget.cs | 2 +- .../Windows/Data/Widgets/InventoryWidget.cs | 4 +-- .../Widgets/SeStringRendererTestWidget.cs | 6 ++-- .../Windows/Data/Widgets/TexWidget.cs | 8 +++--- .../Windows/Data/Widgets/UldWidget.cs | 6 ++-- .../PluginInstaller/PluginInstallerWindow.cs | 28 +++++++++---------- .../PluginInstaller/ProfileManagerWidget.cs | 6 ++-- .../Windows/Settings/Tabs/SettingsTabAbout.cs | 2 +- .../Settings/Tabs/SettingsTabAutoUpdate.cs | 6 ++-- .../Internal/Windows/TitleScreenMenuWindow.cs | 4 +-- .../FontAtlasFactory.BuildToolkit.cs | 4 +-- .../FontAtlasFactory.Implementation.cs | 2 +- .../Internal/TextureManager.BlameTracker.cs | 6 ++-- .../Internal/TextureManager.Drawer.cs | 2 +- .../TextureManager.FromExistingTexture.cs | 2 +- .../TextureWraps/ForwardingTextureWrap.cs | 6 ++-- .../TextureWraps/IDalamudTextureWrap.cs | 9 ++++-- .../Internal/UnknownTextureWrap.cs | 2 +- .../Internal/ViewportTextureWrap.cs | 4 +-- .../Utility/Internal/DevTextureSaveMenu.cs | 2 +- 25 files changed, 68 insertions(+), 63 deletions(-) diff --git a/Dalamud/Interface/ImGuiBackend/Renderers/Dx11Renderer.cs b/Dalamud/Interface/ImGuiBackend/Renderers/Dx11Renderer.cs index 4e72e9c8f..080b52427 100644 --- a/Dalamud/Interface/ImGuiBackend/Renderers/Dx11Renderer.cs +++ b/Dalamud/Interface/ImGuiBackend/Renderers/Dx11Renderer.cs @@ -414,7 +414,7 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer false, false, $"Font#{textureIndex}"); - io.Fonts.SetTexID(textureIndex, tex.ImGuiHandle); + io.Fonts.SetTexID(textureIndex, tex.Handle); this.fontTextures.Add(tex); } diff --git a/Dalamud/Interface/ImGuiNotification/NotificationUtilities.cs b/Dalamud/Interface/ImGuiNotification/NotificationUtilities.cs index 4196c5351..4f0830fa1 100644 --- a/Dalamud/Interface/ImGuiNotification/NotificationUtilities.cs +++ b/Dalamud/Interface/ImGuiNotification/NotificationUtilities.cs @@ -102,7 +102,7 @@ public static class NotificationUtilities return false; try { - var handle = texture.ImGuiHandle; + var handle = texture.Handle; var size = texture.Size; if (size.X > maxCoord.X - minCoord.X) size *= (maxCoord.X - minCoord.X) / size.X; diff --git a/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs b/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs index b5d96e53b..6f878ba43 100644 --- a/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs +++ b/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs @@ -264,7 +264,7 @@ internal sealed class ChangelogWindow : Window, IDisposable ImGui.SetCursorPos(new Vector2(logoContainerSize.X / 2 - logoSize.X / 2, logoContainerSize.Y / 2 - logoSize.Y / 2)); using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, Math.Clamp(this.windowFade.EasedPoint.X - 0.5f, 0f, 1f))) - ImGui.Image(this.logoTexture.Value.ImGuiHandle, logoSize); + ImGui.Image(this.logoTexture.Value.Handle, logoSize); } ImGui.SameLine(); @@ -380,7 +380,7 @@ internal sealed class ChangelogWindow : Window, IDisposable ImGuiHelpers.CenterCursorFor(this.apiBumpExplainerTexture.Value.Width); ImGui.Image( - this.apiBumpExplainerTexture.Value.ImGuiHandle, + this.apiBumpExplainerTexture.Value.Handle, this.apiBumpExplainerTexture.Value.Size); if (!this.currentFtueLevels.TryGetValue(FtueLevels.AutoUpdate.Name, out var autoUpdateLevel) || autoUpdateLevel < FtueLevels.AutoUpdate.AutoUpdateInitial) diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/FateTableWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/FateTableWidget.cs index 48f03f1d0..20fd7b7e7 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/FateTableWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/FateTableWidget.cs @@ -93,7 +93,7 @@ internal class FateTableWidget : IDataWindowWidget { if (textureManager.Shared.GetFromGameIcon(fate.IconId).TryGetWrap(out var texture, out _)) { - ImGui.Image(texture.ImGuiHandle, new(ImGui.GetTextLineHeight())); + ImGui.Image(texture.Handle, new(ImGui.GetTextLineHeight())); if (ImGui.IsItemHovered()) { @@ -101,7 +101,7 @@ internal class FateTableWidget : IDataWindowWidget ImGui.BeginTooltip(); ImGui.TextUnformatted("Click to copy IconId"); ImGui.TextUnformatted($"ID: {fate.IconId} – Size: {texture.Width}x{texture.Height}"); - ImGui.Image(texture.ImGuiHandle, new(texture.Width, texture.Height)); + ImGui.Image(texture.Handle, new(texture.Width, texture.Height)); ImGui.EndTooltip(); } @@ -118,7 +118,7 @@ internal class FateTableWidget : IDataWindowWidget { if (textureManager.Shared.GetFromGameIcon(fate.MapIconId).TryGetWrap(out var texture, out _)) { - ImGui.Image(texture.ImGuiHandle, new(ImGui.GetTextLineHeight())); + ImGui.Image(texture.Handle, new(ImGui.GetTextLineHeight())); if (ImGui.IsItemHovered()) { @@ -126,7 +126,7 @@ internal class FateTableWidget : IDataWindowWidget ImGui.BeginTooltip(); ImGui.TextUnformatted("Click to copy MapIconId"); ImGui.TextUnformatted($"ID: {fate.MapIconId} – Size: {texture.Width}x{texture.Height}"); - ImGui.Image(texture.ImGuiHandle, new(texture.Width, texture.Height)); + ImGui.Image(texture.Handle, new(texture.Width, texture.Height)); ImGui.EndTooltip(); } diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs index f0d1a355d..b1fd5178d 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs @@ -153,7 +153,7 @@ public class IconBrowserWidget : IDataWindowWidget if (texm.Shared.GetFromGameIcon(iconId).TryGetWrap(out var texture, out var exc)) { - ImGui.Image(texture.ImGuiHandle, this.iconSize); + ImGui.Image(texture.Handle, this.iconSize); // If we have the option to show a tooltip image, draw the image, but make sure it's not too big. if (ImGui.IsItemHovered() && this.showTooltipImage) @@ -167,7 +167,7 @@ public class IconBrowserWidget : IDataWindowWidget texture.Size.X * scale / 2.0f - textSize.X / 2.0f + ImGui.GetStyle().FramePadding.X * 2.0f); ImGui.Text(iconId.ToString()); - ImGui.Image(texture.ImGuiHandle, texture.Size * scale); + ImGui.Image(texture.Handle, texture.Size * scale); ImGui.EndTooltip(); } diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/ImGuiWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/ImGuiWidget.cs index 44a7eb719..f7b14769f 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/ImGuiWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/ImGuiWidget.cs @@ -456,7 +456,7 @@ internal class ImGuiWidget : IDataWindowWidget public DisposeLoggingTextureWrap(IDalamudTextureWrap inner) => this.inner = inner; - public ImTextureID ImGuiHandle => this.inner.ImGuiHandle; + public ImTextureID Handle => this.inner.Handle; public int Width => this.inner.Width; diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/InventoryWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/InventoryWidget.cs index 2d9c1ff52..25c22e04b 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/InventoryWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/InventoryWidget.cs @@ -148,7 +148,7 @@ internal class InventoryWidget : IDataWindowWidget if (this.textureManager.Shared.TryGetFromGameIcon(new GameIconLookup(iconId, item.IsHq), out var tex) && tex.TryGetWrap(out var texture, out _)) { - ImGui.Image(texture.ImGuiHandle, new Vector2(ImGui.GetTextLineHeight())); + ImGui.Image(texture.Handle, new Vector2(ImGui.GetTextLineHeight())); if (ImGui.IsItemHovered()) { @@ -156,7 +156,7 @@ internal class InventoryWidget : IDataWindowWidget ImGui.BeginTooltip(); ImGui.TextUnformatted("Click to copy IconId"); ImGui.TextUnformatted($"ID: {iconId} – Size: {texture.Width}x{texture.Height}"); - ImGui.Image(texture.ImGuiHandle, new(texture.Width, texture.Height)); + ImGui.Image(texture.Handle, new(texture.Width, texture.Height)); ImGui.EndTooltip(); } diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringRendererTestWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringRendererTestWidget.cs index 57501ff57..3f677c4f0 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringRendererTestWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringRendererTestWidget.cs @@ -390,7 +390,7 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget .GetFromGame(Encoding.UTF8.GetString(state.Span[(byteOffset + 4)..(byteOffset + off)])) .GetWrapOrEmpty(); state.Draw( - tex.ImGuiHandle, + tex.Handle, offset + new Vector2(0, (state.LineHeight - state.FontSize) / 2), tex.Size * (state.FontSize / tex.Size.Y), Vector2.Zero, @@ -408,7 +408,7 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget .GetFromGameIcon(parsed) .GetWrapOrEmpty(); state.Draw( - tex.ImGuiHandle, + tex.Handle, offset + new Vector2(0, (state.LineHeight - state.FontSize) / 2), tex.Size * (state.FontSize / tex.Size.Y), Vector2.Zero, @@ -417,7 +417,7 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget static void DrawAsset(scoped in SeStringDrawState state, Vector2 offset, DalamudAsset asset) => state.Draw( - Service.Get().GetDalamudTextureWrap(asset).ImGuiHandle, + Service.Get().GetDalamudTextureWrap(asset).Handle, offset + new Vector2(0, (state.LineHeight - state.FontSize) / 2), new(state.FontSize, state.FontSize), Vector2.Zero, diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs index d46789c33..ba707e0ca 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs @@ -286,7 +286,7 @@ internal class TexWidget : IDataWindowWidget { if (t.GetTexture(this.textureManager) is { } source) { - var psrv = (ID3D11ShaderResourceView*)source.ImGuiHandle.Handle; + var psrv = (ID3D11ShaderResourceView*)source.Handle.Handle; var rcsrv = psrv->AddRef() - 1; psrv->Release(); @@ -314,7 +314,7 @@ internal class TexWidget : IDataWindowWidget if (this.inputTexScale != Vector2.Zero) scale *= this.inputTexScale; - ImGui.Image(tex.ImGuiHandle, scale, this.inputTexUv0, this.inputTexUv1, this.inputTintCol); + ImGui.Image(tex.Handle, scale, this.inputTexUv0, this.inputTexUv1, this.inputTintCol); } else { @@ -467,7 +467,7 @@ internal class TexWidget : IDataWindowWidget if (ImGui.IsItemHovered()) { ImGui.BeginTooltip(); - ImGui.Image(wrap.ImGuiHandle, wrap.Size); + ImGui.Image(wrap.Handle, wrap.Size); ImGui.EndTooltip(); } @@ -590,7 +590,7 @@ internal class TexWidget : IDataWindowWidget if (ImGui.IsItemHovered() && texture.GetWrapOrDefault(null) is { } immediate) { ImGui.BeginTooltip(); - ImGui.Image(immediate.ImGuiHandle, immediate.Size); + ImGui.Image(immediate.Handle, immediate.Size); ImGui.EndTooltip(); } diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/UldWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/UldWidget.cs index 1cf1f06c1..f8d04e2cc 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/UldWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/UldWidget.cs @@ -287,7 +287,7 @@ internal class UldWidget : IDataWindowWidget var texturePath = GetStringNullTerminated(textureEntry.Path); ImGui.TextUnformatted($"Base path at {texturePath}:"); if (textureManager.Shared.GetFromGame(texturePath).TryGetWrap(out var wrap, out var e)) - ImGui.Image(wrap.ImGuiHandle, wrap.Size); + ImGui.Image(wrap.Handle, wrap.Size); else if (e is not null) ImGui.TextUnformatted(e.ToString()); @@ -296,7 +296,7 @@ internal class UldWidget : IDataWindowWidget var texturePathThemed = this.ToThemedPath(texturePath); ImGui.TextUnformatted($"Themed path at {texturePathThemed}:"); if (textureManager.Shared.GetFromGame(texturePathThemed).TryGetWrap(out wrap, out e)) - ImGui.Image(wrap.ImGuiHandle, wrap.Size); + ImGui.Image(wrap.Handle, wrap.Size); else if (e is not null) ImGui.TextUnformatted(e.ToString()); } @@ -533,7 +533,7 @@ internal class UldWidget : IDataWindowWidget { var uv0 = new Vector2(partsDataPart.U, partsDataPart.V); var uv1 = uv0 + partSize; - ImGui.Image(wrap.ImGuiHandle, partSize * ImGuiHelpers.GlobalScale, uv0 / wrap.Size, uv1 / wrap.Size); + ImGui.Image(wrap.Handle, partSize * ImGuiHelpers.GlobalScale, uv0 / wrap.Size, uv1 / wrap.Size); } if (ImGui.IsItemClicked()) diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index 08d46aece..0ae72fc29 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -1737,19 +1737,19 @@ internal class PluginInstallerWindow : Window, IDisposable var iconSize = ImGuiHelpers.ScaledVector2(64, 64); var cursorBeforeImage = ImGui.GetCursorPos(); - ImGui.Image(iconTex.ImGuiHandle, iconSize); + ImGui.Image(iconTex.Handle, iconSize); ImGui.SameLine(); if (this.testerError) { ImGui.SetCursorPos(cursorBeforeImage); - ImGui.Image(this.imageCache.TroubleIcon.ImGuiHandle, iconSize); + ImGui.Image(this.imageCache.TroubleIcon.Handle, iconSize); ImGui.SameLine(); } else if (this.testerUpdateAvailable) { ImGui.SetCursorPos(cursorBeforeImage); - ImGui.Image(this.imageCache.UpdateIcon.ImGuiHandle, iconSize); + ImGui.Image(this.imageCache.UpdateIcon.Handle, iconSize); ImGui.SameLine(); } @@ -1850,7 +1850,7 @@ internal class PluginInstallerWindow : Window, IDisposable if (ImGui.BeginPopup(popupId)) { - if (ImGui.ImageButton(image.ImGuiHandle, new Vector2(image.Width, image.Height))) + if (ImGui.ImageButton(image.Handle, new Vector2(image.Width, image.Height))) ImGui.CloseCurrentPopup(); ImGui.EndPopup(); @@ -1874,7 +1874,7 @@ internal class PluginInstallerWindow : Window, IDisposable } var size = ImGuiHelpers.ScaledVector2(xAct / thumbFactor, yAct / thumbFactor); - if (ImGui.ImageButton(image.ImGuiHandle, size)) + if (ImGui.ImageButton(image.Handle, size)) ImGui.OpenPopup(popupId); ImGui.PopStyleVar(); @@ -2125,7 +2125,7 @@ internal class PluginInstallerWindow : Window, IDisposable } ImGui.PushStyleVar(ImGuiStyleVar.Alpha, iconAlpha); - ImGui.Image(iconTex.ImGuiHandle, iconSize); + ImGui.Image(iconTex.Handle, iconSize); ImGui.PopStyleVar(); ImGui.SameLine(); @@ -2136,13 +2136,13 @@ internal class PluginInstallerWindow : Window, IDisposable ImGui.PushStyleVar(ImGuiStyleVar.Alpha, overlayAlpha); if (flags.HasFlag(PluginHeaderFlags.UpdateAvailable)) - ImGui.Image(this.imageCache.UpdateIcon.ImGuiHandle, iconSize); + ImGui.Image(this.imageCache.UpdateIcon.Handle, iconSize); else if ((flags.HasFlag(PluginHeaderFlags.HasTrouble) && !pluginDisabled) || flags.HasFlag(PluginHeaderFlags.IsOrphan)) - ImGui.Image(this.imageCache.TroubleIcon.ImGuiHandle, iconSize); + ImGui.Image(this.imageCache.TroubleIcon.Handle, iconSize); else if (flags.HasFlag(PluginHeaderFlags.IsInstallableOutdated)) - ImGui.Image(this.imageCache.OutdatedInstallableIcon.ImGuiHandle, iconSize); + ImGui.Image(this.imageCache.OutdatedInstallableIcon.Handle, iconSize); else if (pluginDisabled) - ImGui.Image(this.imageCache.DisabledIcon.ImGuiHandle, iconSize); + ImGui.Image(this.imageCache.DisabledIcon.Handle, iconSize); /* NOTE: Replaced by the checkmarks for now, let's see if that is fine else if (isLoaded && isThirdParty) ImGui.Image(this.imageCache.ThirdInstalledIcon.ImGuiHandle, iconSize); @@ -2150,7 +2150,7 @@ internal class PluginInstallerWindow : Window, IDisposable ImGui.Image(this.imageCache.ThirdIcon.ImGuiHandle, iconSize); */ else if (isLoaded) - ImGui.Image(this.imageCache.InstalledIcon.ImGuiHandle, iconSize); + ImGui.Image(this.imageCache.InstalledIcon.Handle, iconSize); else ImGui.Dummy(iconSize); ImGui.PopStyleVar(); @@ -2334,7 +2334,7 @@ internal class PluginInstallerWindow : Window, IDisposable icon = this.imageCache.CorePluginIcon; } - ImGui.Image(icon.ImGuiHandle, iconSize); + ImGui.Image(icon.Handle, iconSize); } else { @@ -3637,7 +3637,7 @@ internal class PluginInstallerWindow : Window, IDisposable var popupId = $"plugin{index}image{i}"; if (ImGui.BeginPopup(popupId)) { - if (ImGui.ImageButton(image.ImGuiHandle, new Vector2(image.Width, image.Height))) + if (ImGui.ImageButton(image.Handle, new Vector2(image.Width, image.Height))) ImGui.CloseCurrentPopup(); ImGui.EndPopup(); @@ -3661,7 +3661,7 @@ internal class PluginInstallerWindow : Window, IDisposable } var size = ImGuiHelpers.ScaledVector2(xAct / thumbFactor, yAct / thumbFactor); - if (ImGui.ImageButton(image.ImGuiHandle, size)) + if (ImGui.ImageButton(image.Handle, size)) ImGui.OpenPopup(popupId); ImGui.PopStyleVar(); diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/ProfileManagerWidget.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/ProfileManagerWidget.cs index d1bb8031b..ecbb8ff7d 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/ProfileManagerWidget.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/ProfileManagerWidget.cs @@ -416,13 +416,13 @@ internal class ProfileManagerWidget pic.TryGetIcon(pmPlugin, pmPlugin.Manifest, pmPlugin.IsThirdParty, out var icon, out _); icon ??= pic.DefaultIcon; - ImGui.Image(icon.ImGuiHandle, new Vector2(pluginLineHeight)); + ImGui.Image(icon.Handle, new Vector2(pluginLineHeight)); if (pmPlugin.IsDev) { ImGui.SetCursorPos(cursorBeforeIcon); ImGui.PushStyleVar(ImGuiStyleVar.Alpha, 0.7f); - ImGui.Image(pic.DevPluginIcon.ImGuiHandle, new Vector2(pluginLineHeight)); + ImGui.Image(pic.DevPluginIcon.Handle, new Vector2(pluginLineHeight)); ImGui.PopStyleVar(); } @@ -439,7 +439,7 @@ internal class ProfileManagerWidget } else { - ImGui.Image(pic.DefaultIcon.ImGuiHandle, new Vector2(pluginLineHeight)); + ImGui.Image(pic.DefaultIcon.Handle, new Vector2(pluginLineHeight)); ImGui.SameLine(); var text = Locs.NotInstalled(profileEntry.InternalName); diff --git a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAbout.cs b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAbout.cs index 9d6c0d2be..25d7ed131 100644 --- a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAbout.cs +++ b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAbout.cs @@ -281,7 +281,7 @@ Contribute at: https://github.com/goatcorp/Dalamud const float imageSize = 190f; ImGui.SameLine((ImGui.GetWindowWidth() / 2) - (imageSize / 2)); this.logoTexture ??= Service.Get().GetDalamudTextureWrap(DalamudAsset.Logo); - ImGui.Image(this.logoTexture.ImGuiHandle, ImGuiHelpers.ScaledVector2(imageSize)); + ImGui.Image(this.logoTexture.Handle, ImGuiHelpers.ScaledVector2(imageSize)); ImGuiHelpers.ScaledDummy(0, 20f); diff --git a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAutoUpdate.cs b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAutoUpdate.cs index 36bfdeb36..699bfe448 100644 --- a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAutoUpdate.cs +++ b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAutoUpdate.cs @@ -116,14 +116,14 @@ public class SettingsTabAutoUpdates : SettingsTab pic.TryGetIcon(pmPlugin, pmPlugin.Manifest, pmPlugin.IsThirdParty, out var icon, out _); icon ??= pic.DefaultIcon; - ImGui.Image(icon.ImGuiHandle, new Vector2(pluginLineHeight)); + ImGui.Image(icon.Handle, new Vector2(pluginLineHeight)); if (pmPlugin.IsDev) { ImGui.SetCursorPos(cursorBeforeIcon); using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, 0.7f)) { - ImGui.Image(pic.DevPluginIcon.ImGuiHandle, new Vector2(pluginLineHeight)); + ImGui.Image(pic.DevPluginIcon.Handle, new Vector2(pluginLineHeight)); } } @@ -140,7 +140,7 @@ public class SettingsTabAutoUpdates : SettingsTab } else { - ImGui.Image(pic.DefaultIcon.ImGuiHandle, new Vector2(pluginLineHeight)); + ImGui.Image(pic.DefaultIcon.Handle, new Vector2(pluginLineHeight)); ImGui.SameLine(); var text = Loc.Localize("DalamudSettingsAutoUpdateOptInUnknownPlugin", "Unknown plugin"); diff --git a/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs b/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs index a872d4a8d..1a5ff0eef 100644 --- a/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs +++ b/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs @@ -352,7 +352,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, (float)shadeEasing.ValueClamped)) { var texture = this.shadeTexture.Value; - ImGui.Image(texture.ImGuiHandle, new Vector2(texture.Width, texture.Height) * scale); + ImGui.Image(texture.Handle, new Vector2(texture.Width, texture.Height) * scale); } var isHover = ImGui.IsItemHovered(); @@ -408,7 +408,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable // Wrap should always be valid at this point due to us checking the validity of the image each frame var dalamudTextureWrap = entry.Texture.GetWrapOrEmpty(); - ImGui.Image(dalamudTextureWrap.ImGuiHandle, new Vector2(TitleScreenMenu.TextureSize * scale)); + ImGui.Image(dalamudTextureWrap.Handle, new Vector2(TitleScreenMenu.TextureSize * scale)); if (overrideAlpha || isFirst) { ImGui.PopStyleVar(); diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs index ae462bb8c..c300eb494 100644 --- a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs +++ b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.BuildToolkit.cs @@ -709,7 +709,7 @@ internal sealed partial class FontAtlasFactory name); this.factory.TextureManager.Blame(wrap, this.data.Owner?.OwnerPlugin); this.data.AddExistingTexture(wrap); - texture.TexID = wrap.ImGuiHandle; + texture.TexID = wrap.Handle; } else if (texture.TexPixelsAlpha8 is not null) { @@ -755,7 +755,7 @@ internal sealed partial class FontAtlasFactory name); this.factory.TextureManager.Blame(wrap, this.data.Owner?.OwnerPlugin); this.data.AddExistingTexture(wrap); - texture.TexID = wrap.ImGuiHandle; + texture.TexID = wrap.Handle; continue; } else diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.Implementation.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.Implementation.cs index 5fe94287f..29fbf8930 100644 --- a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.Implementation.cs +++ b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.Implementation.cs @@ -126,7 +126,7 @@ internal sealed partial class FontAtlasFactory if (this.wraps is null) throw new ObjectDisposedException(nameof(FontAtlasBuiltData)); - var handle = wrap.ImGuiHandle; + var handle = wrap.Handle; var index = this.ImTextures.IndexOf(x => x.TexID == handle); if (index == -1) { diff --git a/Dalamud/Interface/Textures/Internal/TextureManager.BlameTracker.cs b/Dalamud/Interface/Textures/Internal/TextureManager.BlameTracker.cs index ada5affc4..673d40d18 100644 --- a/Dalamud/Interface/Textures/Internal/TextureManager.BlameTracker.cs +++ b/Dalamud/Interface/Textures/Internal/TextureManager.BlameTracker.cs @@ -253,12 +253,12 @@ internal sealed partial class TextureManager 0); /// - public ImTextureID ImGuiHandle + public ImTextureID Handle { get { if (this.refCount == 0) - return Service.Get().Empty4X4.ImGuiHandle; + return Service.Get().Empty4X4.Handle; this.srvDebugPreviewExpiryTick = Environment.TickCount64 + 1000; if (!this.srvDebugPreview.IsEmpty()) @@ -273,7 +273,7 @@ internal sealed partial class TextureManager using var srv = default(ComPtr); if (device.Get()->CreateShaderResourceView((ID3D11Resource*)this.tex2D, &srvDesc, srv.GetAddressOf()) .FAILED) - return Service.Get().Empty4X4.ImGuiHandle; + return Service.Get().Empty4X4.Handle; srv.Swap(ref this.srvDebugPreview); return new ImTextureID(this.srvDebugPreview.Get()); diff --git a/Dalamud/Interface/Textures/Internal/TextureManager.Drawer.cs b/Dalamud/Interface/Textures/Internal/TextureManager.Drawer.cs index 41ef761f8..b4573f04f 100644 --- a/Dalamud/Interface/Textures/Internal/TextureManager.Drawer.cs +++ b/Dalamud/Interface/Textures/Internal/TextureManager.Drawer.cs @@ -380,7 +380,7 @@ internal sealed partial class TextureManager ctx->PSSetShader(this.pixelShader, null, 0); var simp = this.sampler.Get(); ctx->PSSetSamplers(0, 1, &simp); - var ppn = (ID3D11ShaderResourceView*)Service.Get().White4X4.ImGuiHandle.Handle; + var ppn = (ID3D11ShaderResourceView*)Service.Get().White4X4.Handle.Handle; ctx->PSSetShaderResources(0, 1, &ppn); ctx->GSSetShader(null, null, 0); diff --git a/Dalamud/Interface/Textures/Internal/TextureManager.FromExistingTexture.cs b/Dalamud/Interface/Textures/Internal/TextureManager.FromExistingTexture.cs index 24358ab1d..07068db5b 100644 --- a/Dalamud/Interface/Textures/Internal/TextureManager.FromExistingTexture.cs +++ b/Dalamud/Interface/Textures/Internal/TextureManager.FromExistingTexture.cs @@ -320,7 +320,7 @@ internal sealed partial class TextureManager { this.wrapToClose = leaveWrapOpen ? null : wrap; - using var unk = new ComPtr((IUnknown*)wrap.ImGuiHandle.Handle); + using var unk = new ComPtr((IUnknown*)wrap.Handle.Handle); using var srvTemp = default(ComPtr); unk.As(&srvTemp).ThrowOnError(); diff --git a/Dalamud/Interface/Textures/TextureWraps/ForwardingTextureWrap.cs b/Dalamud/Interface/Textures/TextureWraps/ForwardingTextureWrap.cs index 8dcbc8cad..342397c5e 100644 --- a/Dalamud/Interface/Textures/TextureWraps/ForwardingTextureWrap.cs +++ b/Dalamud/Interface/Textures/TextureWraps/ForwardingTextureWrap.cs @@ -14,10 +14,10 @@ namespace Dalamud.Interface.Textures.TextureWraps; public abstract class ForwardingTextureWrap : IDalamudTextureWrap { /// - public ImTextureID ImGuiHandle + public ImTextureID Handle { [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => this.GetWrap().ImGuiHandle; + get => this.GetWrap().Handle; } /// @@ -56,7 +56,7 @@ public abstract class ForwardingTextureWrap : IDalamudTextureWrap public virtual unsafe IDalamudTextureWrap CreateWrapSharingLowLevelResource() { // Dalamud specific: IDalamudTextureWrap always points to an ID3D11ShaderResourceView. - var handle = (IUnknown*)this.ImGuiHandle.Handle; + var handle = (IUnknown*)this.Handle.Handle; return new UnknownTextureWrap(handle, this.Width, this.Height, true); } diff --git a/Dalamud/Interface/Textures/TextureWraps/IDalamudTextureWrap.cs b/Dalamud/Interface/Textures/TextureWraps/IDalamudTextureWrap.cs index d57851de0..f58c167ed 100644 --- a/Dalamud/Interface/Textures/TextureWraps/IDalamudTextureWrap.cs +++ b/Dalamud/Interface/Textures/TextureWraps/IDalamudTextureWrap.cs @@ -2,6 +2,7 @@ using System.Numerics; using Dalamud.Bindings.ImGui; using Dalamud.Interface.Textures.TextureWraps.Internal; +using Dalamud.Utility; using TerraFX.Interop.Windows; @@ -16,7 +17,11 @@ namespace Dalamud.Interface.Textures.TextureWraps; public interface IDalamudTextureWrap : IDisposable { /// Gets a texture handle suitable for direct use with ImGui functions. - ImTextureID ImGuiHandle { get; } + ImTextureID Handle { get; } + + /// Gets a texture handle suitable for direct use with ImGui functions. + [ImGuiBindingsToDo("Remove.")] + IntPtr ImGuiHandle => new((long)this.Handle.Handle); /// Gets the width of the texture. int Width { get; } @@ -46,7 +51,7 @@ public interface IDalamudTextureWrap : IDisposable unsafe IDalamudTextureWrap CreateWrapSharingLowLevelResource() { // Dalamud specific: IDalamudTextureWrap always points to an ID3D11ShaderResourceView. - var handle = (IUnknown*)this.ImGuiHandle.Handle; + var handle = (IUnknown*)this.Handle.Handle; return new UnknownTextureWrap(handle, this.Width, this.Height, true); } } diff --git a/Dalamud/Interface/Textures/TextureWraps/Internal/UnknownTextureWrap.cs b/Dalamud/Interface/Textures/TextureWraps/Internal/UnknownTextureWrap.cs index 69117bb29..f5b96870a 100644 --- a/Dalamud/Interface/Textures/TextureWraps/Internal/UnknownTextureWrap.cs +++ b/Dalamud/Interface/Textures/TextureWraps/Internal/UnknownTextureWrap.cs @@ -34,7 +34,7 @@ internal sealed unsafe class UnknownTextureWrap : IDalamudTextureWrap, IDeferred ~UnknownTextureWrap() => this.Dispose(false); /// - public ImTextureID ImGuiHandle => + public ImTextureID Handle => this.imGuiHandle == nint.Zero ? throw new ObjectDisposedException(nameof(UnknownTextureWrap)) : new ImTextureID(this.imGuiHandle); diff --git a/Dalamud/Interface/Textures/TextureWraps/Internal/ViewportTextureWrap.cs b/Dalamud/Interface/Textures/TextureWraps/Internal/ViewportTextureWrap.cs index 946549d52..2247fc781 100644 --- a/Dalamud/Interface/Textures/TextureWraps/Internal/ViewportTextureWrap.cs +++ b/Dalamud/Interface/Textures/TextureWraps/Internal/ViewportTextureWrap.cs @@ -51,12 +51,12 @@ internal sealed class ViewportTextureWrap : IDalamudTextureWrap, IDeferredDispos ~ViewportTextureWrap() => this.Dispose(false); /// - public unsafe ImTextureID ImGuiHandle + public unsafe ImTextureID Handle { get { var t = (nint)this.srv.Get(); - return t == nint.Zero ? Service.Get().Empty4X4.ImGuiHandle : ImTextureID.Null; + return t == nint.Zero ? Service.Get().Empty4X4.Handle : ImTextureID.Null; } } diff --git a/Dalamud/Interface/Utility/Internal/DevTextureSaveMenu.cs b/Dalamud/Interface/Utility/Internal/DevTextureSaveMenu.cs index 95143e099..3318c870f 100644 --- a/Dalamud/Interface/Utility/Internal/DevTextureSaveMenu.cs +++ b/Dalamud/Interface/Utility/Internal/DevTextureSaveMenu.cs @@ -94,7 +94,7 @@ internal sealed class DevTextureSaveMenu : IInternalDisposableService size *= previewImageWidth / size.X; if (size.Y > previewImageWidth) size *= previewImageWidth / size.Y; - ImGui.Image(textureWrap.ImGuiHandle, size); + ImGui.Image(textureWrap.Handle, size); if (tcs.Task.IsCompleted) ImGui.CloseCurrentPopup();