cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic bitmap create failure

dgold.1
Associate III

Hello,

I am trying to dynamically change button frame colour
In trivial case there are premade presets as medium_outline_disabled.png (blue frame) and medium_outline_action.png (yellow frame)
I am trying to get the same behaviour for preset small_rounded_inactive.png (blue frame) and change the frame colour to yellow.
In order to do so I am using dynamic bitmaps and my plan was to change the pixel colours as in the given presets.
I am using the example from https://support.touchgfx.com/docs/development/ui-development/touchgfx-engine-features/dynamic-bitmaps
but currently the function
bmpId = Bitmap::dynamicBitmapCreate(width, height, Bitmap::ARGB8888);
returns bmpId == BITMAP_INVALID
1. Why do I get this failure and how can I fix it?
2. Is there a better way to get create custom bitmaps (in this case for buttons)?

Thank you!

1 REPLY 1
JohanAstrup
ST Employee

Hello,

First of all, if your main goal is to create a custom bitmap, you might be better of using an external image editing tool instead of doing this within TouchGFX. By doing so, you can save both versions of the bitmap in flash memory and switch between them at runtime. This approach avoids the performance hit and additional RAM usage associated with dynamic bitmaps. However, it does require more flash memory to store both the manipulated and unmanipulated versions of the bitmap.
Ultimately, the best approach depends on your specific constraints and setup. Since I don't have details about your setup, the above are just inputs to consider :)

Secondly, regarding the issue with the dynamic bitmap, could you please attach the project or alternatively provide a snippet showing the allocation of the bitmap cache? Additionally, are you experiencing this issue in the simulator or on hardware?
If the issue only occurs on hardware, I have a few further questions:
1. What hardware are you using? Is it custom or ST? What MCU are you using?
2. Is the bitmap cache allocated in internal or external RAM?
3. What is your framebuffer format?


Best regards,
Johan