cs-lazaro

Untitled

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