Tutorial
FM4, S6E2DH/S6E2DF/S6E2D5/S6E2D3 Series, 32-Bit Microcontroller, Graphic Driver User Manual, Doc. No. 002-04387 Rev. *A
47
UTIL_SUCCESS(ret, mmlGdcDispWinCommit(wPosition));
6.6.7 Arrow Layer
The arrow layer is a one bit alpha mask only. So we have to define a constant color for the missing color data. In
addition we enable the pre-multiplication of color and alpha because the default layer blend mode expects a pre-
multiplied image and we have a constant color only.
UTIL_SUCCESS(ret, mmlGdcDispWinSetBlendMode(wArrow, MML_GDC_DISP_BLEND_SOURCE_ALPHA |
MML_GDC_DISP_BLEND_SOURCE_MULTIPLY_ALPHA));
UTIL_SUCCESS(ret, mmlGdcDispWinSetAttribute(wArrow, MML_GDC_DISP_WIN_ATTR_COLOR, 0x0000FFFF));
In the animation loop we simple change the arrow:
switch
(winker)
{
case
-1: surfArrow = sArrow_l;
break
;
case
0: surfArrow = sArrow;
break
;
case
1: surfArrow = sArrow_r;
break
;
}
/* Some 2D core drivers use layer rotation at this position to animate the arrow.
We cannot use simple rotation while using sub-windows but we can change the image.
So the following matrix calculation just moves the surface to the window center.
*/
utMat3x2LoadIdentity(mat_geo);
utMat3x2Translate(mat_geo, 25.0f, 25.0f);
utMat3x2Translate(mat_geo, (- (MM_FLOAT)utSurfWidth(sArrow) * 0.5f), (- (MM_FLOAT)utSurfHeight(sArrow) *
0.5f));
/* Set matrix */
UTIL_SUCCESS(ret, mmlGdcDispWinSetMatrix(wArrow, MML_GDC_DISP_BUFF_TARGET_COLOR_BUFF,
mat_geo));
/* Set new surface */
UTIL_SUCCESS(ret, mmlGdcDispWinSetSurface(wArrow, MML_GDC_DISP_BUFF_TARGET_COLOR_BUFF,
surfArrow));
UTIL_SUCCESS(ret, mmlGdcDispWinCommit(wArrow));