TGA

Implements the Truevision Graphics bitmap file format (*.tga) with some extra capabilities at the cost of making them unusable in applications not implementing these features: <ul> <li>Capability of storing 1, 2, and 4 bit indexed images.</li> <li>External color map support.</li> <li>More coming soon such as more advanced compression methods.</li> </ul> Accessing developer area is fully implemented, accessing extension area is partly implemented.

Constructors

this
this(TGAHeader header, ubyte[] imageData, ubyte[] paletteData = null, char[] imageID = null)

Creates a TGA object without a footer.

this
this(TGAHeader header, TGAFooter footer, ubyte[] imageData, ubyte[] paletteData = null, char[] imageID = null)

Creates a TGA object with a footer.

Members

Functions

addEmbeddedData
void addEmbeddedData(ushort ID, ubyte[] data)

Creates an embedded field within the TGA file.

createExtensionArea
void createExtensionArea()

Adds extension area for the file.

getDevAreaInfo
DevAreaTag getDevAreaInfo(size_t n)

Returns the developer area info for the field.

getEmbeddedData
DevArea getEmbeddedData(size_t n)

Returns the embedded field.

getHeader
TGAHeader getHeader()

Returns the header as a reference type.

getImageType
ubyte getImageType()

Returns the image type.

getPixelOrder
ubyte[] getPixelOrder()

Returns the pixel order for bitdepths less than 8. Almost excusively used for indexed bitmaps. Returns null if ordering not needed.

getPixelOrderBitshift
ubyte[] getPixelOrderBitshift()

Returns which pixel how much needs to be shifted right after a byteread.

save
void save(FILE file)

Saves the current TGA object into a Truevision TARGA file. If ignoreScanlineBounds is true, then the compression methods will ignore the scanline bounds, this disables per-line accessing, but enhances compression rates by a margin in exchange. If false, then it'll generate a scanline table.

Static functions

load
TGA load(FILE file)

Loads a Truevision TARGA file and creates a TGA object. FILE can be either std.stdio's file, my own implementation of a virtual file (see ziltoid1991/vfile), or any compatible solution.

Variables

colorCorrectionTable
ushort[] colorCorrectionTable;

color correction table

postageStampImage
ubyte[] postageStampImage;

byte 0 is width, byte 1 is height

scanlineTable
uint[] scanlineTable;

stores offset to scanlines

Meta