A Bitmap library created a while back. Probably still works...

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "BitmapFile.h"
00003 #include "MobileLCD.h"
00004 
00005 LocalFileSystem local("local");
00006 MobileLCD lcd(5, 6, 7, 8, 9);
00007 Serial pc(USBTX,USBRX);
00008 
00009 int main()
00010 {
00011     BitmapFile MyBitmap("/local/mbed.bmp");
00012     int x = 3;
00013     int y = 3;
00014     unsigned int color = MyBitmap.getPixel(x,y);
00015     lcd.background(0xFF0000);
00016     lcd.cls();
00017     lcd.printf("Offset = %X",MyBitmap.getOffset());
00018     lcd.newline();
00019     lcd.printf("Header = %d",MyBitmap.getHeaderType());
00020     lcd.newline();
00021     lcd.printf("Color depth = %d",MyBitmap.getColorDepth());
00022     lcd.newline();
00023     lcd.printf("Size = %d x %d",MyBitmap.getWidth(),MyBitmap.getHeight());
00024     lcd.newline();
00025     lcd.printf("Rowlength = %d",MyBitmap.getRowSize());
00026     lcd.newline();
00027     lcd.printf("(%d,%d) = %06X",x,y,MyBitmap.getPixel(x,y));//<----
00028     lcd.newline();
00029     wait(3);
00030     lcd.background(0x8f8f8f);
00031     lcd.cls();
00032     lcd.background(0x000000);
00033     lcd.cls();
00034     
00035     for(int row = 0; row < MyBitmap.getHeight(); row++)
00036     {
00037         
00038         //int *colors = MyBitmap.getRow(row,false);
00039         //lcd.blit(0,MyBitmap.getHeight()-row-1,MyBitmap.getWidth(),1,colors);
00040         //delete [] colors;
00041         char *bitstream = MyBitmap.getRowBitstream(row,false);
00042         lcd.bitblit(0,MyBitmap.getHeight()-row-1,MyBitmap.getWidth(),1,bitstream);
00043         delete [] bitstream;
00044     }
00045     MyBitmap.close();
00046 }