Advertisement
dylanm312

bmp.h

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