Bsoft  2.1.0
Bernard's software package
rwTGA.h
Go to the documentation of this file.
1 
11 #include "rwimg.h"
12 
13 #define TGASIZE 18 // Size of the TGA header (constant)
14 
15 struct __attribute__((packed)) TGAhead { // file header for TGA data
16  char idlen; // 0 ID length (0-255)
17  char colmaptype; // 1 Color map type: 0=none, 1=included
18  char imgtype; // 2 Image type:
19  // 0: No image data
20  // 1: Uncompressed color-mapped
21  // 2: Uncompressed true-color
22  // 3: Uncompressed grayscale
23  // 9: Run=length encoded color-mapped
24  // 10: Run=length encoded true-color
25  // 11: Run=length encoded grayscale
26  // 3 Color map specification:
27  short colmapindex; // index of first color map entry
28  short colmaplength; // number of color map entries
29  char colmapbits; // number of bits per entry (15,16,24,32)
30  // 8 Image specification:
31  short xorigin; // left screen position
32  short yorigin; // bottom screen position
33  short width; // width of image
34  short height; // height of image
35  char pixeldepth; // number of bits per pixel (8,16,24,32)
36  char imgdesc; // image descriptor:
37  // 0-3: attribute bits per pixel (alpha/overlay)
38  // 4: left-to-right ordering
39  // 5: top-to-bottom ordering
40  // 6,7: 0
41 } ;
42 
43 struct __attribute__((packed)) TGAfoot {
44  int extoff; // Eextension area offset
45  int devoff; // Developer area offset
46  char sig[16]; // TGA v2 signature
47  char term[2]; // Terminator
48 } ;
49 
50 
51 // I/O prototypes
52 int readTGA(Bimage* p, int readdata);
53 int writeTGA(Bimage* p);
__attribute__
struct __attribute__((packed)) TGAhead
Definition: rwTGA.h:15
Bimage
General image parameter class.
Definition: Bimage.h:177
rwimg.h
Header file for 2D and 3D image I/O.
readTGA
int readTGA(Bimage *p, int readdata)
Reading a Truevision TGA image file format.
Definition: rwTGA.cpp:134
writeTGA
int writeTGA(Bimage *p)
Writing a Truevision TGA map image file format.
Definition: rwTGA.cpp:266