Interface ISpriteExtractorService
The service used to retrieve sprite data from a texture atlas.
Namespace: Gorgon.Editor.Services
Assembly: Gorgon.Editor.API.dll
Syntax
public interface ISpriteExtractorService
Remarks
Developers can use this to extract sprite information using a fixed size grid to retrieve texture coordinates from a texture passed to the service.
Methods
| Edit this page View SourceExtractSprites(SpriteExtractionData, IGorgonImage, Action<ProgressData>, CancellationToken)
Function to retrieve the sprites from the texture atlas.
Declaration
IReadOnlyList<GorgonSprite> ExtractSprites(SpriteExtractionData data, IGorgonImage imageData, Action<ProgressData> progressCallback, CancellationToken cancelToken)
Parameters
Type | Name | Description |
---|---|---|
SpriteExtractionData | data | The data used to extract the sprites. |
IGorgonImage | imageData | The system memory version of the texture. |
Action<ProgressData> | progressCallback | A callback method used to report on progress of the operation. |
CancellationToken | cancelToken | The token used to cancel the operation. |
Returns
Type | Description |
---|---|
IReadOnlyList<GorgonSprite> | A list of sprites generated by this method. |
GetSpriteTextureImageDataAsync(SpriteExtractionData)
Function to retrieve the image data for a sprite texture as a 32 bit RGBA pixel data.
Declaration
Task<IGorgonImage> GetSpriteTextureImageDataAsync(SpriteExtractionData data)
Parameters
Type | Name | Description |
---|---|---|
SpriteExtractionData | data | The data used for sprite extraction. |
Returns
Type | Description |
---|---|
Task<IGorgonImage> | The image data for the texture. |
SaveSprites(string, string, IEnumerable<GorgonSprite>, IContentFile)
Function to save the sprites to the file system.
Declaration
void SaveSprites(string path, string baseFileName, IEnumerable<GorgonSprite> sprites, IContentFile textureFile)
Parameters
Type | Name | Description |
---|---|---|
string | path | The path to save the sprites into. |
string | baseFileName | The base file name. |
IEnumerable<GorgonSprite> | sprites | The sprites to save. |
IContentFile | textureFile | The texture file associated with the sprites. |