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.
Dependencies: MARY_CAMERA NokiaLCD mbed
Diff: bmp_handler.cpp
- Revision:
- 28:ef40d40b5d39
- Parent:
- 23:8471197d3096
--- a/bmp_handler.cpp Wed Mar 12 06:21:03 2014 +0000
+++ b/bmp_handler.cpp Thu Mar 13 04:44:50 2014 +0000
@@ -56,8 +56,6 @@
int open_BMP( char *file_name, int horizontal_size, int vertical_size )
{
-#ifdef RGB565_FORMAT
-#else
bmp_header bh = {
0x4D42,
horizontal_size * vertical_size * 4 + 54,
@@ -76,9 +74,6 @@
0,
0
};
-#endif
-
-
char s[ 80 ];
sprintf( s, "/local/%s", file_name );
@@ -111,6 +106,21 @@
#endif
}
+void write_BMP( short *p, int length, char mask )
+{
+ unsigned long v[ length ];
+ unsigned long tmp;
+
+ for ( int i = 0; i < length; i++ ) {
+ tmp = p[ i ];
+ v[ i ] = (mask & 0x4) ? (tmp & 0x001F) << 3 : 0;
+ v[ i ] |= (mask & 0x2) ? (tmp & 0x07E0) << 5 : 0;
+ v[ i ] |= (mask & 0x1) ? (tmp & 0xF800) << 8 : 0;
+ }
+
+ fwrite( v, sizeof( unsigned long ), length, fp );
+}
+
void close_BMP( void )
{
fclose( fp );