Tutorial
FM4, S6E2DH/S6E2DF/S6E2D5/S6E2D3 Series, 32-Bit Microcontroller, Graphic Driver User Manual, Doc. No. 002-04387 Rev. *A
50
6.8 Tutorial: Speedometer
6.8.1 Summary
This example realizes a simple speedometer. The aim is to use 2 layers:
One as a static background for the scale.
And one dynamic layer with a rotating needle and a fixed hub around the rotation center. The hub image has a
light shadow and must not be rotated with the needle.
The user can switch between 4 possible drawing versions which are commented on later, by pressing the "right"
button. By pressing the "left" button, the bShowDrawRects property can be toggled, which draws different rectangles
to visualize the drawing areas.
The sample uses a "single buffer render mode". However different to the Chart sample this demo uses only the
blanking period of the panel timing. That’s why it is important to use very fast render operations.
Figure 19. Expected result
6.8.2 Learning Goals
The following techniques and features are used:
Show different ways to restore and render the needle layer.
Usage of mmlGdcPeSelectArea, mmlGdcPeActiveArea and mmlGdcPeGetDrawBox.
Show the coordinate system transformation.
Use a colored 4 bit per pixel layer.
6.8.3 Chapters
1. Preparation
2. Matrix operations to scale, rotate and translate images
3. Show different versions to restore and draw the needle layer