7 years, 8 months ago.

Rendering BMP/ICO files using RA8875 API.

Hi.

First of all I would like to thank you for writing this API, I have found it very helpful. However, I am having some trouble with rendering BMP and ICO files using the API. I currently have /media/uploads/msharma97/screen_shot_2016-07-25_at_14.48.52.png those files on my mbed, which is the LPC 1768. I am attempted to render these files onto the screen.

what i'm trying

#include "mbed.h"
#include "RA8875.h"

LocalFileSystem local("local");
Serial pc(USBTX, USBRX);

const char * files[] = {
    "/local/Test1.ico", "/local/Test2.bmp", "/local/Test3.bmp"
};


RA8875 lcd(p5, p6, p7, p12, NC, "tft");

int main()
{
    int i;
    RetCode_t r;

    pc.baud(9600);    // I like a snappy terminal, so crank it up!
    pc.printf("\r\nBitmap Test - Build " __DATE__ " " __TIME__ "\r\n");
    // The declaration constructor (above) doe not bring the display online properly
    // (and the following is needed)
    lcd.init();
  

    // Preset the test
    lcd.puts(0,0, "Graphics Test");
    wait(3);

    for (i=0; i<sizeof(files)/sizeof(files[0]); i++) {
        pc.printf("  TestFile {%s}\r\n", files[i]);
        r = lcd.RenderBitmapFile(0,0, files[i]);
        pc.printf("    RenderBitmapFile returned {%s}.\r\n", lcd.GetErrorMessage(r));
        wait(5);
    }
    pc.printf("Test end.\r\n");
}

When trying to use .bmp files, I am getting a file not supported error. When adding an ico file and replacing the relevant parameters I am getting a file not found error. I am incredibly confused by this seemingly non-sensical behaviour. Any tips?

Thanks

Question relating to:

1 Answer

7 years, 8 months ago.

Hi Mrinank,

I just tested with my current library and it is working fine for me. One thing I never addressed, if the image file exceeds the screen boundary, it doesn't work well. [If the bmp is too big for the screen, or the x,y offset + width or height exceeds the screen size]

First - are you using the latest RA8875 library? Version 122 is what is on the https://developer.mbed.org/users/WiredHome/code/RA8875/ page.

Next, have you tested other features? basic drawing samples - to ensure that your display is wired correctly to your mbed?

BMP files come with a variety of options, color depth, internal palette and so forth. I've tested many, but perhaps not all possibilities.

If you reach this point, then you may have to enable the debug settings and review the bitmap reading and rendering in action. At the top of RA8875.h you'll find #define DEBUG "RAIO", which you can uncomment. Build and run the code, and have a serial terminal connected. There is a similar #define in GraphicsDisplay.cpp. Between the two of these, you'll get a lot of data on the serial port, but if you look through the bitmap rendering, you'll see what they are reporting...

Accepted Answer

Cheers for the response, think the bitmap i was using was unsupported somehow so I tried another tool. Cheers for the response!

posted by Mrinank Sharma 26 Jul 2016

If you have a [small] sample of a bmp that it does not render properly, perhaps you could post it somewhere and send me a link?

posted by David Smart 27 Jul 2016