Ryba3310

bmp.h

Apr 16th, 2022 (edited)
760
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.65 KB | None | 0 0
  1. // BMP-related data types based on Microsoft's own
  2.  
  3. #include <stdint.h>
  4.  
  5. // These data types are essentially aliases for C/C++ primitive data types.
  6. // Adapted from http://msdn.microsoft.com/en-us/library/cc230309.aspx.
  7. // See https://en.wikipedia.org/wiki/C_data_types#stdint.h for more on stdint.h.
  8.  
  9. typedef uint8_t  BYTE;
  10. typedef uint32_t DWORD;
  11. typedef int32_t  LONG;
  12. typedef uint16_t WORD;
  13.  
  14. // The BITMAPFILEHEADER structure contains information about the type, size,
  15. // and layout of a file that contains a DIB [device-independent bitmap].
  16. // Adapted from http://msdn.microsoft.com/en-us/library/dd183374(VS.85).aspx.
  17.  
  18. typedef struct
  19. {
  20.     WORD   bfType;
  21.     DWORD  bfSize;
  22.     WORD   bfReserved1;
  23.     WORD   bfReserved2;
  24.     DWORD  bfOffBits;
  25. } __attribute__((__packed__))
  26. BITMAPFILEHEADER;
  27.  
  28. // The BITMAPINFOHEADER structure contains information about the
  29. // dimensions and color format of a DIB [device-independent bitmap].
  30. // Adapted from http://msdn.microsoft.com/en-us/library/dd183376(VS.85).aspx.
  31.  
  32. typedef struct
  33. {
  34.     DWORD  biSize;
  35.     LONG   biWidth;
  36.     LONG   biHeight;
  37.     WORD   biPlanes;
  38.     WORD   biBitCount;
  39.     DWORD  biCompression;
  40.     DWORD  biSizeImage;
  41.     LONG   biXPelsPerMeter;
  42.     LONG   biYPelsPerMeter;
  43.     DWORD  biClrUsed;
  44.     DWORD  biClrImportant;
  45. } __attribute__((__packed__))
  46. BITMAPINFOHEADER;
  47.  
  48. // The RGBTRIPLE structure describes a color consisting of relative intensities of
  49. // red, green, and blue. Adapted from http://msdn.microsoft.com/en-us/library/aa922590.aspx.
  50.  
  51. typedef struct
  52. {
  53.     BYTE  rgbtBlue;
  54.     BYTE  rgbtGreen;
  55.     BYTE  rgbtRed;
  56. } __attribute__((__packed__))
  57. RGBTRIPLE;
Advertisement
Add Comment
Please, Sign In to add comment