bmp.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #define BMP_RGB 0
  10. #define BMP_RLE8 1
  11. #define BMP_RLE4 2
  12. #define BMP_BITFIELDS 3
  13. typedef struct {
  14. uint8_t red;
  15. uint8_t green;
  16. uint8_t blue;
  17. uint8_t alpha;
  18. } Rgb;
  19. #define Filehdrsz 14
  20. typedef struct {
  21. short type;
  22. long size; /* file size, not structure size */
  23. short reserved1;
  24. short reserved2;
  25. long offbits;
  26. } Filehdr;
  27. typedef struct {
  28. long size; /* Size of the Bitmap-file */
  29. long lReserved; /* Reserved */
  30. long dataoff; /* Picture data location */
  31. long hsize; /* Header-Size */
  32. long width; /* Picture width (pixels) */
  33. long height; /* Picture height (pixels) */
  34. short planes; /* Planes (must be 1) */
  35. short bpp; /* Bits per pixel (1, 4, 8 or 24) */
  36. long compression; /* Compression mode */
  37. long imagesize; /* Image size (bytes) */
  38. long hres; /* Horizontal Resolution (pels/meter) */
  39. long vres; /* Vertical Resolution (pels/meter) */
  40. long colours; /* Used Colours (Col-Table index) */
  41. long impcolours; /* Important colours (Col-Table index) */
  42. } Infohdr;