Class GorgonCodecTga
A codec to handle reading/writing Truevision TGA files.
Inheritance
Inherited Members
Namespace: Gorgon.Graphics.Imaging.Codecs
Assembly: Gorgon.Graphics.Imaging.dll
Syntax
public sealed class GorgonCodecTga : GorgonImageCodec<IGorgonImageCodecEncodingOptions, GorgonTgaDecodingOptions>, IGorgonImageCodec, IGorgonNamedObject
Remarks
This codec will read RLE compressed and uncompressed files, and write compressed files using the Truevision Targa (TGA) format.
Most 16/24/32 bit TGA files will be readable using this codec, however the following limitations may keep the file from being decoded by this codec:
- No color map support.
- Interleaved files are not supported.
- Supports the following formats: 8 bit grayscale, 16, 24 and 32 bits per pixel images.
Constructors
| Edit this page View SourceGorgonCodecTga(GorgonTgaDecodingOptions)
Initializes a new instance of the GorgonCodecTga class.
Declaration
public GorgonCodecTga(GorgonTgaDecodingOptions decodingOptions = null)
Parameters
Type | Name | Description |
---|---|---|
GorgonTgaDecodingOptions | decodingOptions | [Optional] Codec specific options to use when decoding image data. |
Properties
| Edit this page View SourceCodec
Property to return the abbreviated name of the codec (e.g. PNG).
Declaration
public override string Codec { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
| Edit this page View SourceCodecDescription
Property to return the friendly description of the format.
Declaration
public override string CodecDescription { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
| Edit this page View SourceSupportedPixelFormats
Property to return the pixel formats supported by the codec.
Declaration
public override IReadOnlyList<BufferFormat> SupportedPixelFormats { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<BufferFormat> |
Overrides
| Edit this page View SourceSupportsBlockCompression
Property to return whether the image codec supports block compression.
Declaration
public override bool SupportsBlockCompression { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
| Edit this page View SourceSupportsDepth
Property to return whether the image codec supports a depth component for volume textures.
Declaration
public override bool SupportsDepth { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
| Edit this page View SourceSupportsMipMaps
Property to return whether the image codec supports mip maps.
Declaration
public override bool SupportsMipMaps { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
| Edit this page View SourceSupportsMultipleFrames
Property to return whether the codec supports decoding/encoding multiple frames or not.
Declaration
public override bool SupportsMultipleFrames { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Methods
| Edit this page View SourceGetMetaData(Stream)
Function to read the meta data for image data within a stream.
Declaration
public override IGorgonImageInfo GetMetaData(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The stream containing the metadata to read. |
Returns
Type | Description |
---|---|
IGorgonImageInfo | The image meta data as a IGorgonImageInfo value. |
Overrides
Remarks
Ensure that the file can be read by calling the IsReadable(Stream) method prior to calling this method.
Exceptions
Type | Condition |
---|---|
IOException | Thrown when the -or- Thrown if the file is corrupt or can't be read by the codec. |
ArgumentNullException | Thrown when the |
IOException | Thrown when the |
EndOfStreamException | Thrown when an attempt to read beyond the end of the stream is made. |
See Also
| Edit this page View SourceIsReadable(Stream)
Function to determine if this codec can read the image data within the stream or not.
Declaration
public override bool IsReadable(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The stream that is used to read the image data. |
Returns
Type | Description |
---|---|
bool | true if the codec can read the file, false if not. |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
IOException | Thrown when the |
OnDecodeFromStream(Stream, long)
Function to load an image from a stream.
Declaration
protected override IGorgonImage OnDecodeFromStream(Stream stream, long size)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The stream containing the image data to read. |
long | size | The size of the image within the stream, in bytes. |
Returns
Type | Description |
---|---|
IGorgonImage | A IGorgonImage containing the image data from the stream. |
Overrides
Exceptions
Type | Condition |
---|---|
GorgonException | Thrown when the image data in the stream has a pixel format that is unsupported. |
Save(IGorgonImage, Stream)
Function to persist a IGorgonImage to a stream.
Declaration
public override void Save(IGorgonImage imageData, Stream stream)
Parameters
Type | Name | Description |
---|---|---|
IGorgonImage | imageData | A IGorgonImage to persist to the stream. |
Stream | stream | The stream that will receive the image data. |
Overrides
Remarks
When persisting image data via a codec, the image must have a format that the codec can recognize. This list of supported formats is provided by the SupportedPixelFormats property. Applications may convert their image data a supported format before saving the data using a codec.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
NotSupportedException | Thrown when the image data in the stream has a pixel format that is unsupported by the codec. |