cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to use the Shape widget to paint parts of images into a Dynamic Bitmap?

scottSD
Senior III

I would like to use the Shape widget to essentially paint a masked image into a Dynamic Bitmap instead of the frame buffer. It looks like the painters are written for the frame buffer as the target.

One reason I want to do this is to reduce the number of alpha blends by blending parts of a number of images into one Dynamic Bitmap which I can then store into one Image widget on the display as a background. This would significantly improve animation performance. I need to use a Dynamic Bitmap because the background needs to be able to be determined at run time.

I have been writing my own code to add images as well as parts of images into the Dynamic Bitmap, but am wondering if it is possible to use images masked by the Shape widget to accomplish this?

I know I can place Shapes and other widgets on the display, and copy the frame buffer to a Dynamic Bitmap. I am looking for a way to do this without needing to place them on the display first.

15 REPLIES 15

Hi Scott,

You're not a pest <3 I haven't had a chance to investigate this - I'm sure you've seen the state of the community lately 🙂 And you haven't even seen my inbox.

All my time is going towards improving things in terms of community, application templates and our focused documentation-effort. I'm pretty excited to see how this will be received - It's a major lift in quality and understanding of core concepts that previously have not been documented.

I know that's a small comfort, but i really feel like i have to have some focus. But i've got this task written down at my desk, so if we're just shooting the breeze some friday at the office, then maybe..

/Martin

I know you're very busy and I really do appreciate the amount of work done on the tools. It's come along way and I am excited to see where it goes from here.

I also appreciate you saying I am not being a pest 😉

I can also imagine what your inbox looks like.

I should probably explain my reason for wanting this, and I do think that it could really improve TouchGFX having something like this.

So here goes.....

My application is going to be one where the user will need to be able to change properties on various widgets on the display. These widgets will be various shapes and circles made with bitmaps (not just a solid colors). These require alpha because their clear alpha regions will be overlapping each other in some instances.

What I want to do is improve animation. Because of the number of overlaid images I will have, the runtime of the animation is being affected by the many layers being blended. I would not need many layers if I could blend them together in a dynamic bitmap and place this dynamic bitmap in an image widget as a background.

I was able to do something almost as good as what I am asking for (although kind of a hack). I placed the shapes on the framebuffer, and before I begin animation, I capture the framebuffer, then copy it into my dynamic bitmap using copyFrameBufferRegionToMemory(). Then take this bitmap, place it in an image widget for my background. And of course make the original widgets invisible so they aren't on the framebuffer any more.

This is working very well and significantly reduces the lag I was seeing in the animation.

The shape rendering/blending to a dynamic bitmap would just improve it even more. I believe this functionality would really be a good improvement to the TouchGFX framework.

Thanks for the info. Now i have some background - Sounds like your application is making the hardware work extremely hard with all that blending :D But using an image in some way that can be blended using ChromART is the way to go.

Have you tried CacheableContainer yet? It may help you achieve something similar.

/Martin

@Martin KJELDSEN​ 

Thanks for the feedback! This is the kind of feedback that I appreciate.

I will look at CacheableContainer. I found the article https://touchgfx.zendesk.com/hc/en-us/articles/360007902520-Achieving-better-performance-with-CacheableContainer and will investigate.

@Martin KJELDSEN​ 

Thanks!

I investigated CacheableContainer and setup some experiements. From what I can tell, this is what I was looking for. I see no lag in my animation when I enable cache of the container. When I want to change a widget's properties in the cached container, I simply have to call updateCache() after making the change.

It really cleaned up my code not having to use copyFrameBufferRegionToMemory().

Thanks for pointing me in the right direction!

Awesome, @scottSD​ ! Yeah, i'll bet the code is much cleaner now 🙂

We originally created this "feature" because customers making smart-watches were having a hard time with performance doing full screen transitions with texturemapped images (hour, minute hands).

/Martin