Skip to main content
DVale
Associate II
September 13, 2019
Solved

Dynamic bitmap in background

  • September 13, 2019
  • 6 replies
  • 3139 views

Hello,

I used the following article to have a dynamic bitmap on the screen:

https://touchgfx.zendesk.com/hc/en-us/articles/207460605-Dynamic-Bitmaps-Load-images-at-runtime

Then I draw a screen in touchgfx designer (attached designer.jpeg) where I would add a background image using dynamic bitmap.

What I actually get is in display.jpeg file (there's some aliasing but the display looks nice), if I press the area where the button are drawn it works, but the button is not visible.

How can I set dynamic bitmaps in background?

Thank you in advance,

Daniele

This topic has been closed for replies.
Best answer by Martin KJELDSEN

You can't add a dynamic bitmap directly from the designer, but you can add an image placeholder as the background image, add your button, and then later set the bitmap ID for the bitmap to be your dynamic bitmap id. When you invalidate that image it will read the image pixel data from your bitmap cache instead of somewhere in e.g. QSPI.

Does that make sense?

Another way is to reorder the way drawables are added to the view root container:

...
remove(button);
add(dynamicBmp);
add(button);
...

/Martin

6 replies

Martin KJELDSEN
Principal III
September 13, 2019

You must add your dynamic bitmap as the bottom element (The first child of the views root container). The Button must be on top to be visible.

/Martin

DVale
DValeAuthor
Associate II
September 13, 2019

Thanks for prompt answer.

Do you mean that both button and dynamic bitmap must be added in the designer? How I can add a dynamic bitmap in the designer?

Daniele

Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
September 13, 2019

You can't add a dynamic bitmap directly from the designer, but you can add an image placeholder as the background image, add your button, and then later set the bitmap ID for the bitmap to be your dynamic bitmap id. When you invalidate that image it will read the image pixel data from your bitmap cache instead of somewhere in e.g. QSPI.

Does that make sense?

Another way is to reorder the way drawables are added to the view root container:

...
remove(button);
add(dynamicBmp);
add(button);
...

/Martin

EBadi.1
Associate
September 17, 2020

Dear Martin,

So far I could place an image placeholder (with an image stored in the Flash), but I don't know how to change it to point to my ram location where I do have my camera image.

I don't know how to change the bitmap to be dynamic. Can you please provide support to me?

Thanks.

DVale
DValeAuthor
Associate II
September 16, 2019

Thank you Martin, I tested both these solutions and they work fine.

Daniele

Martin KJELDSEN
Principal III
September 16, 2019

You're awesome, @DVale​. Great!

/Martin