feat: new ITextureProvider, ITextureSubstitutionProvider, TextureManager services

Ref-counts textures and evicts when not used
This commit is contained in:
goat 2023-08-02 02:35:37 +02:00
parent f69fb6cc03
commit b6cfe33946
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
6 changed files with 635 additions and 18 deletions

View file

@ -1,4 +1,5 @@
using System.Collections.ObjectModel;
using System;
using System.Collections.ObjectModel;
using ImGuiScene;
using Lumina;
@ -91,6 +92,7 @@ public interface IDataManager
/// <param name="iconId">The icon ID.</param>
/// <param name="highResolution">Return high resolution version.</param>
/// <returns>The <see cref="TexFile"/> containing the icon.</returns>
[Obsolete("Use ITextureManager instead")]
public TexFile? GetIcon(uint iconId, bool highResolution = false);
/// <summary>
@ -100,6 +102,7 @@ public interface IDataManager
/// <param name="iconId">The icon ID.</param>
/// <param name="highResolution">Return high resolution version.</param>
/// <returns>The <see cref="TexFile"/> containing the icon.</returns>
[Obsolete("Use ITextureManager instead")]
public TexFile? GetIcon(ClientLanguage iconLanguage, uint iconId, bool highResolution = false);
/// <summary>
@ -109,6 +112,7 @@ public interface IDataManager
/// <param name="iconId">The icon ID.</param>
/// <param name="highResolution">Return high resolution version.</param>
/// <returns>The <see cref="TexFile"/> containing the icon.</returns>
[Obsolete("Use ITextureManager instead")]
public TexFile? GetIcon(string? type, uint iconId, bool highResolution = false);
/// <summary>
@ -117,6 +121,7 @@ public interface IDataManager
/// <param name="iconId">The icon ID.</param>
/// <param name="highResolution">Return the high resolution version.</param>
/// <returns>The <see cref="TextureWrap"/> containing the icon.</returns>
[Obsolete("Use ITextureManager instead")]
public TextureWrap? GetImGuiTextureIcon(uint iconId, bool highResolution = false);
/// <summary>
@ -125,6 +130,7 @@ public interface IDataManager
/// <param name="isHq">A value indicating whether the icon should be HQ.</param>
/// <param name="iconId">The icon ID.</param>
/// <returns>The <see cref="TexFile"/> containing the icon.</returns>
[Obsolete("Use ITextureManager instead")]
public TexFile? GetIcon(bool isHq, uint iconId);
/// <summary>
@ -132,6 +138,7 @@ public interface IDataManager
/// </summary>
/// <param name="iconId">The icon ID.</param>
/// <returns>The <see cref="TexFile"/> containing the icon.</returns>
[Obsolete("Use ITextureManager instead")]
public TexFile? GetHqIcon(uint iconId);
/// <summary>
@ -139,6 +146,7 @@ public interface IDataManager
/// </summary>
/// <param name="tex">The Lumina <see cref="TexFile"/>.</param>
/// <returns>A <see cref="TextureWrap"/> that can be used to draw the texture.</returns>
[Obsolete("Use ITextureManager instead")]
public TextureWrap? GetImGuiTexture(TexFile? tex);
/// <summary>
@ -146,6 +154,7 @@ public interface IDataManager
/// </summary>
/// <param name="path">The internal path to the texture.</param>
/// <returns>A <see cref="TextureWrap"/> that can be used to draw the texture.</returns>
[Obsolete("Use ITextureManager instead")]
public TextureWrap? GetImGuiTexture(string path);
/// <summary>
@ -154,6 +163,7 @@ public interface IDataManager
/// <param name="isHq">A value indicating whether the icon should be HQ.</param>
/// <param name="iconId">The icon ID.</param>
/// <returns>The <see cref="TextureWrap"/> containing the icon.</returns>
[Obsolete("Use ITextureManager instead")]
public TextureWrap? GetImGuiTextureIcon(bool isHq, uint iconId);
/// <summary>
@ -162,6 +172,7 @@ public interface IDataManager
/// <param name="iconLanguage">The requested language.</param>
/// <param name="iconId">The icon ID.</param>
/// <returns>The <see cref="TextureWrap"/> containing the icon.</returns>
[Obsolete("Use ITextureManager instead")]
public TextureWrap? GetImGuiTextureIcon(ClientLanguage iconLanguage, uint iconId);
/// <summary>
@ -170,6 +181,7 @@ public interface IDataManager
/// <param name="type">The type of the icon (e.g. 'hq' to get the HQ variant of an item icon).</param>
/// <param name="iconId">The icon ID.</param>
/// <returns>The <see cref="TextureWrap"/> containing the icon.</returns>
[Obsolete("Use ITextureManager instead")]
public TextureWrap? GetImGuiTextureIcon(string type, uint iconId);
/// <summary>
@ -177,5 +189,6 @@ public interface IDataManager
/// </summary>
/// <param name="iconId">The icon ID.</param>
/// <returns>The <see cref="TextureWrap"/> containing the icon.</returns>
[Obsolete("Use ITextureManager instead")]
public TextureWrap? GetImGuiTextureHqIcon(uint iconId);
}