xref: /PHP-8.2/ext/gd/libgd/gd_tga.h (revision 81fd1135)
1 #ifndef __TGA_H
2 #define __TGA_H	1
3 
4 #include "gd.h"
5 #include "gdhelpers.h"
6 
7 #include "gd_intern.h"
8 
9 typedef struct oTga_ {
10 	uint8_t  identsize;	// size of ID field that follows 18 uint8_t header (0 usually)
11 	uint8_t  colormaptype;	// type of colour map 0=none, 1=has palette					[IGNORED] Adrian requested no support
12 	uint8_t  imagetype;	// type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed
13 
14 	int colormapstart;	// first colour map entry in palette						[IGNORED] Adrian requested no support
15 	int colormaplength;	// number of colours in palette								[IGNORED] Adrian requested no support
16 	uint8_t  colormapbits;	// number of bits per palette entry 15,16,24,32				[IGNORED] Adrian requested no support
17 
18 	int xstart;			// image x origin
19 	int ystart;			// image y origin
20 	int width;			// image width in pixels
21 	int height;			// image height in pixels
22 	uint8_t  bits;			// image bits per pixel 8,16,24,32
23 	uint8_t alphabits;		// alpha bits (low 4bits of header 17)
24 	uint8_t fliph;			// horizontal or vertical
25 	uint8_t flipv;			// flip
26 	char *ident;		// identifcation tag string
27 	int *bitmap;		// bitmap data
28 
29 } oTga;
30 
31 #define TGA_TYPE_NO_IMAGE						0
32 #define TGA_TYPE_INDEXED						1
33 #define TGA_TYPE_RGB							2
34 #define TGA_TYPE_GREYSCALE						3
35 #define TGA_TYPE_INDEXED_RLE					9
36 #define TGA_TYPE_RGB_RLE						10
37 #define TGA_TYPE_GREYSCALE_RLE					11
38 #define TGA_TYPE_INDEXED_HUFFMAN_DELTA_RLE		32
39 #define TGA_TYPE_RGB_HUFFMAN_DELTA_QUADTREE_RLE	33
40 
41 #define TGA_BPP_8	8
42 #define TGA_BPP_16	16
43 #define TGA_BPP_24	24
44 #define TGA_BPP_32	32
45 
46 #define TGA_RLE_FLAG	128
47 
48 int read_header_tga(gdIOCtx *ctx, oTga *tga);
49 int read_image_tga(gdIOCtx *ctx, oTga *tga);
50 void free_tga(oTga *tga);
51 
52 #endif //__TGA_H
53