Go Down

Topic: Storing full color bitmaps in progmem? (Read 62 times) previous topic - next topic

scswift

Dec 02, 2014, 08:34 pm Last Edit: Dec 02, 2014, 10:25 pm by scswift
I was wondering if there were any tools out there for storing images in progmem.  I'm looking for something that can convert 16-bit 565 images.

I found this Arduino Robot page that indicates it has a function for displaying bitmaps stored in EEPROM, but there is no explanation I can find anywhere for how to get the images into EEPROM in the first place:

http://arduino.cc/en/Reference/RobotBeginBMPFromEEPROM

I'm specifically looking for something that I can use for Adafruit's GFX library.  I'm not sure if they have a function in there for working with progmem.  It looks like they may have added something for 2 bit images at one time, but I don't see anything yet for full color. 

I also saw a mention on the Robot page that EEPROM is slower than SD cards for displaying bitmaps.  Surely that can't be true?  Well, I guess it could be if it was implemented poorly... I think an EEPROM access takes something like 4 cycles at most?  And that may be the worst case of reading one byte at a time?  An SD card read would require 16 cycles per byte to clock it in.

robtillaart

how big are the bitmaps height x width? you're talking about?

in theory you can just make a 2D array of unsigned integers (uint16_t) that represents the bitmap.
In code you can optionally expand it.

You might need a small program on a PC (python?) that reads a bitmap and spits out the C array based upon the color of the pixels.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

scswift

I made an error in my original post when I referred to EEPROM.  What I actually want to to is store bitmaps in flash, with progmem.

I understand there isn't a lot of progmem to work with, but I figure one could store over 128 8x8 tiles in 16 bit color, or 256-512 with color indexing and still have plenty of room for your program left over.  I figure that's more than enough to make a simple side scrolling game.

robtillaart

if you work with tiles you can "compress" the amount of memory needed by using repeating tiles.

did you read the tutorial about PROGMEM already?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

scswift

I know how to use progmem.  And I know you can repeat tiles; that's how platform games are typically made. :) 

What I'm asking is if anyone's created a utility to extract raw bitmap data and create progmem arrays in an automated fashion, and if there are any functions in the Adafruit GFX library for displaying them in that format.

guix

It's easy enough to write a custom export plugin for Paint.net. I made one to export to UTFT format (as an alternative to the tool that came with UTFT). I can give you sample code if you want.

Go Up