Full color bitmaps in progmem

Hey guys

Im still working on a 16-bit full color handheld and gaming library. The library is almost finished with the sound file bneeding work but.......

Does any one know of a way or function that will allow someone to store 16x16 4 color bitmaps in progmem and then display them?

I can layer them but its a lil progmem heavy.

Most TFT libraries have methods to display a full colour 16x16 icon from PROGMEM.
e.g. 256 pixels (256 x 16 bits = 512 bytes)

It is fairly easy to display a 4-colour icon using a colour palette.
e.g. 256 pixels (256 x 2 bits = 64 bytes)

The rendering will be more complex but you save flash storage with the limited colours.
I suggest that 16-colour palette might be a better compromise.

If you look at the regular MCUFRIEND_kbv example, the penguin is a 40x40 full colour icon.
There are many PC programs for converting BMP files to raw pixel data. (Or to 4-colour BMP with Palette)

David.

Ok I'm frustrated at myself. I looked at the mcufriend stuff but can't find what your talking about. Could you possibly link me to the correct example?

Also I use a tilemap function that allows you to turn each bitmap into an integer that you can then use to make an array of bitmaps that you can use to create world maps and it's super cheap on Progmem since it's not storing the bitmaps but one time.

Can this still be used?

I did some more looking at the MCU friend file but I'm still new to coding so I don't know what I'm looking for. It looks like this file is for doing the bitmap stuff. I can't seem to find the commands that show the three bitmap files.

https://github.com/prenticedavid/MCUFRIEND_kbv/blob/master/examples/showBMP_kbv_as7/showBMP_kbv_as7.ino

No. You wanted to display icons from PROGMEM.

The showBMP_kbv_as7.ino displays valid BMP files from an SD card. It shows how to display a 4-colour BMP from a palette. As well as other formats.

If you said which particular library you are using, someone would probably point you to the specific class method and even the specific library example that shows you how to use it.

David.

sorry it was the only one "I" saw that c ontained a bitmap function.

ok the library im posting is for the gamebuino gaming library and I have gone through it and updated the functions to color to use on a 220x276 262color oled and a teensy 3.2 which has a 32-bit processor and 256k progmem. I can easily display a bitmap for each color but I would like make it more streamlined,

This lcd

all the display functions come from adafruit_gfx

The test sketch is included

gamebuinoduhjokercolorMAIN1.zip (38.5 KB)

Your display appears to be a 176x220 with a ILI9225 controller using 8-bit parallel interface.

I looked at your ZIP.
It appears to be an ILI9225 SPI library that has been hacked to use an 8080 8-bit interface.

You normally set a rectangular "window" with the controller registers.
And then fill with pixels either all the same colour e.g. fillRect()
Or with different colours from SRAM or Flash memory e.g. pushColor() or pushColors() in Adafruit-style libraries.

I see that you are using a Teensy3.2 which will provide some "processing grunt" to your infficient routines.
Conventional libraries with a Uno will be much faster.

You can read your 4-colour bitmap from PROGMEM in exactly the same way as your library reads 2-colour bitmap from PROGMEM. i.e. you just read bits in pairs instead of one bit per pixel.

Then you look up the relevant colour from your 4-colour palette. Use drawPixel() to display.

I really cannot believe that you will get a responsive "game" but this is not my particular interest.

David.

I can't find any reference for your actions. Can I get some links explaining how the functions work?

Go on. I have explained how to do this.
Your "library" is pretty easy to follow.

If you are an original library developer, you would be able to implement any ideas by yourself.

If you are a learner, I suggest that you start with simple projects first.

I suspect that the Vendor of your "unusual display" will have some example code.

If your hardware was a more "common", many readers would offer help.
And might even build/test any code on a "popular hardware combination" e.g. a 2.4" TFT on a Uno or Mega.

Incidentally, I think that your idea of using 16x16 tiles is very promising. It could work fast and use a relatively small amount of Flash memory.

David.

I'm still learning. And with out some kind of reference or explanation for the functions you listed I'm lost. Pushcolor() and pushcolors() for instance, can't find a reference page.

How do I store my bits in pairs? I use binary or hex to store each monochrome bitmap, not quite understanding how to store a bitmap with 3 to 4 colors. What is the protocol? What format do i use for the actual 3-4 color bitmap?

The library I'm using has been updated by me for use with color but it took me months to get right and many many many libraries made between then and now. I know how to use it just fine. I just don't understand the advice you gave yet.

hello friends i want to convert image logo in to bitmape and display it on mcufriend tft. but i am not getting the output properly, can anyone help in software used to convert and how to addd it in arduino skecth, if possible please post video yube