/** * @brief Get the number of pixels per second * @param None * @retval Pixels per second */ static U32 _GetPixelsPerSecond(void) { GUI_COLOR Color, BkColor; U32 x0, y0, x1, y1, xSize, ySize; I32 t, t0; U32 Cnt, PixelsPerSecond, PixelCnt; /* Find an area which is not obstructed by any windows */ xSize = LCD_GetXSize(); ySize = LCD_GetYSize(); Cnt = 0; x0 = 0; x1 = xSize - 1; y0 = 65; y1 = ySize - 60 - 1; Color = GUI_GetColor(); BkColor = GUI_GetBkColor(); GUI_SetColor(BkColor); /* Repeat fill as often as possible in 100 ms */ t0 = GUI_GetTime(); do { GUI_FillRect(x0, y0, x1, y1); GUI_Exec(); Cnt++; t = GUI_GetTime(); } while ((t - (t0 + 100)) <= 0); /* Compute result */ t -= t0; PixelCnt = (x1 - x0 + 1) * (y1 - y0 + 1) * Cnt; PixelsPerSecond = PixelCnt / t * 1000; GUI_SetColor(Color); return PixelsPerSecond; }
void Draw_button(int x,int y,int w,int h,const char* text,uint32_t color,uint32_t fill_color,uint32_t textcolor){ uint32_t colormemory; uint32_t bkcolormemory; bkcolormemory=GUI_GetBkColor(); colormemory=GUI_GetColor(); GUI_SetColor(color); //if(filled){ GUI_DrawRoundedRect(x,y,x+w,y+h,10); GUI_SetColor(fill_color); GUI_FillRoundedRect(x+2,y+2,x+w-2,y+h-2,8); GUI_SetBkColor(color); //}else{ // GUI_DrawRoundedRect(x,y,x+w,y+h,10); //} GUI_SetFont(&GUI_Font16_1); GUI_SetColor(textcolor); GUI_SetBkColor(fill_color); GUI_DispStringHCenterAt(text,x+(w/2),y+h/2-8); GUI_SetBkColor(bkcolormemory); GUI_SetColor(colormemory); }
/********************************************************************* * * _GetPixelsPerSecond */ static U32 _GetPixelsPerSecond(void) { GUI_COLOR BkColor; GUI_COLOR Color; I32 PixelsPerSecond; I32 PixelCnt; I32 t0; I32 t; U32 xSize; U32 ySize; U32 Cnt; U32 x0; U32 x1; U32 y0; U32 y1; // // Find an area which is not obstructed by any windows // xSize = LCD_GetXSize(); ySize = LCD_GetYSize(); Cnt = 0; x0 = 0; x1 = xSize - 1; y0 = 65; y1 = ySize - 60 - 1; Color = GUI_GetColor(); BkColor = GUI_GetBkColor(); GUI_SetColor(BkColor); // // Repeat fill as often as possible in 100 ms // t0 = GUIDEMO_GetTime(); do { GUI_FillRect(x0, y0, x1, y1); Cnt++; t = GUIDEMO_GetTime(); } while ((t - (t0 + 100)) <= 0); // // Compute result // t -= t0; PixelCnt = (x1 - x0 + 1) * (y1 - y0 + 1) * Cnt; PixelsPerSecond = PixelCnt / t * 1000; GUI_SetColor(Color); return PixelsPerSecond; }
/********************************************************************* * * GUIPROP_DispChar * * Purpose: * This is the routine that displays a character. It is used by all * other routines which display characters as a subroutine. */ void GUIPROP_DispChar(U16P c) { int BytesPerLine; GUI_DRAWMODE DrawMode = GUI_Context.TextMode; const GUI_FONT_PROP GUI_UNI_PTR * pProp = GUIPROP_FindChar(GUI_Context.pAFont->p.pProp, c); if (pProp) { GUI_DRAWMODE OldDrawMode; const GUI_CHARINFO GUI_UNI_PTR * pCharInfo = pProp->paCharInfo+(c-pProp->First); BytesPerLine = pCharInfo->BytesPerLine; OldDrawMode = LCD_SetDrawMode(DrawMode); if (GUI_MoveRTL) { GUI_Context.DispPosX -= pCharInfo->XDist * GUI_Context.pAFont->XMag; } LCD_DrawBitmap( GUI_Context.DispPosX, GUI_Context.DispPosY, pCharInfo->XSize, GUI_Context.pAFont->YSize, GUI_Context.pAFont->XMag, GUI_Context.pAFont->YMag, 1, /* Bits per Pixel */ BytesPerLine, pCharInfo->pData, &LCD_BKCOLORINDEX ); /* Fill empty pixel lines */ if (GUI_Context.pAFont->YDist > GUI_Context.pAFont->YSize) { int YMag = GUI_Context.pAFont->YMag; int YDist = GUI_Context.pAFont->YDist * YMag; int YSize = GUI_Context.pAFont->YSize * YMag; if (DrawMode != LCD_DRAWMODE_TRANS) { LCD_COLOR OldColor = GUI_GetColor(); GUI_SetColor(GUI_GetBkColor()); LCD_FillRect(GUI_Context.DispPosX, GUI_Context.DispPosY + YSize, GUI_Context.DispPosX + pCharInfo->XSize, GUI_Context.DispPosY + YDist); GUI_SetColor(OldColor); } } LCD_SetDrawMode(OldDrawMode); /* Restore draw mode */ if (!GUI_MoveRTL) { GUI_Context.DispPosX += pCharInfo->XDist * GUI_Context.pAFont->XMag; } } }
/********************************************************************* * * GUI_SIF_DispChar */ static void _GUI_SIF_DispChar(U16P c) { const U8 * pCharInfo, * pData; pCharInfo = _GetpCharInfo(GUI_Context.pAFont, c); if (pCharInfo) { GUI_DRAWMODE DrawMode, OldDrawMode; GUI_SIF_CHARINFO CharInfo; CharInfo.XSize = GUI__Read16(&pCharInfo); CharInfo.XDist = GUI__Read16(&pCharInfo); CharInfo.BytesPerLine = GUI__Read16(&pCharInfo); GUI__Read16(&pCharInfo); /* Dummy */ CharInfo.OffData = GUI__Read32(&pCharInfo); pData = (const U8 *)GUI_Context.pAFont->p.pFontData + CharInfo.OffData; DrawMode = GUI_Context.TextMode; OldDrawMode = LCD_SetDrawMode(DrawMode); LCD_DrawBitmap(GUI_Context.DispPosX, GUI_Context.DispPosY, CharInfo.XSize, GUI_Context.pAFont->YSize, GUI_Context.pAFont->XMag, GUI_Context.pAFont->YMag, 1, CharInfo.BytesPerLine, pData, &LCD_BKCOLORINDEX); /* Fill empty pixel lines */ if (GUI_Context.pAFont->YDist > GUI_Context.pAFont->YSize) { int YMag = GUI_Context.pAFont->YMag; int YDist = GUI_Context.pAFont->YDist * YMag; int YSize = GUI_Context.pAFont->YSize * YMag; if (DrawMode != LCD_DRAWMODE_TRANS) { LCD_COLOR OldColor = GUI_GetColor(); GUI_SetColor(GUI_GetBkColor()); LCD_FillRect(GUI_Context.DispPosX, GUI_Context.DispPosY + YSize, GUI_Context.DispPosX + CharInfo.XSize, GUI_Context.DispPosY + YDist); GUI_SetColor(OldColor); } } LCD_SetDrawMode(OldDrawMode); /* Restore draw mode */ GUI_Context.DispPosX += CharInfo.XDist; } }
void AppTaskGUI(void *p_arg) { // uint8_t i; GUI_COLOR Colorsback; OS_ERR err; OSTimeGet(&err); (void) p_arg; RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_CRC, ENABLE); // ¿ªÆôCRC ¹¦ÄÜ Lcd_Init(); // LCD ³õʼ»¯ Touch_Init(); // ÏÔʾÆÁ³õʼ»¯ WM_SetCreateFlags(WM_CF_MEMDEV); // ¿ªÆô ´°¿Ú ÄÚ´æÔÊÐí GUI_Init(); // £Ç£Õ£É¿ªÊ¼ GUI_Clear(); // ÇåÆÁ // FistPageDrawLine(); // CPU_SR_ALLOC(); // CPU_CRITICAL_ENTER(); // ½ûÖ¹ÖÐ¶Ï backWIn_init(); //µ÷ÓÃÏÔʾÆÁÏÔʾ½çÃæ Draw_init(); // GUI_CURSOR_Show(); //ÏÔʾָÕë pageChangFlag=0; while(1) { if(pageChangFlag) { GUI_SelectLayer(1); GUI_TOUCH_SetLayer(1); Colorsback=GUI_GetBkColor(); GUI_SetBkColor(GUI_DARKBLUE); GUI_SetFont(GUI_FONT_8X16); GUI_DispStringAt("Station : ",10,10); GUI_DispDec(pageChangFlag,1); GUI_GotoXY(98,39); GUI_DispFloat(getInformation[pageChangFlag-1].K_tmp,4); GUI_GotoXY(98,58); GUI_DispFloat(getInformation[pageChangFlag-1].K_hemo,4); GUI_GotoXY(336,39); GUI_DispFloat(getInformation[pageChangFlag-1].T_tmp,4); GUI_GotoXY(336,58); GUI_DispFloat(getInformation[pageChangFlag-1].T_hemp,4); GUI_SetBkColor(Colorsback); DrawingNewAnew(pageChangFlag); COMAND=0x04; // ÏÔʾҳÃæ DATA=1; GUI_Delay(100); }else { GUI_SelectLayer(0); GUI_TOUCH_SetLayer(0); COMAND=0x04; // ÏÔʾҳÃæ DATA=0; showShuJu(); } GUI_Delay(300); } }