2025-05-29 3:25 PM
I've been able to successfully use Bitmap::dynamicBitmapCreateExternal() when just loading a bitmap in the frontendappliation and setting up the cache there...
FrontendApplication::FrontendApplication(Model& m, FrontendHeap& heap)
: FrontendApplicationBase(m, heap)
{
/*
* Initialize dynamic bitmap cache;
* bookkeeping memory for external bitmaps not stored in cache
*/
uint16_t* const cacheStartAddr = (uint16_t*)myBmpCache;
const uint32_t cacheSize = sizeof(myBmpCache);
Bitmap::setCache(cacheStartAddr, cacheSize, 1);
void* srcPtr = logoGetImagePtr();
BitmapId bmpId = Bitmap::dynamicBitmapCreateExternal(LCD_X_Size, LCD_Y_Size, srcPtr,
Bitmap::RGB888, 0);
oprSetLogoBmpId(bmpId);
}
I also must be able to load in a different bitmap image is selected by the user and have been able to do this successfully as well by clearing the cache...
if (logoImportCustomLogo(&fileLoad.filename[value][0]) == Result_success) {
uint8_t* ptr = logoGetImagePtr();
/*
* Initialize dynamic bitmap cache;
* bookkeeping memory for external bitmaps not stored in cache
*/
Bitmap::clearCache();
bmpId = Bitmap::dynamicBitmapCreateExternal(LCD_X_Size, LCD_Y_Size, ptr,
Bitmap::RGB888, 0);
oprSetLogoBmpId(bmpId);
prmSetVal(Prm_logo, PrmE_logo_customLogo);
}
However, I will need to be able hand 2 different dynamic images in cache, and when I try to use the cacheRemoveBitmap() the dynamicBitmapCreateExternal() return and invalid bitmapID. The cacheRemoveBitmap() return true so it seems to execute correctly but the cache doesn't seem to be free for the new bitmap.
if (logoImportCustomLogo(&fileLoad.filename[value][0]) == Result_success) {
uint8_t* ptr = logoGetImagePtr();
/*
* Initialize dynamic bitmap cache;
* bookkeeping memory for external bitmaps not stored in cache
*/
bmpId = oprGetLogoBmpId();
if (Bitmap::cacheRemoveBitmap(bmpId)) {
bmpId = Bitmap::dynamicBitmapCreateExternal(LCD_X_Size, LCD_Y_Size, ptr,
Bitmap::RGB888, 0);
oprSetLogoBmpId(bmpId);
prmSetVal(Prm_logo, PrmE_logo_customLogo);
}
}
Any suggestions? Something simple I'm missing?
2025-05-30 1:55 AM
Hello @PFlor.2,
It seems you managed to solve your issue there TouchGFX dynamicBitmapCreateExternal() not working... - STMicroelectronics Community, in that case please post the solution you found and select it as a best answer so other can know too.
BR,
2025-05-30 7:14 AM - edited 2025-05-30 7:25 AM
No the other topic has not been resolved...just bypass it here by using RGB888 but the image is not displayed correctly this way. This is a separate issue
2025-05-30 7:45 AM
Start with where and how ....
(uint16_t*)myBmpCache;
const uint32_t cacheSize = sizeof(myBmpCache);
next how size?
Plus you plan store full LCD size RGB888 ?
2025-05-30 7:55 AM - edited 2025-05-30 8:37 AM
The myBmpCache is 2048 bytes...I'm not totally clear about how the dynamicBitmapCreateExternal() works and how much cache is required to display a 320x240px image at RGB565 (or RGB888 the way I'm doing it right now)
#include <gui/common/FrontendApplication.hpp>
#include <touchGFX/Bitmap.hpp>
extern "C" {
#include "../../../core/inc/opr.h"
#include "../../../core/inc/logo.h"
}
Uint8 myBmpCache[2048];
My understanding is that when using the dynamicBitmapCreateExternal() there just needs to be enough cache size for bookkeeping data used by TouchGFX...however, I am finding that when using dynamicBitmapCreate() you must have a cache large enough to hold the entire image plus bookkeeping data.