Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Bitmap.h
00001 // 00002 // Windows BMP file definitions. 00003 // 00004 // Adapted from code written by Michael Sweet from Paul Bourke's 00005 // web site: http://paulbourke.net/dataformats/bmp/ 00006 // 00007 00008 #ifndef _BITMAP_H_ 00009 #define _BITMAP_H_ 00010 00011 #include <mbed.h> 00012 00013 // BITMAPFILEHEADER 00014 // BITMAPINFOHEADER 00015 // Optional Palette 00016 // Raw Data 00017 00018 // 00019 // Bitmap file data structures 00020 // 00021 // must align to 2-byte boundaries so it doesn't alter the memory image when 00022 00023 // bytes are read from the file system into this footprint. 00024 #ifdef __GNUC__ 00025 #pragma pack(push, 1) 00026 #define ALIGNMENT 00027 #else 00028 #define ALIGNMENT 00029 #pragma push 00030 #pragma pack(2) 00031 #endif 00032 00033 /// Bitmap file header 00034 typedef struct /**** BMP file header structure ****/ 00035 { 00036 uint16_t bfType; ///< Magic number for file 00037 uint32_t bfSize; ///< Size of file 00038 uint16_t bfReserved1; ///< reserved placeholder for the structure footprint 00039 uint16_t bfReserved2; ///< reserved placeholder for the structure footprint 00040 uint32_t bfOffBits; ///< Offset to bitmap data 00041 00042 } BITMAPFILEHEADER ALIGNMENT; // Size: 14B 00043 #if (defined(WIN32)) 00044 static_assert(sizeof(BITMAPFILEHEADER) == 14, "Alignment Error"); 00045 #endif 00046 00047 /// Bitmap information header 00048 typedef struct /**** BMP file info structure ****/ 00049 { 00050 uint32_t biSize; ///< Size of info header 00051 uint32_t biWidth; ///< Width of image 00052 uint32_t biHeight; ///< Height of image 00053 uint16_t biPlanes; ///< Number of color planes 00054 uint16_t biBitCount; ///< Number of bits per pixel 00055 uint32_t biCompression; ///< Type of compression to use 00056 uint32_t biSizeImage; ///< Size of image data 00057 int32_t biXPelsPerMeter; ///< X pixels per meter 00058 int32_t biYPelsPerMeter; ///< Y pixels per meter 00059 uint32_t biClrUsed; ///< Number of colors used 00060 uint32_t biClrImportant; ///< Number of important colors 00061 } BITMAPINFOHEADER ALIGNMENT; // Size: 40B 00062 #ifdef __GNUC__ 00063 #pragma pack(pop) 00064 #undef ALIGNMENT 00065 #else 00066 #pragma pop 00067 #endif 00068 00069 #define BF_TYPE 0x4D42 /* "MB" */ 00070 00071 /* 00072 * Constants for the biCompression field... 00073 */ 00074 00075 # define BI_RGB 0 /* No compression - straight BGR data */ 00076 # define BI_RLE8 1 /* 8-bit run-length compression */ 00077 # define BI_RLE4 2 /* 4-bit run-length compression */ 00078 # define BI_BITFIELDS 3 /* RGB bitmap with RGB masks */ 00079 00080 /// An RGB Quad data type used by the bitmap driver. 00081 typedef struct /**** Colormap entry structure ****/ 00082 { 00083 uint8_t rgbBlue; ///< Blue value 00084 uint8_t rgbGreen; ///< Green value 00085 uint8_t rgbRed; ///< Red value 00086 uint8_t rgbReserved; ///< Reserved 00087 } RGBQUAD; 00088 00089 //typedef struct /**** Bitmap information structure ****/ 00090 // { 00091 // BITMAPINFOHEADER bmiHeader; /* Image header */ 00092 // RGBQUAD bmiColors[256]; /* Image colormap */ 00093 // } BITMAPINFO; 00094 00095 #ifdef __GNUC__ 00096 #pragma pack(push, 1) 00097 #define ALIGNMENT 00098 #else 00099 #pragma push 00100 #pragma pack(2) 00101 #endif 00102 00103 /// Icon file type file header. 00104 typedef struct /**** ICO file header structure ****/ 00105 { 00106 uint16_t Reserved_zero; ///< Always zero 00107 uint16_t icType; ///< 1 for .ico, 2 for .cur 00108 uint16_t icImageCount; ///< number of images in the file 00109 } ICOFILEHEADER; 00110 00111 /// Icon file type directory entry structure 00112 typedef struct /**** ICO file Directory Entry structure (1 or more) ****/ 00113 { 00114 uint8_t biWidth; ///< Width of image 00115 uint8_t biHeight; ///< Height of image 00116 uint8_t biClrUsed; ///< Number of colors used 00117 uint8_t Reserved_zero; ///< reserved placeholder for the structure footprint 00118 uint16_t biPlanes; ///< Number of color planes (ICO should be 0 or 1, CUR horz hotspot 00119 uint16_t biBitCount; ///< Number of bits per pixel (ICO bits per pixel, CUR vert hotspot 00120 uint32_t biSizeImage; ///< Size of image data 00121 uint32_t bfOffBits; ///< Offset into file for the bitmap data 00122 } ICODIRENTRY; 00123 #ifdef __GNUC__ 00124 #pragma pack(pop) 00125 #undef ALIGNMENT 00126 #else 00127 #pragma pop 00128 #endif 00129 00130 #define IC_TYPE 0x0001 /* 1 = ICO (icon), 2 = CUR (cursor) */ 00131 00132 #endif // _BITMAP_H_
Generated on Thu Jul 14 2022 02:03:21 by
1.7.2