mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-18 05:47:43 +01:00
Merge branch 'apiX' into feature/itextureprovider-updates
This commit is contained in:
commit
8c7771bf7d
2213 changed files with 10372 additions and 1088868 deletions
21
Dalamud/Interface/Textures/DalamudTextureWrapExtensions.cs
Normal file
21
Dalamud/Interface/Textures/DalamudTextureWrapExtensions.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using Dalamud.Interface.Internal;
|
||||
|
||||
namespace Dalamud.Interface.Textures;
|
||||
|
||||
/// <summary>Extension methods for <see cref="IDalamudTextureWrap"/>.</summary>
|
||||
public static class DalamudTextureWrapExtensions
|
||||
{
|
||||
/// <summary>Checks if two instances of <see cref="IDalamudTextureWrap"/> point to a same underlying resource.
|
||||
/// </summary>
|
||||
/// <param name="a">The resource 1.</param>
|
||||
/// <param name="b">The resource 2.</param>
|
||||
/// <returns><c>true</c> if both instances point to a same underlying resource.</returns>
|
||||
public static bool ResourceEquals(this IDalamudTextureWrap? a, IDalamudTextureWrap? b)
|
||||
{
|
||||
if (a is null != b is null)
|
||||
return false;
|
||||
if (a is null)
|
||||
return false;
|
||||
return a.ImGuiHandle == b.ImGuiHandle;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
using System.IO;
|
||||
|
||||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Utility;
|
||||
|
||||
namespace Dalamud.Interface.Textures.Internal;
|
||||
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
|
||||
/// <summary>Service responsible for loading and disposing ImGui texture wraps.</summary>
|
||||
internal sealed partial class TextureManager
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
[Api10ToDo(Api10ToDoAttribute.DeleteCompatBehavior)]
|
||||
[Obsolete("See interface definition.")]
|
||||
string? ITextureProvider.GetIconPath(uint iconId, ITextureProvider.IconFlags flags, ClientLanguage? language)
|
||||
=> this.TryGetIconPath(
|
||||
new(
|
||||
iconId,
|
||||
(flags & ITextureProvider.IconFlags.ItemHighQuality) != 0,
|
||||
(flags & ITextureProvider.IconFlags.HiRes) != 0,
|
||||
language),
|
||||
out var path)
|
||||
? path
|
||||
: null;
|
||||
|
||||
/// <inheritdoc/>
|
||||
[Api10ToDo(Api10ToDoAttribute.DeleteCompatBehavior)]
|
||||
[Obsolete("See interface definition.")]
|
||||
IDalamudTextureWrap? ITextureProvider.GetIcon(
|
||||
uint iconId,
|
||||
ITextureProvider.IconFlags flags,
|
||||
ClientLanguage? language,
|
||||
bool keepAlive) =>
|
||||
this.Shared.GetFromGameIcon(
|
||||
new(
|
||||
iconId,
|
||||
(flags & ITextureProvider.IconFlags.ItemHighQuality) != 0,
|
||||
(flags & ITextureProvider.IconFlags.HiRes) != 0,
|
||||
language))
|
||||
.GetAvailableOnAccessWrapForApi9();
|
||||
|
||||
/// <inheritdoc/>
|
||||
[Api10ToDo(Api10ToDoAttribute.DeleteCompatBehavior)]
|
||||
[Obsolete("See interface definition.")]
|
||||
IDalamudTextureWrap? ITextureProvider.GetTextureFromGame(string path, bool keepAlive) =>
|
||||
this.Shared.GetFromGame(path).GetAvailableOnAccessWrapForApi9();
|
||||
|
||||
/// <inheritdoc/>
|
||||
[Api10ToDo(Api10ToDoAttribute.DeleteCompatBehavior)]
|
||||
[Obsolete("See interface definition.")]
|
||||
IDalamudTextureWrap? ITextureProvider.GetTextureFromFile(FileInfo file, bool keepAlive) =>
|
||||
this.Shared.GetFromFile(file.FullName).GetAvailableOnAccessWrapForApi9();
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
using System.IO;
|
||||
|
||||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Utility;
|
||||
|
||||
namespace Dalamud.Interface.Textures.Internal;
|
||||
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
|
||||
/// <summary>Plugin-scoped version of <see cref="TextureManager"/>.</summary>
|
||||
internal sealed partial class TextureManagerPluginScoped
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
[Api10ToDo(Api10ToDoAttribute.DeleteCompatBehavior)]
|
||||
[Obsolete("See interface definition.")]
|
||||
string? ITextureProvider.GetIconPath(uint iconId, ITextureProvider.IconFlags flags, ClientLanguage? language)
|
||||
=> this.TryGetIconPath(
|
||||
new(
|
||||
iconId,
|
||||
(flags & ITextureProvider.IconFlags.ItemHighQuality) != 0,
|
||||
(flags & ITextureProvider.IconFlags.HiRes) != 0,
|
||||
language),
|
||||
out var path)
|
||||
? path
|
||||
: null;
|
||||
|
||||
/// <inheritdoc/>
|
||||
[Api10ToDo(Api10ToDoAttribute.DeleteCompatBehavior)]
|
||||
[Obsolete("See interface definition.")]
|
||||
IDalamudTextureWrap? ITextureProvider.GetIcon(
|
||||
uint iconId,
|
||||
ITextureProvider.IconFlags flags,
|
||||
ClientLanguage? language,
|
||||
bool keepAlive) =>
|
||||
this.ManagerOrThrow.Shared.GetFromGameIcon(
|
||||
new(
|
||||
iconId,
|
||||
(flags & ITextureProvider.IconFlags.ItemHighQuality) != 0,
|
||||
(flags & ITextureProvider.IconFlags.HiRes) != 0,
|
||||
language))
|
||||
.GetAvailableOnAccessWrapForApi9();
|
||||
|
||||
/// <inheritdoc/>
|
||||
[Api10ToDo(Api10ToDoAttribute.DeleteCompatBehavior)]
|
||||
[Obsolete("See interface definition.")]
|
||||
IDalamudTextureWrap? ITextureProvider.GetTextureFromGame(string path, bool keepAlive) =>
|
||||
this.ManagerOrThrow.Shared.GetFromGame(path).GetAvailableOnAccessWrapForApi9();
|
||||
|
||||
/// <inheritdoc/>
|
||||
[Api10ToDo(Api10ToDoAttribute.DeleteCompatBehavior)]
|
||||
[Obsolete("See interface definition.")]
|
||||
IDalamudTextureWrap? ITextureProvider.GetTextureFromFile(FileInfo file, bool keepAlive) =>
|
||||
this.ManagerOrThrow.Shared.GetFromFile(file.FullName).GetAvailableOnAccessWrapForApi9();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue