KSM edits to RA8875

Dependents:   Liz_Test_Code

Committer:
WiredHome
Date:
Tue Jan 21 03:28:36 2014 +0000
Revision:
32:0e4f2ae512e2
Parent:
31:c72e12cd5c67
Child:
42:7cbdfd2bbfc5
Tuned up the Bitmap support - includes 24-bit color, and some hardware performance improvements.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
WiredHome 31:c72e12cd5c67 1 //
WiredHome 31:c72e12cd5c67 2 // Windows BMP file definitions.
WiredHome 31:c72e12cd5c67 3 //
WiredHome 31:c72e12cd5c67 4 // Adapted from code written by Michael Sweet from Paul Bourke's
WiredHome 31:c72e12cd5c67 5 // web site: http://paulbourke.net/dataformats/bmp/
WiredHome 31:c72e12cd5c67 6 //
WiredHome 31:c72e12cd5c67 7
WiredHome 31:c72e12cd5c67 8 #ifndef _BITMAP_H_
WiredHome 31:c72e12cd5c67 9 #define _BITMAP_H_
WiredHome 31:c72e12cd5c67 10
WiredHome 31:c72e12cd5c67 11 #include <mbed.h>
WiredHome 31:c72e12cd5c67 12
WiredHome 31:c72e12cd5c67 13 // BITMAPFILEHEADER
WiredHome 31:c72e12cd5c67 14 // BITMAPINFOHEADER
WiredHome 31:c72e12cd5c67 15 // Optional Palette
WiredHome 31:c72e12cd5c67 16 // Raw Data
WiredHome 31:c72e12cd5c67 17
WiredHome 31:c72e12cd5c67 18 //
WiredHome 31:c72e12cd5c67 19 // Bitmap file data structures
WiredHome 31:c72e12cd5c67 20 //
WiredHome 32:0e4f2ae512e2 21 // must align to 2-byte boundaries so it doesn't alter the memory image when
WiredHome 32:0e4f2ae512e2 22 // bytes are read from the file system into this footprint.
WiredHome 31:c72e12cd5c67 23 #pragma push
WiredHome 31:c72e12cd5c67 24 #pragma pack(2)
WiredHome 31:c72e12cd5c67 25
WiredHome 31:c72e12cd5c67 26 typedef struct /**** BMP file header structure ****/
WiredHome 31:c72e12cd5c67 27 {
WiredHome 31:c72e12cd5c67 28 uint16_t bfType; /* Magic number for file */
WiredHome 31:c72e12cd5c67 29 uint32_t bfSize; /* Size of file */
WiredHome 31:c72e12cd5c67 30 uint16_t bfReserved1; /* Reserved */
WiredHome 31:c72e12cd5c67 31 uint16_t bfReserved2; /* ... */
WiredHome 31:c72e12cd5c67 32 uint32_t bfOffBits; /* Offset to bitmap data */
WiredHome 31:c72e12cd5c67 33 } BITMAPFILEHEADER;
WiredHome 31:c72e12cd5c67 34
WiredHome 31:c72e12cd5c67 35 typedef struct /**** BMP file info structure ****/
WiredHome 31:c72e12cd5c67 36 {
WiredHome 31:c72e12cd5c67 37 uint32_t biSize; /* Size of info header */
WiredHome 31:c72e12cd5c67 38 uint32_t biWidth; /* Width of image */
WiredHome 31:c72e12cd5c67 39 uint32_t biHeight; /* Height of image */
WiredHome 31:c72e12cd5c67 40 uint16_t biPlanes; /* Number of color planes */
WiredHome 31:c72e12cd5c67 41 uint16_t biBitCount; /* Number of bits per pixel */
WiredHome 31:c72e12cd5c67 42 uint32_t biCompression; /* Type of compression to use */
WiredHome 31:c72e12cd5c67 43 uint32_t biSizeImage; /* Size of image data */
WiredHome 31:c72e12cd5c67 44 int32_t biXPelsPerMeter; /* X pixels per meter */
WiredHome 31:c72e12cd5c67 45 int32_t biYPelsPerMeter; /* Y pixels per meter */
WiredHome 31:c72e12cd5c67 46 uint32_t biClrUsed; /* Number of colors used */
WiredHome 31:c72e12cd5c67 47 uint32_t biClrImportant; /* Number of important colors */
WiredHome 31:c72e12cd5c67 48 } BITMAPINFOHEADER;
WiredHome 31:c72e12cd5c67 49 #pragma pop
WiredHome 31:c72e12cd5c67 50
WiredHome 32:0e4f2ae512e2 51 #define BF_TYPE 0x4D42 /* "MB" */
WiredHome 32:0e4f2ae512e2 52
WiredHome 31:c72e12cd5c67 53 /*
WiredHome 31:c72e12cd5c67 54 * Constants for the biCompression field...
WiredHome 31:c72e12cd5c67 55 */
WiredHome 31:c72e12cd5c67 56
WiredHome 31:c72e12cd5c67 57 # define BI_RGB 0 /* No compression - straight BGR data */
WiredHome 31:c72e12cd5c67 58 # define BI_RLE8 1 /* 8-bit run-length compression */
WiredHome 31:c72e12cd5c67 59 # define BI_RLE4 2 /* 4-bit run-length compression */
WiredHome 31:c72e12cd5c67 60 # define BI_BITFIELDS 3 /* RGB bitmap with RGB masks */
WiredHome 31:c72e12cd5c67 61
WiredHome 31:c72e12cd5c67 62 typedef struct /**** Colormap entry structure ****/
WiredHome 31:c72e12cd5c67 63 {
WiredHome 31:c72e12cd5c67 64 uint8_t rgbBlue; /* Blue value */
WiredHome 31:c72e12cd5c67 65 uint8_t rgbGreen; /* Green value */
WiredHome 31:c72e12cd5c67 66 uint8_t rgbRed; /* Red value */
WiredHome 31:c72e12cd5c67 67 uint8_t rgbReserved; /* Reserved */
WiredHome 31:c72e12cd5c67 68 } RGBQUAD;
WiredHome 31:c72e12cd5c67 69
WiredHome 32:0e4f2ae512e2 70 //typedef struct /**** Bitmap information structure ****/
WiredHome 32:0e4f2ae512e2 71 // {
WiredHome 32:0e4f2ae512e2 72 // BITMAPINFOHEADER bmiHeader; /* Image header */
WiredHome 32:0e4f2ae512e2 73 // RGBQUAD bmiColors[256]; /* Image colormap */
WiredHome 32:0e4f2ae512e2 74 // } BITMAPINFO;
WiredHome 31:c72e12cd5c67 75
WiredHome 31:c72e12cd5c67 76 #endif // _BITMAP_H_