openTRI 0.1
tga.h
1#ifndef __TGA_H__
2#define __TGA_H__
3
4// ImageType Codes
5#define TGA_TYPE_MAPPED 1
6#define TGA_TYPE_COLOR 2
7#define TGA_TYPE_GRAY 3
8#define TGA_TYPE_MAPPED_RLE 9
9#define TGA_TYPE_COLOR_RLE 10
10#define TGA_TYPE_GRAY_RLE 11
11
12
13/* Image descriptor:
14 3-0: attribute (alpha) bpp
15 4: left-to-right ordering
16 5: top-to-bottom ordering
17 7-6: zero
18*/
19// Image Description Bitmasks
20#define TGA_DESC_ABITS 0x0f // Alpha Bits
21#define TGA_DESC_HORIZONTAL 0x10 // Left-Right Ordering: 0 = left to right, 1 = right to left
22#define TGA_DESC_VERTICAL 0x20 // Top-Bottom Ordering: 0 = bottom to top, 1 = top to bottom
23#define uchar unsigned char
24
25typedef struct {
26 uchar ImageIDSize;
27 uchar ColorMapType;
28 uchar ImageTypeCode; // Image Type (normal/paletted/grayscale/rle)
29 uchar ColorMapOrigin[2];
30 uchar ColorMapLength[2]; // Palette Size
31 uchar ColorMapESize; // Size in bits of one Palette entry
32 uchar OriginX[2];
33 uchar OriginY[2];
34 uchar Width[2]; // Width of Image
35 uchar Height[2]; // Height of Image
36 uchar Depth; // Bits per Pixel of Image
37 uchar ImageDescrip;
39
40#endif
Definition: tga.h:25