Gorgon
Show / Hide Table of Contents

Interface IGorgonAnimationCodec

An interface used to serialize or deserialize a IGorgonAnimation.

Inherited Members
IGorgonNamedObject.Name
Namespace: Gorgon.IO
Assembly: Gorgon.IO.Gorgon2D.dll
Syntax
public interface IGorgonAnimationCodec : IGorgonNamedObject

Properties

| Edit this page View Source

CanDecode

Property to return whether or not the codec can decode animation data.

Declaration
bool CanDecode { get; }
Property Value
Type Description
bool
See Also
IGorgonAnimation
| Edit this page View Source

CanEncode

Property to return whether or not the codec can encode animation data.

Declaration
bool CanEncode { get; }
Property Value
Type Description
bool
See Also
IGorgonAnimation
| Edit this page View Source

Codec

Property to return the abbreviated name of the codec (e.g. PNG).

Declaration
string Codec { get; }
Property Value
Type Description
string
See Also
IGorgonAnimation
| Edit this page View Source

CodecDescription

Property to return the friendly description of the format.

Declaration
string CodecDescription { get; }
Property Value
Type Description
string
See Also
IGorgonAnimation
| Edit this page View Source

FileExtensions

Property to return the common file extensions for an animation.

Declaration
IReadOnlyList<GorgonFileExtension> FileExtensions { get; }
Property Value
Type Description
IReadOnlyList<GorgonFileExtension>
See Also
IGorgonAnimation
| Edit this page View Source

Renderer

Property to return the renderer used to create objects.

Declaration
Gorgon2D Renderer { get; }
Property Value
Type Description
Gorgon2D
See Also
IGorgonAnimation
| Edit this page View Source

Version

Property to return the version of animation data that the codec supports.

Declaration
Version Version { get; }
Property Value
Type Description
Version
See Also
IGorgonAnimation

Methods

| Edit this page View Source

FromFile(string, string, IEnumerable<GorgonTexture2DView>)

Function to read the animation data from a file on the physical file system.

Declaration
IGorgonAnimation FromFile(string filePath, string name = null, IEnumerable<GorgonTexture2DView> textureOverrides = null)
Parameters
Type Name Description
string filePath

The path to the file to read.

string name

[Optional] The name of the animation.

IEnumerable<GorgonTexture2DView> textureOverrides

[Optional] Textures to use in a texture animation track.

Returns
Type Description
IGorgonAnimation

A new IGorgonAnimation.

Remarks

When passing in a list of textureOverrides, the texture names should match the expected texture names in the key frame. For example, if the TextureName is "WalkingFrames", then the Name should also be "WalkingFrames".

See Also
IGorgonAnimation
| Edit this page View Source

FromStream(Stream, int?, string, IEnumerable<GorgonTexture2DView>)

Function to read the animation data from a stream.

Declaration
IGorgonAnimation FromStream(Stream stream, int? byteCount = null, string name = null, IEnumerable<GorgonTexture2DView> textureOverrides = null)
Parameters
Type Name Description
Stream stream

The stream containing the animation.

int? byteCount

[Optional] The number of bytes to read from the stream.

string name

[Optional] The name of the animation.

IEnumerable<GorgonTexture2DView> textureOverrides

[Optional] Textures to use in a texture animation track.

Returns
Type Description
IGorgonAnimation

A new IGorgonAnimation.

Remarks

When passing in a list of textureOverrides, the texture names should match the expected texture names in the key frame. For example, if the TextureName is "WalkingFrames", then the Name should also be "WalkingFrames".

See Also
IGorgonAnimation
| Edit this page View Source

GetAssociatedTextureNames(Stream)

Function to retrieve the names of the textures associated with the animation.

Declaration
IReadOnlyList<string> GetAssociatedTextureNames(Stream stream)
Parameters
Type Name Description
Stream stream

The stream containing the texture data.

Returns
Type Description
IReadOnlyList<string>

The names of the texture associated with the animations, or an empty list if no textures were found.

See Also
IGorgonAnimation
| Edit this page View Source

IsReadable(Stream)

Function to determine if the data in a stream is readable by this codec.

Declaration
bool IsReadable(Stream stream)
Parameters
Type Name Description
Stream stream

The stream containing the data.

Returns
Type Description
bool

true if the data can be read, or false if not.

Exceptions
Type Condition
ArgumentNullException

Thrown when the stream parameter is null.

GorgonException

Thrown if the stream is write only.

EndOfStreamException

Thrown if the current stream position, plus the size of the data exceeds the length of the stream.

NotSupportedException

This method is not supported by this codec.

See Also
IGorgonAnimation
| Edit this page View Source

Save(IGorgonAnimation, Stream)

Function to save the animation data to a stream.

Declaration
void Save(IGorgonAnimation animation, Stream stream)
Parameters
Type Name Description
IGorgonAnimation animation

The animation to serialize into the stream.

Stream stream

The stream that will contain the animation.

Exceptions
Type Condition
ArgumentNullException

Thrown when the animation, or the stream parameter is null.

GorgonException

Thrown if the stream is read only.

NotSupportedException

This method is not supported by this codec.

See Also
IGorgonAnimation
| Edit this page View Source

Save(IGorgonAnimation, string)

Function to save the animation data to a file on a physical file system.

Declaration
void Save(IGorgonAnimation animation, string filePath)
Parameters
Type Name Description
IGorgonAnimation animation

The animation to serialize into the file.

string filePath

The path to the file to write.

Exceptions
Type Condition
ArgumentNullException

Thrown when the filePath parameter is null.

ArgumentEmptyException

Thrown when the filePath parameter is empty.

NotSupportedException

This method is not supported by this codec.

See Also
IGorgonAnimation

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)

See Also

IGorgonAnimation
  • 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