cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic bitmap in background

DVale
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

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

View solution in original post

6 REPLIES 6
Martin KJELDSEN
Chief III

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
Associate II

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
Chief III

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

DVale
Associate II

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

Daniele

Martin KJELDSEN
Chief III

You're awesome, @DVale​. Great!

/Martin

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.