Displaying colour bitmaps on TFT display / Clear Display

Hi,

I am using the following display:

and I was wondering how I can use a bitmap stored on my computer and use it to display a picture on my display.

I am able to do it using the SD card but I do not want to use a SD card.

ALSO. How does one quickly clear the display?

I have attached an example sketch to this message on a related subject.

Simple answer is:

  1. JPEG can be compressed to fit in Flash but needs a lot of SRAM to decode.

  2. BMPs are not compressed. a 65536 colour BMP is too big. 256-colour BMP is still big.

  3. you need at least a Mega2560, Zero, Due, STM32 for JPEG

  4. a Uno can never do JPEG and AVRs can only store a small BMP image.

Study the numbers in my comments.

/* 128x128x24 BMP = 49206 bytes
 * 128x128x16 BMP = 32822 bytes
 * 128x128x8  BMP = 17462 bytes
 * 128x128x4  BMP =  8310 bytes
 * 
 * AVR compiler has 32768 byte limit for arrays
 * so a 32kB Uno can do one 8-bit BMP (256 colour palette)
 * or two 4-bit BMP (16 colur palette)
 * 
 * your mega1284 can store more arrays in Flash
 * 
 * a 512kB Due has no array limit.
 * you can store all of those BMP on a Due
 * you can even store 16-bit or 24-bit BMP on a Due
 */

const unsigned char *bmps[] = {
/*
    lena_128x127x4_bmp,
    lena_128x127x8_bmp,
    lady_128x127x4_bmp,

    lady_128x127x8_bmp,
*/    
    MG_128x128x4_bmp,
    MG_128x128x8_bmp,
/*
    carguy_143x219x4_bmp,
    carguy_143x219x8_bmp,
*/
};

You can try rendering one or two "lady" BMP. Comment out the "car" BMP entries.

You clear the display with tft.fillScreen(BLACK)
Or clear smaller areas with tft.fillRect(x, y, w, h, BLACK)

David.