Add state fetchers

This commit is contained in:
Soreepeong 2024-02-22 03:32:13 +09:00
parent eb4d9aba7e
commit 5eadfc1b4d
7 changed files with 72 additions and 20 deletions

View file

@ -1,20 +0,0 @@
using System.Diagnostics.CodeAnalysis;
namespace Dalamud.Plugin.Services;
/// <summary>
/// Represents a lookup for a game icon.
/// </summary>
/// <param name="IconId">The icon ID.</param>
/// <param name="ItemHq">Whether the HQ icon is requested, where HQ is in the context of items.</param>
/// <param name="HiRes">Whether the high-resolution icon is requested.</param>
/// <param name="Language">The language of the icon to load.</param>
[SuppressMessage(
"StyleCop.CSharp.NamingRules",
"SA1313:Parameter names should begin with lower-case letter",
Justification = "no")]
public record struct GameIconLookup(
uint IconId,
bool ItemHq = false,
bool HiRes = true,
ClientLanguage? Language = null);

View file

@ -1,5 +1,6 @@
using System.IO;
using Dalamud.Interface;
using Dalamud.Interface.Internal;
using Dalamud.Utility;

View file

@ -13,6 +13,24 @@ namespace Dalamud.Plugin.Services;
/// </summary>
public partial interface ITextureProvider
{
/// <summary>Gets the state of the background load task for <see cref="ImmediateGetFromGameIcon"/>.</summary>
/// <param name="lookup">The icon specifier.</param>
/// <param name="exception">The exception, if failed.</param>
/// <returns><c>true</c> if loaded; <c>false</c> if not fully loaded or failed.</returns>
public bool ImmediateGetStateFromGameIcon(in GameIconLookup lookup, out Exception? exception);
/// <summary>Gets the state of the background load task for <see cref="ImmediateGetFromGameIcon"/>.</summary>
/// <param name="path">The game-internal path to a .tex, .atex, or an image file such as .png.</param>
/// <param name="exception">The exception, if failed.</param>
/// <returns><c>true</c> if loaded; <c>false</c> if not fully loaded or failed.</returns>
public bool ImmediateGetStateFromGame(string path, out Exception? exception);
/// <summary>Gets the state of the background load task for <see cref="ImmediateGetFromGameIcon"/>.</summary>
/// <param name="file">The filesystem path to a .tex, .atex, or an image file such as .png.</param>
/// <param name="exception">The exception, if failed.</param>
/// <returns><c>true</c> if loaded; <c>false</c> if not fully loaded or failed.</returns>
public bool ImmediateGetStateFromFile(string file, out Exception? exception);
/// <summary>Gets the corresponding game icon for use with the current frame.</summary>
/// <param name="lookup">The icon specifier.</param>
/// <returns>An instance of <see cref="IDalamudTextureWrap"/> that is guaranteed to be available for the current