Interface ITextureProvider
Service that grants you access to textures you may render via ImGui.
Assembly: Dalamud.dll
View Source
public interface ITextureProvider
Methods
CreateEmpty(RawImageSpecification, bool, bool, string?)
Creates an empty texture.
View Source
IDalamudTextureWrap CreateEmpty(RawImageSpecification specs, bool cpuRead, bool cpuWrite, string? debugName = null)
Returns
Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap: A new empty texture.
Parameters
Type | Name | Description |
---|---|---|
Dalamud.Interface.Textures.RawImageSpecification | specs | Texture specifications. |
System.Boolean | cpuRead | Whether to support reading from CPU, while disabling reading from GPU. |
System.Boolean | cpuWrite | Whether to support writing from CPU, while disabling writing from GPU. |
System.String | debugName | Name for debug display purposes. |
CreateFromExistingTextureAsync(IDalamudTextureWrap, TextureModificationArgs, bool, string?, CancellationToken)
Creates a texture from the given existing texture, cropping and converting pixel format as needed.
View Source
Task<IDalamudTextureWrap> CreateFromExistingTextureAsync(IDalamudTextureWrap wrap, TextureModificationArgs args = default, bool leaveWrapOpen = false, string? debugName = null, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task<Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap>
: A System.Threading.Tasks.Task%601
containing the copied texture on success. Dispose after use.
Parameters
Type | Name | Description |
---|---|---|
Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap | wrap | The source texture wrap. The passed value may be disposed once this function returns, |
without having to wait for the completion of the returned `System.Threading.Tasks.Task%601`. |
| Dalamud.Interface.Textures.TextureModificationArgs | args | The texture modification arguments. |
| System.Boolean
| leaveWrapOpen | Whether to leave <code class="paramref">wrap</code> non-disposed when the returned
System.Threading.Tasks.Task%601
completes. |
| System.String
| debugName | Name for debug display purposes. |
| System.Threading.CancellationToken
| cancellationToken | The cancellation token. |
CreateFromImGuiViewportAsync(ImGuiViewportTextureArgs, string?, CancellationToken)
Creates a texture from an ImGui viewport.
View Source
Task<IDalamudTextureWrap> CreateFromImGuiViewportAsync(ImGuiViewportTextureArgs args, string? debugName = null, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task<Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap>
: A System.Threading.Tasks.Task%601
containing the copied texture on success. Dispose after use.
Parameters
Type | Name | Description |
---|---|---|
Dalamud.Interface.Textures.ImGuiViewportTextureArgs | args | The arguments for creating a texture. |
System.String | debugName | Name for debug display purposes. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
CreateFromImageAsync(ReadOnlyMemory<byte>, string?, CancellationToken)
Gets a texture from the given bytes, trying to interpret it as a .tex file or other well-known image files, such as .png.
View Source
Task<IDalamudTextureWrap> CreateFromImageAsync(ReadOnlyMemory<byte> bytes, string? debugName = null, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task<Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap>
: A System.Threading.Tasks.Task%601
containing the loaded texture on success. Dispose after use.
Parameters
Type | Name | Description |
---|---|---|
System.ReadOnlyMemory<System.Byte> | bytes | The bytes to load. |
System.String | debugName | Name for debug display purposes. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
CreateFromImageAsync(Stream, bool, string?, CancellationToken)
Gets a texture from the given stream, trying to interpret it as a .tex file or other well-known image files, such as .png.
View Source
Task<IDalamudTextureWrap> CreateFromImageAsync(Stream stream, bool leaveOpen = false, string? debugName = null, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task<Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap>
: A System.Threading.Tasks.Task%601
containing the loaded texture on success. Dispose after use.
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream to load data from. |
System.Boolean | leaveOpen | Whether to leave the stream open once the task completes, sucessfully or not. |
System.String | debugName | Name for debug display purposes. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
CreateFromRaw(RawImageSpecification, ReadOnlySpan<byte>, string?)
Gets a texture from the given bytes, interpreting it as a raw bitmap.
View Source
IDalamudTextureWrap CreateFromRaw(RawImageSpecification specs, ReadOnlySpan<byte> bytes, string? debugName = null)
Returns
Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap: The texture loaded from the supplied raw bitmap. Dispose after use.
Parameters
Type | Name | Description |
---|---|---|
Dalamud.Interface.Textures.RawImageSpecification | specs | The specifications for the raw bitmap. |
System.ReadOnlySpan<System.Byte> | bytes | The bytes to load. |
System.String | debugName | Name for debug display purposes. |
CreateFromRawAsync(RawImageSpecification, ReadOnlyMemory<byte>, string?, CancellationToken)
Gets a texture from the given bytes, interpreting it as a raw bitmap.
View Source
Task<IDalamudTextureWrap> CreateFromRawAsync(RawImageSpecification specs, ReadOnlyMemory<byte> bytes, string? debugName = null, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task<Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap>
: A System.Threading.Tasks.Task%601
containing the loaded texture on success. Dispose after use.
Parameters
Type | Name | Description |
---|---|---|
Dalamud.Interface.Textures.RawImageSpecification | specs | The specifications for the raw bitmap. |
System.ReadOnlyMemory<System.Byte> | bytes | The bytes to load. |
System.String | debugName | Name for debug display purposes. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
CreateFromRawAsync(RawImageSpecification, Stream, bool, string?, CancellationToken)
Gets a texture from the given stream, interpreting the read data as a raw bitmap.
View Source
Task<IDalamudTextureWrap> CreateFromRawAsync(RawImageSpecification specs, Stream stream, bool leaveOpen = false, string? debugName = null, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task<Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap>
: A System.Threading.Tasks.Task%601
containing the loaded texture on success. Dispose after use.
Parameters
Type | Name | Description |
---|---|---|
Dalamud.Interface.Textures.RawImageSpecification | specs | The specifications for the raw bitmap. |
System.IO.Stream | stream | The stream to load data from. |
System.Boolean | leaveOpen | Whether to leave the stream open once the task completes, sucessfully or not. |
System.String | debugName | Name for debug display purposes. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
CreateFromTexFile(TexFile)
Get a texture handle for the specified Lumina Lumina.Data.Files.TexFile
.
Alias for fetching System.Threading.Tasks.Task%601.Result
from Dalamud.Plugin.Services.ITextureProvider.CreateFromTexFileAsync(Lumina.Data.Files.TexFile%2cSystem.String%2cSystem.Threading.CancellationToken)
.
View Source
IDalamudTextureWrap CreateFromTexFile(TexFile file)
Returns
Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap: A texture wrap that can be used to render the texture. Dispose after use.
Parameters
Type | Name | Description |
---|---|---|
Lumina.Data.Files.TexFile | file | The texture to obtain a handle to. |
CreateFromTexFileAsync(TexFile, string?, CancellationToken)
Get a texture handle for the specified Lumina Lumina.Data.Files.TexFile
.
View Source
Task<IDalamudTextureWrap> CreateFromTexFileAsync(TexFile file, string? debugName = null, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task<Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap>
: A texture wrap that can be used to render the texture. Dispose after use.
Parameters
Type | Name | Description |
---|---|---|
Lumina.Data.Files.TexFile | file | The texture to obtain a handle to. |
System.String | debugName | Name for debug display purposes. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
GetSupportedImageDecoderInfos()
Gets the supported bitmap decoders.
View Source
IEnumerable<IBitmapCodecInfo> GetSupportedImageDecoderInfos()
Returns
System.Collections.Generic.IEnumerable<Dalamud.Interface.Textures.IBitmapCodecInfo>
: The supported bitmap decoders.### GetFromGameIcon(in GameIconLookup)
Gets a shared texture corresponding to the given game resource icon specifier.
View Source
ISharedImmediateTexture GetFromGameIcon(in GameIconLookup lookup)
Returns
Dalamud.Interface.Textures.ISharedImmediateTexture: The shared texture that you may use to obtain the loaded texture wrap and load states.
Parameters
Type | Name | Description |
---|---|---|
Dalamud.Interface.Textures.GameIconLookup | lookup | A game icon specifier. |
TryGetFromGameIcon(in GameIconLookup, out ISharedImmediateTexture?)
Gets a shared texture corresponding to the given game resource icon specifier.
View Source
bool TryGetFromGameIcon(in GameIconLookup lookup, out ISharedImmediateTexture? texture)
Returns
System.Boolean
: Whether or not the lookup succeeded.
Parameters
Type | Name | Description |
---|---|---|
Dalamud.Interface.Textures.GameIconLookup | lookup | A game icon specifier. |
Dalamud.Interface.Textures.ISharedImmediateTexture | texture | The resulting Dalamud.Interface.Textures.ISharedImmediateTexture. |
GetFromGame(string)
Gets a shared texture corresponding to the given path to a game resource.
View Source
ISharedImmediateTexture GetFromGame(string path)
Returns
Dalamud.Interface.Textures.ISharedImmediateTexture: The shared texture that you may use to obtain the loaded texture wrap and load states.
Parameters
Type | Name | Description |
---|---|---|
System.String | path | A path to a game resource. |
GetFromFile(string)
Gets a shared texture corresponding to the given file on the filesystem.
View Source
ISharedImmediateTexture GetFromFile(string path)
Returns
Dalamud.Interface.Textures.ISharedImmediateTexture: The shared texture that you may use to obtain the loaded texture wrap and load states.
Parameters
Type | Name | Description |
---|---|---|
System.String | path | A path to a file on the filesystem. |
GetFromFile(FileInfo)
Gets a shared texture corresponding to the given file on the filesystem.
View Source
ISharedImmediateTexture GetFromFile(FileInfo file)
Returns
Dalamud.Interface.Textures.ISharedImmediateTexture: The shared texture that you may use to obtain the loaded texture wrap and load states.
Parameters
Type | Name | Description |
---|---|---|
System.IO.FileInfo | file | The file on the filesystem to load. |
GetFromFileAbsolute(string)
Gets a shared texture corresponding to the given file on the filesystem.
View Source
ISharedImmediateTexture GetFromFileAbsolute(string fullPath)
Returns
Dalamud.Interface.Textures.ISharedImmediateTexture: The shared texture that you may use to obtain the loaded texture wrap and load states.
Parameters
Type | Name | Description |
---|---|---|
System.String | fullPath | The file on the filesystem to load. Requires a full path. |
GetFromManifestResource(Assembly, string)
Gets a shared texture corresponding to the given file of the assembly manifest resources.
View Source
ISharedImmediateTexture GetFromManifestResource(Assembly assembly, string name)
Returns
Dalamud.Interface.Textures.ISharedImmediateTexture: The shared texture that you may use to obtain the loaded texture wrap and load states.
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.Assembly | assembly | The assembly containing manifest resources. |
System.String | name | The case-sensitive name of the manifest resource being requested. |
GetIconPath(in GameIconLookup)
Get a path for a specific icon's .tex file.
View Source
string GetIconPath(in GameIconLookup lookup)
Returns
System.String
: The path to the icon.
Parameters
Type | Name | Description |
---|---|---|
Dalamud.Interface.Textures.GameIconLookup | lookup | The icon lookup. |
Exceptions
System.IO.FileNotFoundException
If a corresponding file could not be found.
TryGetIconPath(in GameIconLookup, out string?)
Gets the path of an icon.
View Source
bool TryGetIconPath(in GameIconLookup lookup, out string? path)
Returns
System.Boolean
: true
if the corresponding file exists and <code class="paramref">path</code> has been set.
Parameters
Type | Name | Description |
---|---|---|
Dalamud.Interface.Textures.GameIconLookup | lookup | The icon lookup. |
System.String | path | The resolved path. |
IsDxgiFormatSupported(int)
Determines whether the system supports the given DXGI format. For use with Dalamud.Interface.Textures.RawImageSpecification.DxgiFormat.
View Source
bool IsDxgiFormatSupported(int dxgiFormat)
Returns
System.Boolean
: true
if supported.
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dxgiFormat | The DXGI format. |
IsDxgiFormatSupportedForCreateFromExistingTextureAsync(int)
Determines whether the system supports the given DXGI format for use with
Dalamud.Plugin.Services.ITextureProvider.CreateFromExistingTextureAsync(Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap%2cDalamud.Interface.Textures.TextureModificationArgs%2cSystem.Boolean%2cSystem.String%2cSystem.Threading.CancellationToken)
.
View Source
bool IsDxgiFormatSupportedForCreateFromExistingTextureAsync(int dxgiFormat)
Returns
System.Boolean
: true
if supported.
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dxgiFormat | The DXGI format. |
ConvertToKernelTexture(IDalamudTextureWrap, bool)
Converts an existing Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap instance to a new instance of
FFXIVClientStructs.FFXIV.Client.Graphics.Kernel.Texture
which can be used to supply a custom
texture onto an in-game addon (UI element.)
View Source
nint ConvertToKernelTexture(IDalamudTextureWrap wrap, bool leaveWrapOpen = false)
Returns
System.IntPtr
: Address of the new FFXIVClientStructs.FFXIV.Client.Graphics.Kernel.Texture
.
Parameters
Type | Name | Description |
---|---|---|
Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap | wrap | Instance of Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap to convert. |
System.Boolean | leaveWrapOpen | Whether to leave <code class="paramref">wrap</code> non-disposed when the returned |
`System.Threading.Tasks.Task%601` completes. |