LibGd 2.4.0-dev
GD Graphics library
Loading...
Searching...
No Matches
gd_tga.h
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
9typedef struct oTga_ {
10 uint8_t identsize; // size of ID field that follows 18 uint8_t header (0
11 // usually)
12 uint8_t colormaptype; // type of colour map 0=none, 1=has palette
13 uint8_t imagetype; // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed
14
15 int colormapstart; // first colour map entry in palette
16 int colormaplength; // number of colours in palette
17 uint8_t colormapbits; // number of bits per palette entry 15,16,24,32
18
19 int xstart; // image x origin
20 int ystart; // image y origin
21 int width; // image width in pixels
22 int height; // image height in pixels
23 uint8_t bits; // image bits per pixel 8,16,24,32
24 uint8_t alphabits; // alpha bits (low 4bits of header 17)
25 uint8_t fliph; // horizontal or vertical
26 uint8_t flipv; // flip
27 uint8_t has_alpha; // decoded image contains alpha
28 char *ident; // identifcation tag string
29 int *bitmap; // bitmap data
30 int *colormap; // decoded color map
31
32} oTga;
33
34#define TGA_TYPE_NO_IMAGE 0
35#define TGA_TYPE_INDEXED 1
36#define TGA_TYPE_RGB 2
37#define TGA_TYPE_GREYSCALE 3
38#define TGA_TYPE_INDEXED_RLE 9
39#define TGA_TYPE_RGB_RLE 10
40#define TGA_TYPE_GREYSCALE_RLE 11
41#define TGA_TYPE_INDEXED_HUFFMAN_DELTA_RLE 32
42#define TGA_TYPE_RGB_HUFFMAN_DELTA_QUADTREE_RLE 33
43
44#define TGA_BPP_8 8
45#define TGA_BPP_16 16
46#define TGA_BPP_24 24
47#define TGA_BPP_32 32
48
49#define TGA_RLE_FLAG 128
50
51int read_header_tga(gdIOCtxPtr ctx, oTga *tga);
52int read_image_tga(gdIOCtxPtr ctx, oTga *tga);
53void free_tga(oTga *tga);
54
55#endif //__TGA_H