Announcement

Collapse
No announcement yet.

Loading images from internal memory

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Loading images from internal memory

    Hi everyone

    My remaining 2x35T's stopped reading SD cards out of nowhere. I tried a considerable number of SD cards and they work fine on the diablos so i'm pretty syre it's an hardware issue. Anyway, I am on a deadline for Thursday and can't possibly get new boards on time.

    I was wondering if there's any way in which I can call the images from internal memory, as per the alpha demo example?

    I have tried calling stored images the same way, i.e.

    Code:
    #include <DSPI.h>
    #include <TFT.h>
    
    extern char img1_data[] asm("_binary_objects_img1_bmp_start");
    
    BMP img1(img1_data);
    
    // Set up the screen to use
    PICadillo35t tft;
    
    void setup() {
        analogWrite(PIN_BACKLIGHT, 255);
        tft.initializeDevice();
        tft.setRotation(0);
        tft.setFont(Fonts::Topaz);
        tft.setTextColor(Color::White);
        tft.fillScreen(Color::White);
    
        img1.draw(&tft, 10, 10);
    }
    
    void loop()
    {
      
    }
    However, the image looks weird on the screen. I assume it's trying the do the alpha overlay when all i want is to load the original bmp. Is there a way to do so? I have attached pics of the bmp and how it looks on screen. Thanks in advance
    Attached Files

  • #2
    That's not alpha, that looks more like it unable to decypher the image data. It could be an issue with line length and padding for 32-bit alignment maybe. Try changing the image so it's a multiple of 4 pixels in both directions (knock one pixel off the width and height to make it 144x144).

    Also, unless you're wanting alpha, make sure to export the BMP in 16-bit 565 file format. It *should* work with 24 and 32 bit RGB and RGBA / ARGB files, but they just waste space.

    I actually really hate BMP files with a passion, but they don't need much memory to work with as they're not compressed.

    Better would be to work directly with a raw 565 file instead of a BMP.
    Last edited by majenko; 5th August 2014, 07:11 PM.

    Comment


    • #3
      That worked. Thank you sir

      Comment


      • #4
        Which worked? The resizing or the reducing of colours?

        Comment

        Working...
        X