Reading BMP files using MFS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Reading BMP files using MFS

2,301 Views
TravisHidlay
Contributor III

Hello,

 

I'm working on displaying bitmaps for background images on the TWR-LCD using eGUI on the TWR-K60 dev kit.  I've had success using the eGUI image converter utility, loading the bitmap arrays into the flash and showing them that way.  The problem with this is that images can't be changed at run time.  What I'd really like to do is change the image based on a BMP file loaded from removable media (flash, sdcard).  Are there any library functions that load / convert a standard BMP to a byte array that's used by eGUI?

 

Thanks in advance!

0 Kudos
6 Replies

1,576 Views
gustavod
Contributor III

Hello Travis,

 

I would like to inform you that we now support 24 bit color bitmap files.

 

The demo project can be download at:

http://brtos.googlecode.com/files/BRTOS%201.66%20Kinetis%20-%20SD%20card%20-%20BMP%2024%20bit.rar

 

Regards,

Gustavo

0 Kudos

1,576 Views
TravisHidlay
Contributor III

Gustavo,

 

Thanks for the link, I'm going to have a look at this some time next week.  For now, I've been trying to use a free library called Quick and Dirty BMP to load a BMP from a flash drive, then convert their BMP data type to the one eGUI uses.  Right now it's loading the file but the image isn't correct.  The eGUI converter utility is doing some conversion to my BMP so that the raw BMP data doesn't match up with the data bytes in the array that comes out of the converter utility.  I saved a small 256 bit BMP in ms-paint, then used the converter utility to create the array (options were set to no compression, 256 bit color mode).  Comparing the bytes in the array to the hex values of the BMP (the data portion), nothing seems to match up.  I did set the first 6 bytes of the eGUI array to contain the bitmap dimensions and the color mode, so the bmp shows up on my lcd in the correct dimensions, but the image doesn't match what I drew, telling me the data is wrong.

 

I'll have a look at the BRTOS demo project, but one of my requirements is that I must use MQX and eGUI.  Does BRTOS use eGUI for it's graphics, or something else?

 

0 Kudos

1,576 Views
gustavod
Contributor III

Travis,

 

We are indeed using eGUI as the graphic library. We used the very same structures of eGUI to load bmp files, just passing the name of the file to load the figure. We use the same bmp declaration to load several bmp files, saving a lot of memory.

In our demo we fixed some figure names to open in the "entry screen" (d4d_entry_screen.c). We declared the name of files to open in the entry screen file as described below:

static char *PictureNames[7]={  "/images/image1.bmp",  "/images/image2.bmp",  "/images/image3.bmp",  "/images/image4.bmp",  "/images/image5.bmp",  "/images/image6.bmp",  "/images/image7.bmp"};

 

So, we load 7 pictures from the images folder into the SD card (8, 16 and 24 bit color bitmaps to test all possibilities).

If you need to use MQX you can try to replace our file system routines (open file, read file, etc) with the MQX ones.

 

PS.: Just a little doubt. You are using 256 bit or 8 bit of colors?

Remember that:

8 bits = 256 colors

16 bits = 65K colors

and 24 bits = 16M colors

 

Regards,

Gustavo

0 Kudos

1,576 Views
TravisHidlay
Contributor III

Gustavo,

 

I meant 256 color, 8 bit, sorry bout that.  I'm going to look into your project over the next few days, it sounds like it has everything I need, I'll just have to adapt it to use the MQX's MFS file system.  Thanks so much for your help, I'll update with results when I get a chance.

 

-Travis

0 Kudos

1,576 Views
Gargy
NXP Employee
NXP Employee

Hello,

 there is development version of eGUI that do exactly what you want.

So in short, if you want to be bete  tester just send me private message and we can discuss in more detail.

 

Have a nice day

Gargy

0 Kudos

1,576 Views
gustavod
Contributor III

Hi Travis,

 

We from the BRTOS project successfully implemented routines to load bitmap files from a SD card into LCD (TWR-LCD). For now we just support 8 and 16 bit colors bitmaps (we used gimp to save 16 bit bitmaps, and paint to save regular 8 bit color bitmap files). If you do not want to use our RTOS you can just use our fat file system and tunned eGUI (or develop your own routines trough MQX using our code as basis).

 

The post for the demo in this forum is:

https://community.freescale.com/thread/85592

 

In this link you can see our routines working (in a Coldfire V1 uc, but we have the same demo running on kinetis TWR-K60N512 kit):

http://www.youtube.com/watch?v=PrbfsqETglY

 

And the gimp software can be download here:

http://gimp-win.sourceforge.net/stable.html

 

I attached some image files for you test the code.

 

Best Regards,

Gustavo

 

 

 

0 Kudos