Skip to main content
scottSD
Senior III
December 31, 2019
Question

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

  • December 31, 2019
  • 3 replies
  • 1969 views

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.

This topic has been closed for replies.

3 replies

scottSD
scottSDAuthor
Senior III
January 8, 2020

Can anyone answer this question?

JimFouch
Associate III
January 9, 2020

I'm pretty new to TouchGFX, but as a workaround, could you stop the DMA from sending new data to the display while you render your Dynamic Bitmap and then re-enable it? This way at least your user wouldn't see the rendering. Not sure if the display would go dark, or just remain on the last image sent before you paused DMA.

Martin KJELDSEN
Principal III
January 10, 2020

@JimFouch​ It doesn't work quite like that. DMA2D (ChromART) copies data from flash to framebuffer. If it's disabled, the CPU will just do it instead (software fallback).

@scottSD​ The Painters just take a pointer in their render function and they do blend with what's already there, so i think it should be possible. I'm a little tied up right now but i'd be happy to look into this further when i can.

From AbstractPainter.hpp:

virtual void render(uint8_t* ptr, int x, int xAdjust, int y, unsigned count, const uint8_t* covers);

/Martin

scottSD
scottSDAuthor
Senior III
January 10, 2020

Martin,

Thanks for the reply. I would appreciate that. I will start to look at it as well.