This article discusses additional caches that can be configured for TouchGFX in order to be able to use certain widgets and features:
- Animation Storage (Used for Snapshots)
- Canvas Widget Renderer
- Bitmap Cache (Used for Dynamic Bitmaps and Caching Bitmaps in RAM and )
The purpose of the animation storage is, primarily, to provide memory for taking a snapshot of the current contents of the frame buffer to be used during animations in TouchGFX. Currently it is used for the following in TouchGFX:
SnapShotWidget: Takes a snapshot of the currently displayed framebuffer.
SlideTransition:Uses SnapShotWidget where a snapshot of the “old” view is used in the sliding animation. If no animation storage is allocated,
SlideTransitionwill behave like
NoTransition, e.g. an non-animated change of screens.
HAL::copyFBRegionToMemory(Rect r): Can be used to copy a part of the currently displayed framebuffer to the animation storage.
- Bitmaps: The Bitmap ID
BITMAP_ANIMATION_STORAGEcan be used to display an Image that gets its data from the animation storage buffer.
In TouchGFX, the animation storage is optional, but enabled by default. If configured it is defined in external RAM beside the main frame buffer(s) and will take up the same amount of memory as one of these.
The animation storage is configured along with the starting address of the frame buffer via the
* @fn virtual void setFrameBufferStartAddress(void* adr, uint16_t depth = 16, bool useDoubleBuffering = true, bool useAnimationStorage = true);
* This function is overridden in order to detect whether it is used in single- or double buffering mode.
* @param [in] adr Starting address to use for frame buffers.
* @param depth Depth of each pixel in bits, default is 16.
* @param useDoubleBuffering If true, reserve memory for an extra frame buffer.
* @param useAnimationStorage If true, reserve memory for animation storage.
* @note Will also call the base implementation.
virtual void setFrameBufferStartAddress(void* adr, uint16_t depth = 16, bool useDoubleBuffering = true, bool useAnimationStorage = true);
- See this article for further information on using the SnapShotWidget
- See this article for further information on using Transitions
- See this article for further information on using Bitmaps with IDs that are not generated by the image converter (Dynamic Bitmaps)
- See this article for further information on copying parts of the displayed framebuffer to animation storage.
Canvas Widget Renderer
The Canvas Widget Renderer can draw lines and shapes. A buffer must be present in order to use this feature and the size of this buffer depends on the requirements of the canvas and the required performance. The following lines of code are enough to configure the buffer:
static uint8_t canvasBuffer[CANVAS_BUFFER_SIZE]; CanvasWidgetRenderer::setupBuffer(canvasBuffer, CANVAS_BUFFER_SIZE);
- Please see this article for how to use Canvas Widgets in your applications.
The bitmap cache in TouchGFX is used to create dynamic bitmaps in applications where some of the graphic content is read, at runtime, from an SD card or another input.