Gorgon
Show / Hide Table of Contents

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 Source

ExtractSprites(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.

| Edit this page View Source

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.

| Edit this page View Source

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.

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author