Пример #1
0
/**
  * @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;
}
Пример #2
0
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);

}
Пример #3
0
/*********************************************************************
*
*       GUI_DrawBitmapEx
*/
void GUI_DrawBitmapEx(const GUI_BITMAP GUI_UNI_PTR * pBitmap, int x0, int y0,
                      int xCenter, int yCenter, int xMag, int yMag) {
  GUI_COLOR OldColor;
  #if (GUI_WINSUPPORT)
    GUI_RECT r;
  #endif
  GUI_LOCK();
  OldColor = GUI_GetColor();
  #if (GUI_WINSUPPORT)
    WM_ADDORG(x0, y0);
    if (xMag >= 0) {
      r.x0 = x0 + GUI__DivideRound32(((I32)(-xCenter) * (I32)(xMag)), 1000);
      r.x1 = x0 + GUI__DivideRound32(((I32)(pBitmap->XSize - xCenter - 1) * (I32)(xMag)), 1000);
    } else {
      r.x1 = x0 + GUI__DivideRound32(((I32)(-xCenter) * (I32)(xMag)), 1000);
      r.x0 = x0 + GUI__DivideRound32(((I32)(pBitmap->XSize - xCenter - 1) * (I32)(xMag)), 1000);
    }
    if (yMag >= 0) {
      r.y0 = y0 + GUI__DivideRound32(((I32)(-yCenter) * (I32)(yMag)), 1000);
      r.y1 = y0 + GUI__DivideRound32(((I32)(pBitmap->YSize - yCenter - 1) * (I32)(yMag)), 1000);
    } else {
      r.y1 = y0 + GUI__DivideRound32(((I32)(-yCenter) * (I32)(yMag)), 1000);
      r.y0 = y0 + GUI__DivideRound32(((I32)(pBitmap->YSize - yCenter - 1) * (I32)(yMag)), 1000);
    }
    WM_ITERATE_START(&r) {
  #endif
  GL_DrawBitmapEx(pBitmap, x0, y0, xCenter, yCenter, xMag, yMag);
  #if (GUI_WINSUPPORT)
    } WM_ITERATE_END();
  #endif
  GUI_SetColor(OldColor);
  GUI_UNLOCK();
}
Пример #4
0
/*********************************************************************
*
*       _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;
}
Пример #5
0
/*********************************************************************
*
*       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;
    }
  }
}
Пример #6
0
/*********************************************************************
*
*       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;
    }
}
Пример #7
0
void DisplayBattery(void)
{
    u16 ADC1_value; 
    u32 temp_color;
    ADC1_value = ADC_GetConversionValue(ADC1); 
    GUI_SetFont(&GUI_Font6x8);
    GUI_SetColor(GUI_WHITE);
    GUI_DispStringAt("RFID",3,0);
    temp_color=GUI_GetColor();
		GUI_SetColor(GUI_GREEN);
    if (ADC1_value > 2500)
    {
    	GUI_DrawPixel(80,3);
    	GUI_DrawPixel(80,4);
    	GUI_FillRect (81,0,95,7);
    }
    else if (ADC1_value > 2350)
    {
    	GUI_DrawPixel(80,3);
    	GUI_DrawPixel(80,4);
    	GUI_FillRect (81,0,95,7);
    	GUI_ClearRect(82,1,86,6);
    }
    else if(ADC1_value > 2300)
    {
    	GUI_DrawPixel(80,3);
    	GUI_DrawPixel(80,4);
    	GUI_FillRect (81,0,95,7);
    	GUI_ClearRect(82,1,90,6);
    }
    else
    {
    	GUI_SetColor(GUI_RED);
    	GUI_DrawPixel(80,3);
    	GUI_DrawPixel(80,4);
    	GUI_FillRect (81,0,95,7);
    	GUI_ClearRect(82,1,94,6);
    }
    GUI_SetColor(temp_color);
    GUI_SetFont(&GUI_NOW_FONT);
}
Пример #8
0
void USER_LCD_LOG_BackupColor(void)
{
  USER_LCD_LineColorBk=GUI_GetColor();
}