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:

* Capability of storing 1, 2, and 4 bit indexed images. * External color map support. * More coming soon such as more advanced compression methods.

Accessing developer area is fully implemented, accessing extension area is partly implemented.

public
class TGA : Image, ImageMetadata {}

Constructors

this
this()

Empty CTOR for loading

this
this(Header header, IImageData _imageData, IPalette _palette, char[] imageID)

Creates a TGA file without a footer.

this
this(IImageData _imageData, IPalette _palette, char[] imageID, bool isRLE)

Creates a TGA file safely with automatically generated header. This constructor is the recommended one for general use.

this
this(Header header, Footer footer, IImageData _imageData, IPalette _palette, char[] imageID)

Creates a TGA file 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.

flipHorizontal
void flipHorizontal()

Flips the image on the vertical axis. Useful to set images to the correct top-left screen origin point.

flipVertical
void flipVertical()

Flips the image on the vertical axis. Useful to set images to the correct top-left screen origin point.

getAuthor
string getAuthor()
Undocumented in source. Be warned that the author may not have intended to support it.
getBitdepth
ubyte getBitdepth()
Undocumented in source. Be warned that the author may not have intended to support it.
getComment
string getComment()
Undocumented in source. Be warned that the author may not have intended to support it.
getCopyright
string getCopyright()
Undocumented in source. Be warned that the author may not have intended to support it.
getCreationTimeStr
string getCreationTimeStr()
Undocumented in source. Be warned that the author may not have intended to support it.
getDescription
string getDescription()
Undocumented in source. Be warned that the author may not have intended to support it.
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
Header getHeader()

Returns the header as a reference type.

getID
string getID()
Undocumented in source. Be warned that the author may not have intended to support it.
getImageType
ubyte getImageType()

Returns the image type.

getJobName
string getJobName()
Undocumented in source. Be warned that the author may not have intended to support it.
getPaletteBitdepth
ubyte getPaletteBitdepth()
Undocumented in source. Be warned that the author may not have intended to support it.
getPalettePixelFormat
uint getPalettePixelFormat()
Undocumented in source. Be warned that the author may not have intended to support it.
getPixelFormat
uint getPixelFormat()
Undocumented in source. Be warned that the author may not have intended to support it.
getSoftwareInfo
string getSoftwareInfo()
Undocumented in source. Be warned that the author may not have intended to support it.
getSoftwareVersion
string getSoftwareVersion()
Undocumented in source. Be warned that the author may not have intended to support it.
getSource
string getSource()
Undocumented in source. Be warned that the author may not have intended to support it.
height
uint height()
Undocumented in source. Be warned that the author may not have intended to support it.
isIndexed
bool isIndexed()
Undocumented in source. Be warned that the author may not have intended to support it.
rightSideOrigin
bool rightSideOrigin()

Returns true if the image originates from the right

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.

setAuthor
string setAuthor(string val)
Undocumented in source. Be warned that the author may not have intended to support it.
setComment
string setComment(string val)
Undocumented in source. Be warned that the author may not have intended to support it.
setCopyright
string setCopyright(string val)
Undocumented in source. Be warned that the author may not have intended to support it.
setCreationTime
string setCreationTime(string val)
Undocumented in source. Be warned that the author may not have intended to support it.
setDescription
string setDescription(string val)
Undocumented in source. Be warned that the author may not have intended to support it.
setID
string setID(string val)
Undocumented in source. Be warned that the author may not have intended to support it.
setJobName
string setJobName(string val)
Undocumented in source. Be warned that the author may not have intended to support it.
setSoftwareInfo
string setSoftwareInfo(string val)
Undocumented in source. Be warned that the author may not have intended to support it.
setSoftwareVersion
string setSoftwareVersion(string val)

Format used: 0.0.0a

setSource
string setSource(string val)
Undocumented in source. Be warned that the author may not have intended to support it.
topOrigin
bool topOrigin()

Returns true if the image originates from the top

width
uint width()
Undocumented in source. Be warned that the author may not have intended to support it.

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.

Structs

DevArea
struct DevArea

Represents embedded data within the developer area

DevAreaTag
struct DevAreaTag

Identifies the embedded data.

ExtArea
struct ExtArea

Contains extended data, mostly metadata.

Footer
struct Footer

Implements Truevision Graphics bitmap footer, which is used to indicate the locations of extra fields.

Header
struct Header

Implements Truevision Graphics bitmap header.

Variables

colorCorrectionTable
ushort[] colorCorrectionTable;

color correction table

developerArea
DevArea[] developerArea;
Undocumented in source.
developerAreaTags
DevAreaTag[] developerAreaTags;
Undocumented in source.
extensionArea
ExtArea[] extensionArea;
Undocumented in source.
footer
Footer footer;
Undocumented in source.
header
Header header;
Undocumented in source.
imageID
char[] imageID;
Undocumented in source.
pitch
size_t pitch;
Undocumented in source.
postageStampImage
ubyte[] postageStampImage;

byte 0 is width, byte 1 is height

scanlineTable
uint[] scanlineTable;

stores offset to scanlines

Meta