?? memdev_fadein.c
字號:
*/
/*******************************************************************
*
* _DemoFade
*/
static void _DemoFade(void) {
GUI_MEMDEV_Handle hMem0, hMem1,hMem2;
GUI_RECT Rect = {0};
int x, y, v = 0, vz = 4;
hMem0 = GUI_MEMDEV_Create(0, 0, 138, 65); /* Contains the text */
hMem1 = GUI_MEMDEV_Create(0, 0, 138, 65); /* Contains the bitmap */
hMem2 = GUI_MEMDEV_Create(0, 0, 138, 65); /* Contains the fading result */
x = (319 - _bmSeggerLogoBlue.XSize) / 2;
y = (239 - _bmSeggerLogoBlue.YSize) / 3 * 2;
Rect.x1 = _bmSeggerLogoBlue.XSize - 1;
Rect.y1 = _bmSeggerLogoBlue.YSize - 1;
/* Fill memory device with some text */
GUI_MEMDEV_Select(hMem0);
GUI_SetColor(GUI_RED);
GUI_SetFont(&GUI_Font32B_ASCII);
GUI_SetTextMode(GUI_TM_TRANS);
GUI_DispStringInRect("Fade in", &Rect, GUI_TA_HCENTER | GUI_TA_VCENTER);
GUI_DrawRectEx(&Rect);
/* Fill memory device with bitmap */
GUI_MEMDEV_Select(hMem1);
GUI_DrawBitmap(&_bmSeggerLogoBlue, 0, 0);
/* Fade in loop */
while (1) {
GUI_MEMDEV_Select(hMem2);
GUI_Clear(); /* Clear memory device */
GUI_MEMDEV_Write(hMem0); /* Fill with text */
GUI_MEMDEV_WriteAlpha(hMem1, v); /* Fade in bitmap */
GUI_MEMDEV_CopyToLCDAt(hMem2, x, y); /* Copy to display */
GUI_Delay(10);
v += vz;
if ((v == 0) || (v == 256)) {
vz *= -1;
GUI_Delay(1000);
}
}
}
/*******************************************************************
*
* Public code
*
********************************************************************
*/
/*******************************************************************
*
* MainTask
*/
void MainTask(void) {
GUI_Init();
GUI_SetColor(GUI_WHITE);
GUI_SetFont(&GUI_Font24_ASCII);
GUI_DispStringHCenterAt("MEMDEV_FadeIn - sample", 160, 5);
GUI_SetFont(&GUI_Font16B_ASCII);
GUI_DispStringHCenterAt("Shows how to use memory devices\nfor a 'fade in' effect", 160, 40);
_DemoFade();
while (1) {
GUI_Delay(100);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -