mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-02 05:43:40 +01:00
feat: add support to load textures from files
This commit is contained in:
parent
8df9821f0e
commit
22a6261c98
4 changed files with 116 additions and 33 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
using Dalamud.Interface.Internal;
|
||||
using Lumina.Data.Files;
|
||||
|
|
@ -58,7 +59,18 @@ public interface ITextureProvider
|
|||
/// <param name="path">The path to the texture in the game's VFS.</param>
|
||||
/// <param name="keepAlive">Prevent Dalamud from automatically unloading this texture to save memory. Usually does not need to be set.</param>
|
||||
/// <returns>Null, if the icon does not exist, or a texture wrap that can be used to render the texture.</returns>
|
||||
public IDalamudTextureWrap? GetTextureFromGamePath(string path, bool keepAlive = false);
|
||||
public IDalamudTextureWrap? GetTextureFromGame(string path, bool keepAlive = false);
|
||||
|
||||
/// <summary>
|
||||
/// Get a texture handle for the image or texture, specified by the passed FileInfo.
|
||||
/// You may only specify paths on the native file system.
|
||||
///
|
||||
/// This API can load .png and .tex files.
|
||||
/// </summary>
|
||||
/// <param name="file">The FileInfo describing the image or texture file.</param>
|
||||
/// <param name="keepAlive">Prevent Dalamud from automatically unloading this texture to save memory. Usually does not need to be set.</param>
|
||||
/// <returns>Null, if the file does not exist, or a texture wrap that can be used to render the texture.</returns>
|
||||
public IDalamudTextureWrap? GetTextureFromFile(FileInfo file, bool keepAlive = false);
|
||||
|
||||
/// <summary>
|
||||
/// Get a texture handle for the specified Lumina TexFile.
|
||||
|
|
|
|||
|
|
@ -7,15 +7,14 @@ public interface ITextureSubstitutionProvider
|
|||
{
|
||||
/// <summary>
|
||||
/// Delegate describing a function that may be used to intercept and replace texture data.
|
||||
/// The path assigned may point to another texture inside the game's dats, or a .tex file or image on the disk.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the texture that is to be loaded.</param>
|
||||
/// <param name="data">The texture data. Null by default, assign something if you wish to replace the data from the game dats.</param>
|
||||
public delegate void TextureDataInterceptorDelegate(string path, ref byte[]? data);
|
||||
|
||||
/// <param name="replacementPath">The path that should be loaded instead.</param>
|
||||
public delegate void TextureDataInterceptorDelegate(string path, ref string? replacementPath);
|
||||
|
||||
/// <summary>
|
||||
/// Event that will be called once Dalamud wants to load texture data.
|
||||
/// If you have data that should replace the data from the game dats, assign it to the
|
||||
/// data argument.
|
||||
/// </summary>
|
||||
public event TextureDataInterceptorDelegate? InterceptTexDataLoad;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue