cancel
Showing results for 
Search instead for 
Did you mean: 

Using Bitmap::dynamicBitmapCreateExternal

Priyank
Senior

Hi, I am trying to create an external dynamic bitmap to display an image already loaded into Memory Mapped External Flash. 

uint16_t FrontendApplication::getLogoBitmapId()
{
    if (bitmapId == touchgfx::BITMAP_INVALID)
    {
    	bitmapId = Bitmap::dynamicBitmapCreateExternal(185, 43,(void const*)0x90FC0000, Bitmap::RGB565);
    }
    return bitmapId;
}

 

void LandingView::setupScreen()
{
    LandingViewBase::setupScreen();
    auto app = static_cast<FrontendApplication*>(Application::getInstance());
    uint16_t bmpId = app->getLogoBitmapId();
    logo.setBitmap(Bitmap(bmpId));
    add(logo);
    logo.invalidate();
}

 I keep getting the bitmapId as BITMAP_INVALID. I've tried the external bitmap function with L8 as well.  

4 REPLIES 4
LouisB
ST Employee

Hello @Priyank ,

Did you set up your bitmap cache ?
BR,

Louis BOUDO
ST Software Developer | TouchGFX

The description of the function says that is allows the user to create a dynamic bitmap without needing to use the cache so I did not.

"Create a dynamic bitmap without reserving memory in the dynamic
* bitmap cache. The pixels must be already available in the
* memory, e.g. in flash. No copying is performed."

LouisB
ST Employee

You still need the setCache, it's use to store your image adress/size.

BR,

Louis BOUDO
ST Software Developer | TouchGFX

Gotcha, I set the cache, but for RGB565 images, the image shows up faded. For L8 Images, they don't appear at all?