2025-11-02 5:40 PM - edited 2025-11-02 5:44 PM
Hi,
I would like to capture a TextArea's content and use it with TextureMapper for scaling animation and a blurry filter effect on the bitmap data.
However, there is noise for the TextArea background in HW, but the simulator result is perfect.
The reasons for using TextureMapper with Bitmap Data:
How to create a Bitmap Data with Font/image's content without a noisy background?
----------------------------------------------------------------------------
STM32U5G9-DK Result (noise for the Background):
Simulator Result (expected):
----------------------------------------------------------------------------
The Dynamic Bitmap creation (Reference to advanceAnimationContainer.cpp in Text Animation Demo):
TestFont1Bitmap = Bitmap::dynamicBitmapCreate(Container.getWidth(), Container.getHeight(), Bitmap::ARGB8888);
touchgfx_printf("TestFont1Bitmap %d \n", TestFont1Bitmap);
if (TestFont1Bitmap != BITMAP_INVALID)
{
FontTM.setBitmap(TestFont1Bitmap);
FontTM.setPosition(50, 50, Container.getWidth(), Container.getHeight());
FontTM.setBitmapPosition(0, 0);
Container.setCacheBitmap(TestFont1Bitmap);
Container.enableCachedMode(true);
Container.updateCache();
Container.setAlpha(0);
FontTM.setupAnimation(AnimationTextureMapper::SCALE, 0.8f, 62, 0, EasingEquations::linearEaseInOut);
FontTM.startAnimation();
}---------------------------------------------------------------------------------------------------------
Please feel free to download the project for your testing.
2025-11-03 1:45 AM
Hello,
The noise you see in the dynamic bitmaps comes from the memory not being initialized. You can e.g. fix this by inserting the following between line 4 and 5 in your code snippet above:
memset((void*)TestFont1Bitmap.getData(), 0, TestFont1Bitmap.getWidth() * TestFont1Bitmap.getHeight() * 4);Be aware that you might see another glitch (with the text characters being "scrambled") when reprogramming a running board. This can be solved by power-cycling the board or by inserting the following code to the last user code section of MX_DCACHE2_Init function in main.c:
/* USER CODE BEGIN DCACHE2_Init 2 */
// Ensure that GPU2D texture cache does not hold any out-dated data from previous application
__HAL_RCC_GPU2D_CLK_ENABLE();
HAL_DCACHE_Invalidate(&hdcache2);
/* USER CODE END DCACHE2_Init 2 */Note: This code is already included when using the project template for STM32U5G9J-DK2 from TouchGFX Designer 4.26.0 and forward.
Best regards,
Peter
2025-11-03 2:39 AM
@PeterVang Thank you so much. The Noise background issue is fixed.
I got another issue that I tried to apply a Blur function to the Bitmap data, the simulator could review the result, but the Hardware failed.
Any idea about this issue?
Any Demo/ Example that applied a filter effect to the Bitmap Data?
Any plan to add a built-in filter feature in TouchGFX in the feature?
---------------------------------------------------------------------------------------------------
STM32U5G9-DK result:
| Radius = 1 | Missing TextureMapper "FontTM" |
| Radius = 2 | Triggered HardFault |
Simulator result:
| Radius = 1 | Normal |
| Radius = 2 | Normal |