Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: PaulStoffregen / ST7735_t3 Library Missing drawRGBBitmap function from Adafruit_GFX

  1. #1
    Junior Member
    Join Date
    Jun 2021
    Posts
    2

    PaulStoffregen / ST7735_t3 Library Missing drawRGBBitmap function from Adafruit_GFX

    First post on this forum, apologies in advance...

    I am testing some ST7789-based 240x240 displays with a Teensy 4.0 and tried loading a 16-bit color image from PROGMEM.

    I received an error that the function wasn't in the class and lo-and-behold it wasn't.

    So I hacked-in the function from the Adafruit_GFX into ST7735_t3.h and ST7735_t3.cpp, with a minor edit and it is working flawlessly. Not sure why it was missing...

    Should I go into more details here or should I propose some sort of fix to the Github Repo itself?

    Thanks!

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,576
    Sorry, I am not Paul, but I have done some work on that library.

    This library May have started originally from some of the Adafruit libraries, with most of the functionality that was in the GFX library at the time. However since then the sets of libraries have probably diverged some. Also lots of the bits and pieces out of the ILI9341_t3 and ILI9341_t3n libraries have been merged into the St7735/89 library.

    Now guessing what the drawRGBBitmap function does in Adafruit, you might want to look in our libraries at the methods:
    Code:
    // Useful methods added from ili9341_t3 
      void writeRect(int16_t x, int16_t y, int16_t w, int16_t h, const uint16_t *pcolors);
      void writeSubImageRect(int16_t x, int16_t y, int16_t w, int16_t h, 
                            int16_t image_offset_x, int16_t image_offset_y, int16_t image_width, int16_t image_height, 
                            const uint16_t *pcolors);
      void writeSubImageRectBytesReversed(int16_t x, int16_t y, int16_t w, int16_t h, 
                            int16_t image_offset_x, int16_t image_offset_y, int16_t image_width, int16_t image_height, 
                            const uint16_t *pcolors);
      // writeRect8BPP -  write 8 bit per pixel paletted bitmap
      //          bitmap data in array at pixels, one byte per
      //pixel
      //          color palette data in array at palette
      void writeRect8BPP(int16_t x, int16_t y, int16_t w, int16_t h,
                         const uint8_t *pixels, const uint16_t *palette);
    
      // writeRect4BPP -  write 4 bit per pixel paletted bitmap
      //          bitmap data in array at pixels, 4 bits per
      //pixel
      //          color palette data in array at palette
      //          width must be at least 2 pixels
      void writeRect4BPP(int16_t x, int16_t y, int16_t w, int16_t h,
                         const uint8_t *pixels, const uint16_t *palette);
    
      // writeRect2BPP -  write 2 bit per pixel paletted bitmap
      //          bitmap data in array at pixels, 4 bits per
      //pixel
      //          color palette data in array at palette
      //          width must be at least 4 pixels
      void writeRect2BPP(int16_t x, int16_t y, int16_t w, int16_t h,
                         const uint8_t *pixels, const uint16_t *palette);
    
      // writeRect1BPP -  write 1 bit per pixel paletted bitmap
      //          bitmap data in array at pixels, 4 bits per
      //pixel
      //          color palette data in array at palette
      //          width must be at least 8 pixels
      void writeRect1BPP(int16_t x, int16_t y, int16_t w, int16_t h,
                         const uint8_t *pixels, const uint16_t *palette);
    
      // writeRectNBPP -  write N(1, 2, 4, 8) bit per pixel paletted bitmap
      //          bitmap data in array at pixels
      //  Currently writeRect1BPP, writeRect2BPP, writeRect4BPP use this to do all
      //  of the work.
      //
      void writeRectNBPP(int16_t x, int16_t y, int16_t w, int16_t h,
                         uint8_t bits_per_pixel, const uint8_t *pixels,
                         const uint16_t *palette);
    Hope that helps. Also if there are things that you need, you can always suggest them here and/or create an Issue against the library or better yet, a Pull Requst.

    Good luck
    Kurt

  3. #3
    Junior Member
    Join Date
    Jun 2021
    Posts
    2
    Got it...

    Code:
    void writeRect(int16_t x, int16_t y, int16_t w, int16_t h, const uint16_t *pcolors);
    Worked perfectly for my 16-bit bitmap array. (R5G6B5 Color, uint16_t).

    I suppose a picture is just a rectangle filled with an array of values instead of a solid color...

    BTW, couldn't find the lower bit per pixel versions in the source code...

    Thanks for your help!

  4. #4
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,576
    Quote Originally Posted by Gabi View Post
    Got it...

    Code:
    void writeRect(int16_t x, int16_t y, int16_t w, int16_t h, const uint16_t *pcolors);
    Worked perfectly for my 16-bit bitmap array. (R5G6B5 Color, uint16_t).

    I suppose a picture is just a rectangle filled with an array of values instead of a solid color...

    BTW, couldn't find the lower bit per pixel versions in the source code...

    Thanks for your help!
    I am seeing the functions in the code on my machine:

    But I am running with the latest beta of Teensyduino:
    Code:
    void ST7735_t3::writeRect4BPP(int16_t x, int16_t y, int16_t w, int16_t h,
                                    const uint8_t *pixels,
                                    const uint16_t *palette) {
      // Simply call through our helper
      writeRectNBPP(x, y, w, h, 4, pixels, palette);
    }
    Which probably matches what is up in Pauls Github: https://github.com/PaulStoffregen/ST7735_t3
    I believe those were merged in maybe 3 months ago

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •