Interface ITextureReadbackProvider
Service that grants you to read instances of Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap.
Assembly: Dalamud.dll
public interface ITextureReadbackProvider : IDalamudService
Methods
GetRawImageAsync(IDalamudTextureWrap, TextureModificationArgs, bool, CancellationToken)
Gets the raw data of a texture wrap.
Task<(RawImageSpecification Specification, byte[] RawData)> GetRawImageAsync(IDalamudTextureWrap wrap, TextureModificationArgs args = default, bool leaveWrapOpen = false, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task<System.ValueTuple<Dalamud.Interface.Textures.RawImageSpecification,System.Byte[]>>: The raw data and its specifications.
Parameters
| Type | Name | Description |
|---|---|---|
| Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap | wrap | The source texture wrap. |
| 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`1` completes. |
| System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Remarks
<p>The length of the returned RawData may not match
Dalamud.Interface.Textures.RawImageSpecification.Height * Dalamud.Interface.Textures.RawImageSpecification.Pitch.</p>
<p>Dalamud.Interface.Textures.RawImageSpecification.Pitch may not be the minimal value required to represent the texture
bitmap data. For example, if a texture is 4x4 B8G8R8A8, the minimal pitch would be 32, but the function may
return 64 instead.</p>
<p>This function may throw an exception.</p>
GetSupportedImageEncoderInfos()
Gets the supported bitmap encoders.
IEnumerable<IBitmapCodecInfo> GetSupportedImageEncoderInfos()
Returns
System.Collections.Generic.IEnumerable<Dalamud.Interface.Textures.IBitmapCodecInfo>: The supported bitmap encoders.
Remarks
The following functions support the files of the container types pointed by yielded values.
<ul>
<li>Dalamud.Plugin.Services.ITextureReadbackProvider.SaveToStreamAsync(Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap,System.Guid,System.IO.Stream,System.Collections.Generic.IReadOnlyDictionary<System.String,System.Object>,System.Boolean,System.Boolean,System.Threading.CancellationToken)</li>
<li>Dalamud.Plugin.Services.ITextureReadbackProvider.SaveToFileAsync(Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap,System.Guid,System.String,System.Collections.Generic.IReadOnlyDictionary<System.String,System.Object>,System.Boolean,System.Threading.CancellationToken)</li>
</ul>
<p>This function may throw an exception.</p>
SaveToStreamAsync(IDalamudTextureWrap, Guid, Stream, IReadOnlyDictionary<string, object>?, bool, bool, CancellationToken)
Saves a texture wrap to a stream in an image file format.
Task SaveToStreamAsync(IDalamudTextureWrap wrap, Guid containerGuid, Stream stream, IReadOnlyDictionary<string, object>? props = null, bool leaveWrapOpen = false, bool leaveStreamOpen = false, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task: A task representing the save process.
Parameters
| Type | Name | Description |
|---|---|---|
| Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap | wrap | The texture wrap to save. |
System.Guid | containerGuid | The container GUID, obtained from Dalamud.Plugin.Services.ITextureReadbackProvider.GetSupportedImageEncoderInfos(). |
System.IO.Stream | stream | The stream to save to. |
System.Collections.Generic.IReadOnlyDictionary<System.String,System.Object> | props | Properties to pass to the encoder. See remarks for valid values. |
System.Boolean | leaveWrapOpen | Whether to leave <code class="paramref">wrap</code> non-disposed when the returned |
`System.Threading.Tasks.Task`1` completes. |
| System.Boolean | leaveStreamOpen | Whether to leave <code class="paramref">stream</code> open when the returned
System.Threading.Tasks.Task1completes. | |System.Threading.CancellationToken` | cancellationToken | The cancellation token. |
Remarks
<p><code class="paramref">wrap</code> must not be disposed until the task finishes.</p> <p>See the following webpages for the valid values for <code class="paramref">props</code> per <code class="paramref">containerGuid</code>.</p> <ul> <li><a href="https://learn.microsoft.com/en-us/windows/win32/wic/native-wic-codecs"> WIC Codecs from Microsoft</a></li> <li><a href="https://learn.microsoft.com/en-us/windows/win32/wic/-wic-creating-encoder#encoder-options"> Image Encoding Overview: Encoder options</a></li> </ul> <p>This function may throw an exception.</p>
SaveToFileAsync(IDalamudTextureWrap, Guid, string, IReadOnlyDictionary<string, object>?, bool, CancellationToken)
Saves a texture wrap to a file as an image file.
Task SaveToFileAsync(IDalamudTextureWrap wrap, Guid containerGuid, string path, IReadOnlyDictionary<string, object>? props = null, bool leaveWrapOpen = false, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task: A task representing the save process.
Parameters
| Type | Name | Description |
|---|---|---|
| Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap | wrap | The texture wrap to save. |
System.Guid | containerGuid | The container GUID, obtained from Dalamud.Plugin.Services.ITextureReadbackProvider.GetSupportedImageEncoderInfos(). |
System.String | path | The target file path. The target file will be overwritten if it exist. |
System.Collections.Generic.IReadOnlyDictionary<System.String,System.Object> | props | Properties to pass to the encoder. See remarks for valid values. |
System.Boolean | leaveWrapOpen | Whether to leave <code class="paramref">wrap</code> non-disposed when the returned |
`System.Threading.Tasks.Task`1` completes. |
| System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Remarks
<p><code class="paramref">wrap</code> must not be disposed until the task finishes.</p> <p>If the target file exists, it will be overwritten only if the save operation is successful.</p> <p>See the following webpages for the valid values for <code class="paramref">props</code> per <code class="paramref">containerGuid</code>.</p> <ul> <li><a href="https://learn.microsoft.com/en-us/windows/win32/wic/native-wic-codecs"> WIC Codecs from Microsoft</a></li> <li><a href="https://learn.microsoft.com/en-us/windows/win32/wic/-wic-creating-encoder#encoder-options"> Image Encoding Overview: Encoder options</a></li> </ul> <p>This function may throw an exception.</p>
CopyToClipboardAsync(IDalamudTextureWrap, string?, bool, CancellationToken)
Copies the texture to clipboard.
Task CopyToClipboardAsync(IDalamudTextureWrap wrap, string? preferredFileNameWithoutExtension = null, bool leaveWrapOpen = false, CancellationToken cancellationToken = default)
Returns
System.Threading.Tasks.Task: A System.Threading.Tasks.Task representing the status of the operation.
Parameters
| Type | Name | Description |
|---|---|---|
| Dalamud.Interface.Textures.TextureWraps.IDalamudTextureWrap | wrap | Texture wrap to copy. |
System.String | preferredFileNameWithoutExtension | Preferred file name. |
System.Boolean | leaveWrapOpen | Whether to leave <code class="paramref">wrap</code> non-disposed when the returned |
`System.Threading.Tasks.Task`1` completes. |
| System.Threading.CancellationToken | cancellationToken | The cancellation token. |