gd_tga.h 1.7 KB

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