bmp.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /* $Id$ */
  2. #ifdef __cplusplus
  3. extern "C" {
  4. #endif
  5. /*
  6. gd_bmp.c
  7. Bitmap format support for libgd
  8. * Written 2007, Scott MacVicar
  9. ---------------------------------------------------------------------------
  10. Todo:
  11. RLE4, RLE8 and Bitfield encoding
  12. Add full support for Windows v4 and Windows v5 header formats
  13. ----------------------------------------------------------------------------
  14. */
  15. #ifndef BMP_H
  16. #define BMP_H 1
  17. #define BMP_PALETTE_3 1
  18. #define BMP_PALETTE_4 2
  19. #define BMP_WINDOWS_V3 40
  20. #define BMP_OS2_V1 12
  21. #define BMP_OS2_V2 64
  22. #define BMP_WINDOWS_V4 108
  23. #define BMP_WINDOWS_V5 124
  24. #define BMP_BI_RGB 0
  25. #define BMP_BI_RLE8 1
  26. #define BMP_BI_RLE4 2
  27. #define BMP_BI_BITFIELDS 3
  28. #define BMP_BI_JPEG 4
  29. #define BMP_BI_PNG 5
  30. #define BMP_RLE_COMMAND 0
  31. #define BMP_RLE_ENDOFLINE 0
  32. #define BMP_RLE_ENDOFBITMAP 1
  33. #define BMP_RLE_DELTA 2
  34. #define BMP_RLE_TYPE_RAW 0
  35. #define BMP_RLE_TYPE_RLE 1
  36. /* BMP header. */
  37. typedef struct {
  38. /* 16 bit - header identifying the type */
  39. signed short int magic;
  40. /* 32bit - size of the file */
  41. int size;
  42. /* 16bit - these two are in the spec but "reserved" */
  43. signed short int reserved1;
  44. signed short int reserved2;
  45. /* 32 bit - offset of the bitmap header from data in bytes */
  46. signed int off;
  47. } bmp_hdr_t;
  48. /* BMP info. */
  49. typedef struct {
  50. /* 16bit - Type, ie Windows or OS/2 for the palette info */
  51. signed short int type;
  52. /* 32bit - The length of the bitmap information header in bytes. */
  53. signed int len;
  54. /* 32bit - The width of the bitmap in pixels. */
  55. signed int width;
  56. /* 32bit - The height of the bitmap in pixels. */
  57. signed int height;
  58. /* 8 bit - The bitmap data is specified in top-down order. */
  59. signed char topdown;
  60. /* 16 bit - The number of planes. This must be set to a value of one. */
  61. signed short int numplanes;
  62. /* 16 bit - The number of bits per pixel. */
  63. signed short int depth;
  64. /* 32bit - The type of compression used. */
  65. signed int enctype;
  66. /* 32bit - The size of the image in bytes. */
  67. signed int size;
  68. /* 32bit - The horizontal resolution in pixels/metre. */
  69. signed int hres;
  70. /* 32bit - The vertical resolution in pixels/metre. */
  71. signed int vres;
  72. /* 32bit - The number of color indices used by the bitmap. */
  73. signed int numcolors;
  74. /* 32bit - The number of color indices important for displaying the bitmap. */
  75. signed int mincolors;
  76. } bmp_info_t;
  77. #endif
  78. #ifdef __cplusplus
  79. }
  80. #endif