Пример #1
0
/********************************************************************
*
*       _Draw
*
* Function description
*   Draws some coloured output to the current device (display or memory device)
*/
static void _Draw(void) {
  int i;
  GUI_SetBkColor(GUI_YELLOW);
  GUI_ClearRect(0, 75, 319, 138);
  GUI_SetColor(GUI_RED);
  GUI_SetFont(&GUI_Font32B_ASCII);
  GUI_DispStringHCenterAt("Printing demo", 160, 75);
  for (i = 0; i < 12; i += 2) {
    GUI_SetColor(GUI_GREEN);
    GUI_DrawRect(5 + i, 80 + i, 50 - i, 101 - i);
    GUI_SetColor(GUI_BLUE);
    GUI_DrawRect(269 + i, 80 + i, 314 - i, 101 - i);
  }
  for (i = 0; i < 32; i += 8) {
    GUI_SetColor(GUI_BLUE);
    GUI_FillRect(0, 107 + i, 319, 110 + i);
    GUI_SetColor(GUI_YELLOW);
    GUI_FillRect(0, 111 + i, 319, 114 + i);
  }
  i = 8;
  _DrawBitmap(&bmTestPicture1, i +   0, 111, 0, 0);
  _DrawBitmap(&bmTestPicture1, i +  35, 111, 1, 0);
  _DrawBitmap(&bmTestPicture1, i +  70, 111, 0, 1);
  _DrawBitmap(&bmTestPicture2, i + 105, 111, 0, 0);
  _DrawBitmap(&bmTestPicture2, i + 140, 111, 1, 0);
  _DrawBitmap(&bmTestPicture4, i + 175, 111, 0, 0);
  _DrawBitmap(&bmTestPicture4, i + 210, 111, 1, 0);
  _DrawBitmap(&bmTestPicture8, i + 245, 111, 0, 0);
  _DrawBitmap(&bmTestPicture8, i + 280, 111, 1, 0);
}
Пример #2
0
static void _Paint(FRAMEWIN_Obj* pObj) {
  WM_HWIN hWin = WM_GetActiveWindow();
  int xsize = WM_GetWindowSizeX(hWin);
  int ysize = WM_GetWindowSizeY(hWin);
  int FrameSize = pObj->FrameSize;
  GUI_RECT rClient; GUI_GetClientRect(&rClient);
  GUI_SetFont(pObj->pFont);
/* Draw Title */
  GUI_SetBkColor((pObj->Widget.State & WIDGET_STATE_CHILD_HAS_FOCUS) ? pObj->BarColor[1] : pObj->BarColor[0]);
  GUI_SetColor  (pObj->TextColor);
  GUI_SetTextAlign(pObj->TextAlign);
	GUI_ClearRect(FrameSize,FrameSize, xsize-1-FrameSize, FrameSize+pObj->rClient.y0-1);
  GUI_DispStringAt( pObj->pText,
                   FrameSize+pObj->XOff,
                   FrameSize+pObj->YOff);
/* Draw Frame */
  GUI_SetColor  (FRAMEWIN_FRAMECOLOR_DEFAULT);  /* pObj->BarColor[1]*/
  GUI_FillRect  (0, 0, xsize-1, FrameSize-1);
	GUI_FillRect  (0, 0, pObj->rClient.x0-1, ysize-1);
	GUI_FillRect  (pObj->rClient.x1+1, 0, xsize-1, ysize-1);
  GUI_FillRect  (0, pObj->rClient.y1+1, xsize-1, ysize-1);
  GUI_FillRect  (0, pObj->TitleHeight+FrameSize,
                    xsize-1, pObj->TitleHeight+2*FrameSize-1);
/* Draw Client area */
  WM_SetUserClipArea(&pObj->rClient);
  /*GUI_SetBkColor(pObj->ClientColor);
  GUI_Clear();*/
  WM_SetUserClipArea(NULL);
/* Draw the 3D effect (if configured) */
  #if FRAMEWIN_USE_3D
    WIDGET_EFFECT_3D_DrawUp();
  #endif
  
}
Пример #3
0
static void PaintDialog(WM_MESSAGE * pMsg)
{
    WM_HWIN hWin = pMsg->hWin;
    GUI_SetColor(0xe35400);
    GUI_FillRect(0,0,159,2);
    GUI_SetColor(0xff953d);
    GUI_FillRect(0,0,2,239);
    GUI_SetColor(0xff953d);
    GUI_FillRect(0,231,159,239);
    GUI_SetColor(0xe35400);
    GUI_FillRect(151,0,159,239);
}
Пример #4
0
/*********************************************************************
*
*       _OnPaint

  This routine draws the color rectangles.
  The widgets are drawn automatically.
*/
static void _OnPaint(void) {
  /* Draw RGB values */
  GUI_SetColor(_aColorSep[0]);
  GUI_FillRect(180, 20, 199, 39);
  GUI_SetColor(_aColorSep[1] << 8);
  GUI_FillRect(180, 50, 199, 69);
  GUI_SetColor(((U32)_aColorSep[2]) << 16);
  GUI_FillRect(180, 80, 199, 99);
  /* Draw resulting color */
  GUI_SetColor(_aColorSep[0] | (((U32)_aColorSep[1]) << 8) | (((U32)_aColorSep[2]) << 16));
  GUI_FillRect(205, 20, 285, 99);
}
Пример #5
0
/*********************************************************************************************************
** Function name:           Display_Logo	   
** Descriptions:            Display logo	
** input parameters:        none
** output parameters:       none      
** Returned value:          void
** Changed by:              Lius 2014-8-18  
*********************************************************************************************************/
void Display_Logo()
{
	GUI_SetColor(GUI_WHITE);
	GUI_FillRect(0,0,C_GLCD_H_SIZE,C_GLCD_V_SIZE);
	GUI_DrawBitmap(&bmG631Y2,87,54);		
	GPIO_SetValue(2,LCD_BACK_LIGHT);		
}
/**
  * @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;
}
Пример #7
0
void key_s3c(void)
{
int which_key,i;
while((rPDATG & 0xf0)==0xf0);
which_key=rPDATG&0xf0;
    switch(which_key)
    {
case 0xe0:
   Led_Display(0x1);
   point.y_point-=20;
   if(point.y_point<20)
   point.y_point=200;
   break;
case 0xd0:
   Led_Display(0x2);
   point.x_point-=20;
   if(point.x_point<20)
   point.x_point=200;
   break;
case 0xb0:
   Led_Display(0x4);
   if( map[point.y_map][point.x_map]==0 )
{
change_color();
map[point.y_map][point.x_map]=point.color;
draw_map();

if( if_won(point.y_map,point.x_map,point.color) )
{
GUI_SetTextMode(GUI_DM_TRANS); //设置为透明
GUI_SetFont(&GUI_Font8x16x1x2);
GUI_DispStringAt("win!",250,90);

for(i=0;i<20;i++)
GUI_Delay(1000);
map_initial();

GUI_SetDrawMode(GUI_DM_NORMAL);
GUI_SetColor(GUI_GREEN);
GUI_FillRect(0,0,320,240);
draw_net();
draw_point();
}

}
   break;
case 0x70:
   Led_Display(0x7);
   /*
   point.x_point+=20;
   if(point.x_point>200)
   point.x_point-=20;*/
   break;
default :
   break;
    }
    
    
}
Пример #8
0
/**
  * @brief  Display the application header on the USER_LCD screen 
  * @param  header: pointer to the string to be displayed
  * @retval None
  */
void USER_LCD_LOG_SetTestArea (uint16_t x0,uint16_t y0,uint16_t xSize,uint16_t ySize)
{
  GUI_SetFont(&USER_LCD_LOG_TEXT_FONT);
  GUI_SetColor(USER_LCD_LOG_BACKGROUND_COLOR);
  GUI_FillRect(x0, y0-GUI_GetFontSizeY(), x0+xSize, y0+ySize);
  GUI_SetColor(USER_LCD_LOG_BACKGROUND_COLOR_EX);
  GUI_DrawRect(x0, y0-GUI_GetFontSizeY(), x0+xSize, y0+ySize);
}
Пример #9
0
void CheckBoxMenu::clearInner()
{
	GUI_SetColor(MENU_TEXT_BK_NORMAL_COLOR);
	GUI_FillRect(x0+CheckBox_A_margin+CheckBox_A_padding,
			y0+CheckBox_A_margin+CheckBox_A_padding,
			x0+CheckBox_A_margin+CheckBox_A_padding+getAS(),
			y0+CheckBox_A_margin+CheckBox_A_padding+getAS());
}
/*********************************************************************
*
*       _AnimFillRect
*/
static void _AnimFillRect(GUI_ANIM_INFO * pInfo, void * pVoid) {
  ANIM_DATA * pData;
  static int xPosOld;

  _PrepareDrawing(pInfo, pVoid, &pData, xPosOld, 3);
  GUI_FillRect(pData->xPos - pData->ObjectSize, pData->yPos - pData->ObjectSize, pData->xPos + pData->ObjectSize, pData->yPos + pData->ObjectSize);
  xPosOld = pData->xPos;
}
Пример #11
0
void CheckBoxMenu::drawInner()
{
	GUI_SetColor(CHECKBOX_INNER_COLOR);
	GUI_FillRect(x0+CheckBox_A_margin+CheckBox_A_padding,
			y0+CheckBox_A_margin+CheckBox_A_padding,
			x0+CheckBox_A_margin+CheckBox_A_padding+getAS(),
			y0+CheckBox_A_margin+CheckBox_A_padding+getAS());
}
Пример #12
0
/*********************************************************************
*
*       _OnPaint
*/
static void _OnPaint(void) {
  int xPos = 0;
  GUI_RECT Rect;
  GUI_SetBkColor(GUI_GRAY);
  GUI_Clear();
  WM_GetClientRect(&Rect);
  Rect.x1 = HEADER_GetItemWidth(_hHeader, 0);
  GUI_SetColor(GUI_RED);
  GUI_FillRect(Rect.x0, Rect.y0, Rect.x1, Rect.y1);
  Rect.x0 = Rect.x1;
  Rect.x1 += HEADER_GetItemWidth(_hHeader, 1);
  GUI_SetColor(GUI_GREEN);
  GUI_FillRect(Rect.x0, Rect.y0, Rect.x1, Rect.y1);
  Rect.x0 = Rect.x1;
  Rect.x1 += HEADER_GetItemWidth(_hHeader, 2);
  GUI_SetColor(GUI_BLUE);
  GUI_FillRect(Rect.x0, Rect.y0, Rect.x1, Rect.y1);
}
Пример #13
0
void Rectangle::fill(int arg)
{
	if(GUI_COLOR_NONE!=arg)
	{
		GUI_SetColor(arg);
		GUI_FillRect(x0, y0, x1, y1);
	}

}
/**
  * @brief  Run speed test
  * @param  None
  * @retval Pixels per second
  */
static int Run_SpeedTest(void) {
  int      TimeStart, i;
  U32      PixelsPerSecond;
  unsigned aColorIndex[8];
  int      xSize, ySize, vySize;
  GUI_RECT Rect, ClipRect;
  xSize  = LCD_GetXSize();
  ySize  = LCD_GetYSize();
  vySize = LCD_GetVYSize();
#if GUI_SUPPORT_CURSOR
  GUI_CURSOR_Hide();
#endif
  if (vySize > ySize) {
    ClipRect.x0 = 0;
    ClipRect.y0 = 0;
    ClipRect.x1 = xSize;
    ClipRect.y1 = ySize;
    GUI_SetClipRect(&ClipRect);
  }

  Stop_Test = 0;

  for (i = 0; i< 8; i++) {
    aColorIndex[i] = GUI_Color2Index(_aColor[i]);
  }
  TimeStart = GUI_GetTime();
  for (i = 0; ((GUI_GetTime() - TimeStart) < 5000) &&( Stop_Test == 0); i++) {
    GUI_SetColorIndex(aColorIndex[i&7]);

    /* Calculate random positions */
    Rect.x0 = rand() % xSize - xSize / 2;
    Rect.y0 = rand() % ySize - ySize / 2;
    Rect.x1 = Rect.x0 + 20 + rand() % xSize;
    Rect.y1 = Rect.y0 + 20 + rand() % ySize;
    GUI_FillRect(Rect.x0, Rect.y0, Rect.x1, Rect.y1);

    /* Clip rectangle to visible area and add the number of pixels (for speed computation) */
    if (Rect.x1 >= xSize) {
      Rect.x1 = xSize - 1;
    }
    if (Rect.y1 >= ySize) {
      Rect.y1 = ySize - 1;
    }
    if (Rect.x0 < 0 ) {
      Rect.x0 = 0;
    }
    if (Rect.y1 < 0) {
      Rect.y1 = 0;
    }
    GUI_Exec();
    /* Allow short breaks so we do not use all available CPU time ... */
  }
  PixelsPerSecond = _GetPixelsPerSecond();
  GUI_SetClipRect(NULL);
  return PixelsPerSecond;
}
Пример #15
0
//@@@@@@@@@@@@@@@@@@@@  覆盖背景,重画方格 @@@@@@@@@@@@@@@@@@@@@@
void display_all(void)
{
GUI_SetColor(GUI_GREEN);
GUI_FillRect(0,0,320,240);

draw_net();
draw_map();
draw_point();

}
Пример #16
0
/*********************************************************************
*
*       _DrawDiagramAt
*/
static void _DrawDiagramAt(GUI_MEMDEV_Handle hMem, int xPos, int yPos, int * py, int xBlend) {
  GUI_MEMDEV_Handle hMemOld;
  GUI_RECT          Rect;
  int               IndexBmBar;
  int               ySizeBar;
  int               i;

  hMemOld = GUI_MEMDEV_Select(hMem);
  //
  // Draw blue background
  //
  GUI_SetColor(0x4a2210);
  GUI_FillRoundedRect(xPos, yPos, xPos + GRAPH_WIDTH, yPos + GRAPH_HEIGHT, 4);
  //
  // Draw grid lines
  //
  GUI_SetColor(0x774830);
  for (i = 0; i < 12; i++) {
    GUI_DrawHLine(yPos + 6 + i * 10, xPos + 2, xPos + GRAPH_WIDTH - 2);
  }
  //
  // Draw bars
  //
  for (i = 0; i < 10; i++) {
    IndexBmBar = (i < 6) ? i / 2 : 4 - (i / 2);
    ySizeBar = *(py + i);
    GUI_DrawBitmapMag(_apBmBar[IndexBmBar], xPos + 8 + i * 16, yPos + GRAPH_HEIGHT - ySizeBar - 6, 1, ySizeBar);
  }
  //
  // Draw alpha effect
  //
  Rect.x0 = xPos;
  Rect.x1 = xPos + 3;
  Rect.y0 = yPos;
  Rect.y1 = yPos + GRAPH_HEIGHT;
  GUI_SetClipRect(&Rect);
  GUI_SetColor(0xd99100);
  GUI_SetAlpha(168);
  GUI_FillRoundedRect(xPos, yPos, xPos + GRAPH_WIDTH, yPos + GRAPH_HEIGHT, 4);
  GUI_SetClipRect(NULL);
  GUI_FillRect(xPos + 4, yPos + 1, xPos + xBlend, yPos + GRAPH_HEIGHT - 1);
  GUI_SetAlpha(0);
  //
  // Draw orange frame
  //
  GUI_SetColor(0x0094f3);
  GUI_DrawRoundedRect(xPos, yPos, xPos + GRAPH_WIDTH, yPos + GRAPH_HEIGHT, 4);
  //
  // Label
  //
  _DrawLabel(hMem, xPos, yPos);
  GUI_MEMDEV_CopyToLCD(hMem);
  GUI_MEMDEV_Select(hMemOld);
}
Пример #17
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);
}
Пример #18
0
/**
  * @brief  Callback routine of the status bar
  * @param  pMsg: pointer to a data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbStatus(WM_MESSAGE* pMsg) {
	int xSize, ySize;
	static uint8_t TempStr[50];
	static WM_HTIMER hTimerTime;
	WM_HWIN hWin;

	hWin = pMsg->hWin;
	switch (pMsg->MsgId) {
		case WM_CREATE:
			hTimerTime = WM_CreateTimer(hWin, ID_TIMER_TIME, 1000, 0);
			break;
		case WM_DELETE:
			WM_DeleteTimer(hTimerTime);
			break;
		case WM_TIMER:
			WM_InvalidateWindow(hWin);
			WM_RestartTimer(pMsg->Data.v, 0);
			break;
		case WM_PAINT:
			xSize = WM_GetWindowSizeX(hWin);
			ySize = WM_GetWindowSizeY(hWin);
			/* Draw background */
			GUI_SetColor(0x303030);
			GUI_FillRect(0, 0, xSize, ySize - 3);
			GUI_SetColor(0x808080);
			GUI_DrawHLine(ySize - 2, 0, xSize);
			GUI_SetColor(0x404040);
			GUI_DrawHLine(ySize - 1, 0, xSize);
			GUI_SetTextMode(GUI_TM_TRANS);
			GUI_SetColor(GUI_WHITE);
			GUI_SetFont(GUI_FONT_13B_ASCII);
			/* Serial port*/
			if (pdTRUE == BluetoothReady) {
				GUI_DrawBitmap(&bmICON_BluetoothStatus, xSize - 155, 0);
			}
			if (pdTRUE == GPSReady) {
				GUI_DrawBitmap(&bmICON_GPS_Status, xSize - 125, 0);
			}
			sprintf((char *)TempStr, "CPU : %d %%", FreeRTOS_GetCPUUsage());
			if (75 > FreeRTOS_GetCPUUsage()) {
				GUI_SetColor(GUI_WHITE);
			}
			else {
				GUI_SetColor(GUI_RED);
			}
			GUI_DispStringAt((char *)TempStr, 4, 4);
			GUI_SetColor(GUI_WHITE);
			break;
		default:
			WM_DefaultProc(pMsg);
		break;
	}
}
Пример #19
0
/*******************************************************************
*
*       _DrawIt
*/
static void _DrawIt(void * pData) {
  tDrawItContext * pDrawItContext = (tDrawItContext *)pData;
  GUI_Clear();
  GUI_SetFont(&GUI_Font8x8);
  GUI_SetTextMode(GUI_TM_TRANS);
  /* draw background */
  GUI_SetColor(GUI_GREEN);
  GUI_FillRect(pDrawItContext->XPos_Text, 
               pDrawItContext->YPos_Text - 25,
               pDrawItContext->XPos_Text + 100,
               pDrawItContext->YPos_Text - 5);
  /* draw polygon */
  GUI_SetColor(GUI_BLUE);
  GUI_FillPolygon(pDrawItContext->aPointsDest, SIZE_OF_ARRAY(aPoints), 160, 120);
  /* draw foreground */
  GUI_SetColor(GUI_RED);
  GUI_FillRect(220 - pDrawItContext->XPos_Text, 
               pDrawItContext->YPos_Text + 5,
               220 - pDrawItContext->XPos_Text + 100,
               pDrawItContext->YPos_Text + 25);
}
Пример #20
0
void vCardDisplay( void )
{
    char fullname[64];
    
    if( empty == 2 )
        return;

    WM_SetDesktopColor(GUI_WHITE);
    GUI_SetColor(GUI_BLACK);
    GUI_SetBkColor(GUI_WHITE);
    GUI_Clear();
    GUI_GIF_Draw((const void *)aclogo_silica_11022010, sizeof(aclogo_silica_11022010), 100, 0);

    strcpy( fullname, data->nameFirstname );
    strcat( fullname, " " );
    strcat( fullname, data->nameLastname );
    GUI_SetFont(&GUI_Font24B_ASCII);
    GUI_DispStringAt( fullname, 20, 70);
    GUI_SetFont(&GUI_Font16B_ASCII);
    GUI_DispStringAt( data->CompName, 20, X_firm);
    GUI_SetFont(&GUI_Font13_ASCII);
    GUI_DispStringAt( data->CompStreet, 20, X_firm+16);    
    GUI_DispStringAt( data->CompCity, 20, X_firm+16+13);
    
    strcpy( fullname, data->CompZip );
    strcat( fullname, " " );
    strcat( fullname, data->CompState );
    strcat( fullname, " " );
    strcat( fullname, data->CompCountry );
    GUI_DispStringAt( fullname, 20, X_firm+16+13+13);    
    
    strcpy( fullname, "TEL : " );
    strcat( fullname, data->CompPhone );
    GUI_DispStringAt( fullname, 20, X_tel);    
    
    strcpy( fullname, "FAX : " );
    strcat( fullname, data->CompFax );
    GUI_DispStringAt( fullname, 20, X_tel+13);    
    
    strcpy( fullname, "CELL : " );
    strcat( fullname, data->ContactCellPho );
    GUI_DispStringAt( fullname, 20, X_tel+13+13);    

    GUI_SetColor( (GUI_COLOR)0x007f7f7f );
    GUI_FillRect( 0, 214, 319, 239 );
    GUI_SetBkColor((GUI_COLOR)0x007f7f7f);
    GUI_SetColor(GUI_RED);
    GUI_SetFont(&GUI_Font16B_ASCII);
    GUI_DispStringAt( "The Engineering of Distribution.", 20, 220);

    empty = 2;
}
Пример #21
0
void GUIDEMO_Speed(void) {
  int t = GUI_GetTime();
  int i = 0;
  int XSize = LCD_GET_XSIZE();
  int YSize = LCD_GET_YSIZE();
  I32 NumPixels=0;
  U16 aColorIndex[8];
  GUIDEMO_ShowIntro("High speed",
                    "Multi layer clipping"
                    "\nHighly optimized drivers"
                    );
  for (i = 0; i< 8; i++) {
    aColorIndex[i] = GUI_Color2Index(_aColor[i]);
  }  
  for (i = 0; (((t + 8000) - (int)GUI_GetTime()) > 0) && !GUIDEMO_CheckCancel(); i++) {
    GUI_RECT r;
    GUI_SetColorIndex(aColorIndex[i&7]);
    /* Calculate random positions */
    r.x0 = rand() % XSize - XSize / 2;
    r.y0 = rand() % YSize - YSize / 2;
    r.x1 = r.x0 + rand() % XSize;
    r.y1 = r.y0 + rand() % YSize;
    GUI_FillRect(r.x0, r.y0, r.x1, r.y1);
    /* Clip rectangle to visible area and add the number of pixels (for speed computation) */
    if (r.x1 >= XSize)
      r.x1 = XSize - 1;
    if (r.y1 >= YSize)
      r.y1 = YSize - 1;
    if (r.x0 < 0 )
      r.x0 = 0;
    if (r.y1 < 0)
      r.y1 = 0;
    NumPixels += (r.x1 - r.x0) * (r.y1 - r.y0);
    /* Allow short breaks so we do not use all available CPU time ... */
  }
  t = (GUI_GetTime() - t) / 100;
  GUI_Clear();
  GUIDEMO_NotifyStartNext();
  #if GUIDEMO_LARGE
    GUI_SetFont(&GUI_FontComic24B_ASCII);
  #else
    GUI_SetFont(&GUI_Font16B_ASCII);
  #endif
  GUI_SetColor(GUI_WHITE);
  GUI_DispStringAt("Pixels/sec: ", 10, (LCD_GetYSize() - GUI_GetFontSizeY()) / 2);
  if (t == 0)
    t++;
  GUI_DispDecMin(10 * (NumPixels / t));
  GUIDEMO_Wait();
}
Пример #22
0
/*********************************************************************
*
*       _Paint
*/
static void _Paint_PopupWin(WM_HWIN hWin)
{
    GUI_RECT          WinRect;
    xIconSelBtn_OBJ   *pWidget;
    xICON *pIcon;
    xICON_CHECK_XY *pIconChkXY;
    int i;
    
    if(!hWin) return;
    
    DEBUGOUT("xIconSelBtn::PopupWin hWin = 0x%08x\r\n", hWin);
    WM_GetClientRect(&WinRect);
    DEBUGOUT("xIconSelBtn::PopupWin Paint(%d,%d,%d,%d)\r\n",WinRect.x0, WinRect.y0, WinRect.x1, WinRect.y1);
    
    WM_GetUserData(hWin, &pWidget, sizeof(xIconSelBtn_OBJ*));
    
    //Draw Window Background area
    GUI_SetColor(pWidget->PopupWinBkColor[1]); //Base Color
    GUI_FillRoundedRect(WinRect.x0+1,WinRect.y0+1,WinRect.x1-1,WinRect.y1-1, 2);
    GUI_SetColor(pWidget->PopupWinBkColor[0]); //OutLine Color
    GUI_DrawRoundedRect(WinRect.x0,WinRect.y0,WinRect.x1,WinRect.y1, 2);
    
    //Draw icons BMP
    for(i=0; i<pWidget->NumItems; i++)
    {
        pIcon= &pWidget->xIconArray[i];
        pIconChkXY = &pWidget->xIconCheckXyArray[i];
        
        if(pIcon->pBMP)
        {
            if(i == pWidget->MovingIndex)
            {
                //Draw Forcus Frame on Icon BMP outside
                int x0 = pIcon->x0 - pWidget->IconFocusFrameHWidth;
                int y0 = pIcon->y0 - pWidget->IconFocusFrameVWidth;
                int x1, y1;
                x1 = x0 + pIcon->pBMP->XSize + (pWidget->IconFocusFrameHWidth*2);
                y1 = y0 + pIcon->pBMP->YSize + (pWidget->IconFocusFrameVWidth*2);
                GUI_SetColor(pWidget->PopupWinIconFocusColor);
                GUI_FillRect(x0, y0, x1, y1);
            }
            GUI_DrawBitmap(pIcon->pBMP, pIcon->x0, pIcon->y0);
        }
        if( (pWidget->pCheckedBMP) && (i == pWidget->SelectedIndex) )
        {
            GUI_DrawBitmap(pWidget->pCheckedBMP, pIconChkXY->x0, pIconChkXY->y0);
        }
    }
}
Пример #23
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;
}
Пример #24
0
void OUI_DrawElementData(Element * This, uint16_t x, uint16_t y){
	if(This->Redraw){
		GUI_SetColor(OUI_BAR_BACKGROUND);
		GUI_FillRect(x, y, x+62, y+29);
		GUI_SetBkColor(OUI_BAR_BACKGROUND);
		GUI_SetColor(GUI_WHITE);
		GUI_RECT dispRect;
		dispRect.x0 = x+1;
		dispRect.y0 = y+1;
		dispRect.x1 = x+62;
		dispRect.y1 = y+28;
		GUI_SetFont(&GUI_Font8_1);
		GUI_DispStringInRect(This->Text, &dispRect, GUI_TA_TOP | GUI_TA_HCENTER);
		GUI_SetFont(&GUI_Font16_1);
		GUI_DispStringInRect(This->Text, &dispRect, GUI_TA_BOTTOM | GUI_TA_HCENTER);
		This->Redraw = 0;
	}
}
Пример #25
0
/**
  * @brief  Displays a maximum of 60 char on the USER_LCD.
  * @param  X: pointer to x position (in pixel)
  * @param  Y: pointer to y position (in pixel)    
  * @param  pText: pointer to string to display on USER_LCD
  * @param  mode: The display mode
  *    This parameter can be one of the following values:
  *                @arg CENTER_MODE 
  *                @arg RIGHT_MODE
  *                @arg LEFT_MODE   
  * @retval None
  */
void USER_LCD_LOG_DisplayStringAt(uint16_t X, uint16_t Y, char *pText, USER_Text_AlignModeTypdef mode, GUI_COLOR color)
{
  
  /* Clear first */
  GUI_SetFont(&USER_LCD_LOG_TEXT_FONT);
  #ifdef __USER_USE_SOLID_BK_
  GUI_SetColor(USER_LCD_LOG_BACKGROUND_COLOR);
  GUI_FillRect(X,Y,X0+XSIZE,Y+GUI_GetFontSizeY());
  #endif
  GUI_SetColor(color);
  GUI_SetTextMode(GUI_TEXTMODE_TRANS);
  switch (mode)
  {
  case USER_CENTER_MODE:
    {
      GUI_SetTextAlign(GUI_TA_HCENTER);
      //GUI_DispStringAtCEOL(pText,X,Y);
      GUI_DispStringAt(pText,X,Y);
      break;
    }
  case USER_LEFT_MODE:
    {
      GUI_SetTextAlign(GUI_TA_LEFT);
      //GUI_DispStringAtCEOL(pText,X,Y);
      GUI_DispStringAt(pText,X,Y);
      break;
    }
  case USER_RIGHT_MODE:
    {
      GUI_SetTextAlign(GUI_TA_RIGHT);
      //GUI_DispStringAtCEOL(pText,X,Y);
      GUI_DispStringAt(pText,X,Y);
      break;
    }
  default:
    {
      GUI_SetTextAlign(GUI_TA_LEFT);
      //GUI_DispStringAtCEOL(pText,X,Y);
      GUI_DispStringAt(pText,X,Y);
      break;
    }
  }
}
Пример #26
0
void showTime( /*char *cardType,  uint8_t *bUidPresent, uint8_t *nCardDetected, uint8_t *nCardPrevious*/)
{
	  char msg[100];

	  Chip_RTC_GetFullTime(&FullTime);
	    sprintf( msg, "%.2d:%.2d:%.2d %.2d/%.2d/%.4d\r\n", FullTime.time[2],
	    		FullTime.time[1],
	    		FullTime.time[0],
	    		FullTime.time[3],
	    		FullTime.time[6],
	    		FullTime.time[7]);

	    GUI_SetColor(GUI_WHITE);
	    GUI_FillRect( 0, 214, 317, 214 );
	    GUI_SetFont(&GUI_Font24B_ASCII);
	    GUI_DispStringAt( msg, 60, 215);
	    GUI_SetColor(GUI_GREEN);

}
Пример #27
0
void vCardUID( char *cardType, uint8_t *bUidPresent, uint8_t *nCardDetected, uint8_t *nCardPrevious ){

  char msg[20];

/*  if( empty == 1 || empty == 2 ) {	// to trovato almeno una vCard
    return;
  }*/

  if (nCardDetected==nCardPrevious){
	  return;
  }
  WM_SetDesktopColor(GUI_BLACK);
  GUI_SetBkColor(GUI_BLACK);
  GUI_SetColor(GUI_GREEN);
  GUI_Clear();

//  GUI_SetFont(&GUI_Font32B_ASCII);
//  GUI_DispStringAt( cardType, 120-strlen(cardType)*10/2, 20);
  if( bUidPresent != NULL )
  {
	  int i=0;
	  for (i=0;i<nCardDetected;i++){
	    sprintf( msg, "UID %02X : %02X%02X%02X%02X", i+1, bUidPresent[4*i+0], bUidPresent[4*i+1], bUidPresent[4*i+2], bUidPresent[4*i+3] );
	    GUI_DispStringAt( msg, 0, 20*i+20);
	  }

/*
	    sprintf( msg, "UID 01 : %02X%02X%02X%02X", bUidPresent[0], bUidPresent[1], bUidPresent[2], bUidPresent[3] );
	    GUI_DispStringAt( msg, 0, 80);
	    sprintf( msg, "UID 02 : %02X%02X%02X%02X", bUidPresent[4], bUidPresent[5], bUidPresent[6], bUidPresent[7] );
	    GUI_DispStringAt( msg, 0, 120);
*/
  }
  GUI_SetColor( (GUI_COLOR)0x003f3f3f );
  GUI_FillRect( 0, 214, 319, 239 );
  GUI_SetBkColor((GUI_COLOR)0x003f3f3f);
  GUI_SetColor(GUI_RED);
  GUI_SetFont(&GUI_Font24B_ASCII);
  GUI_DispStringAt( "Reading Card", 80, 215);

  empty = 1;
}
void MainTask(void) {
  //
  // Init GUI
  //
  WM_SetCreateFlags(WM_CF_MEMDEV);
  GUI_Init();
  #if GUI_SUPPORT_CURSOR
    GUI_CURSOR_Hide();  // Hide cursor before first page is shown
  #endif
  //
  // Show SEGGER logo
  //
  GUI_Clear();
  GUI_SetColor(GUI_WHITE);
  GUI_FillRect(0, 0, LCD_GetXSize(), LCD_GetYSize());
  GUI_DrawBitmap(&bmIMAGE_SeggerLogo_300x150_565c, (LCD_GetXSize() - 300) / 2, (LCD_GetYSize() - 150) / 2);
  GUI_X_Delay(SEGGERDEMO_DELAY);
  GUI_Clear();
  //
  // Start GUIDEMO samples, GUIDEMO_Main is an endless loop itself. Therefor we can start it as task directly.
  //
  GUIDEMO_Main();
}
Пример #29
0
/**
  * @brief  Callback routine of desktop window status.
  * @param  pMsg: pointer to data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbStatus(WM_MESSAGE * pMsg) {
  int xSize, ySize;
  static uint8_t TempStr[50];
  static WM_HTIMER hTimerTime;
	uint8_t res = 0;
  //static WM_HTIMER hSpriteTime;  

  RTC_TimeTypeDef   RTC_Time;
  RTC_DateTypeDef   RTC_DateStructure;
  uint8_t sec, min, hour, day, month;
  uint16_t year;
  WM_HWIN hWin;
	uint16_t PosDisplay;

  hWin = pMsg->hWin;
  switch (pMsg->MsgId) 
  {
  case WM_CREATE:
    hTimerTime = WM_CreateTimer(hWin, ID_TIMER_TIME, 1000, 0);
    break;
    
  case WM_DELETE:
    WM_DeleteTimer(hTimerTime);
    break;
    
  case WM_TIMER:
    if( WM_GetTimerId(pMsg->Data.v) == ID_TIMER_TIME)
    {
      WM_InvalidateWindow(hWin);
      WM_RestartTimer(pMsg->Data.v, 1000);
    }
    break;
    
  case WM_PAINT:
    xSize = WM_GetWindowSizeX(hWin);
    ySize = WM_GetWindowSizeY(hWin);
		PosDisplay = xSize;
    
		/* Draw background */
		//GUI_SetColor(0x808080);
    //GUI_SetColor(0x742E1B);
		GUI_SetColor(0x000000);
		GUI_FillRect(0, 0, xSize - 1, ySize - 1);
    
		// status
		GUI_SetTextMode(GUI_TM_TRANS);
    GUI_SetColor(GUI_WHITE);
    GUI_SetFont(&GUI_FontHZ_Song_16);
		GUI_DispStringAt( (char *)StatusText, 4, 4);
	
    /* Draw time & Date */
    GUI_SetTextMode(GUI_TM_TRANS);
    GUI_SetColor(GUI_WHITE);
    GUI_SetFont(GUI_FONT_13B_ASCII);
    //time
    k_GetTime(&RTC_Time);
    sec    =  RTC_Time.Seconds;
    min    =  RTC_Time.Minutes;
    hour   =  RTC_Time.Hours;
    sprintf((char *)TempStr, "%02d:%02d:%02d", hour , min, sec);
    //sprintf((char *)TempStr, "%02d:%02d", hour , min);
		PosDisplay-=60;
		GUI_DispStringAt((char *)TempStr, PosDisplay, 0);
		//date
    k_GetDate(&RTC_DateStructure);
    year =  RTC_DateStructure.Year + 2014;
    month =  RTC_DateStructure.Month;
    day =  RTC_DateStructure.Date;
    if((day > 0) && (day <= 31) && (month > 0)&& (month <= 12) && (year >= 1900))
    {
      sprintf((char *)TempStr, "%04d/%s/%02d", year, strMonth[month-1], day);
    }
    else
    {
      sprintf((char *)TempStr, "2014/01/01");
    }
		PosDisplay-=10;
    GUI_DispStringAt((char *)TempStr, PosDisplay, 11);
    
    /* USB */
    if(k_StorageGetStatus(USB_DISK_UNIT))
    {
       PosDisplay-=35;
       GUI_DrawBitmap(&bmusbdisk, PosDisplay, 3);
    }
		
		/* MSD */
    if(k_StorageGetStatus(MSD_DISK_UNIT))
    {
      PosDisplay-=35; 
			GUI_DrawBitmap(&bmmicrosd, PosDisplay, 3);
    }   
		
		/* CPU */
    sprintf((char *)TempStr, "%d %%", osGetCPUUsage());
    if(osGetCPUUsage() > 95 )
    {
      /* waiting for user input when using dialog box*/
      sprintf((char *)TempStr, "95 %%");
    }   
    PosDisplay-=35;
    GUI_DispStringAt( (char *)TempStr, PosDisplay, 6);
		
		if(WT_Config.Print == 1 && PrintFile.print_status == 4)//本地打印Yes  //print_status 0-stop 1-wait, 2-print ok, 3-print run, 4-print error
		{
//			WT_PrintFolder_Init();
//			res=WT_PrintFiles_Init((char *)PrintFolder.FilesName[WT_Config.Print_ID]);//0-not init, 1-inited, 2-no files, 3-hardware error, 4-no folder
//			if(res != 1) wt_SetText_Status("打印文件错误");
			wt_SetText_Status("打印文件错误");
		}	
    break;
    
  default:
    WM_DefaultProc(pMsg);
  }
}
Пример #30
0
/**
  * @brief  Callback routine of desktop window status.
  * @param  pMsg: pointer to data structure of type WM_MESSAGE
  * @retval None
  */
static void _cbStatus(WM_MESSAGE * pMsg) {
  int xSize, ySize;
  static uint8_t TempStr[50];
  static WM_HTIMER hTimerTime;
  static WM_HTIMER hSpriteTime;  

  RTC_TimeTypeDef   RTC_Time;
  RTC_DateTypeDef   RTC_DateStructure;
  uint8_t sec, min, hour, day, month;
  uint16_t year;
  WM_HWIN hWin;

  hWin = pMsg->hWin;
  switch (pMsg->MsgId) 
  {
  case WM_CREATE:
    hTimerTime = WM_CreateTimer(hWin, ID_TIMER_TIME, 1000, 0);
    if(settings.b.enable_sprite)
    {
      hSpriteTime = WM_CreateTimer(hWin, ID_SPRITE_TIME, 50, 0);    
    }
    break;
    
  case WM_DELETE:
    WM_DeleteTimer(hTimerTime);
    if(settings.b.enable_sprite)
    {    
      WM_DeleteTimer(hSpriteTime);    
    }
    break;
    
  case WM_TIMER:
    if( WM_GetTimerId(pMsg->Data.v) == ID_TIMER_TIME)
    {
      WM_InvalidateWindow(hWin);
      WM_RestartTimer(pMsg->Data.v, 1000);
    }
    else if( WM_GetTimerId(pMsg->Data.v) == ID_SPRITE_TIME)
    {
      if(settings.b.enable_sprite)
      {    
        if(SpriteDisabled == 0)
        {
          _MoveSprite(&_aSprite[0]);
        }
      }
      WM_RestartTimer(pMsg->Data.v, 100);
    }
    break;
    
  case WM_PAINT:
    xSize = WM_GetWindowSizeX(hWin);
    ySize = WM_GetWindowSizeY(hWin);
    
    /* Draw background */
    GUI_SetColor(0x40303030);
    GUI_FillRect(0, 0, xSize , ySize - 3);
    GUI_SetColor(0x808080);
    GUI_DrawHLine(ySize - 2, 0, xSize );
    GUI_SetColor(0x404040);
    GUI_DrawHLine(ySize - 1, 0, xSize );

    /* Draw time & Date */
    GUI_SetTextMode(GUI_TM_TRANS);
    GUI_SetColor(GUI_WHITE);
    GUI_SetFont(GUI_FONT_13B_ASCII);
    
    k_GetTime(&RTC_Time);
    sec    =  RTC_Time.Seconds;
    min    =  RTC_Time.Minutes;
    hour   =  RTC_Time.Hours;
    
    k_GetDate(&RTC_DateStructure);
    
    sprintf((char *)TempStr, "%02d:%02d:%02d", hour , min, sec);
    GUI_DispStringAt((char *)TempStr, xSize - 50, 4);
    
    year =  RTC_DateStructure.Year + 2014;
    month =  RTC_DateStructure.Month;
    day =  RTC_DateStructure.Date;
    
    if((day > 0) && (day <= 31) && 
       (month > 0)&& (month <= 12) && 
         (year >= 1900))
    {
      sprintf((char *)TempStr, "%02d, %s, %04d", day , strMonth[month-1], year);
    }
    else
    {
      sprintf((char *)TempStr, "01, January, 2014");
    }

    GUI_DispStringHCenterAt((char *)TempStr, xSize / 2, 4);
    
    /* USB */
    if(k_StorageGetStatus(USB_DISK_UNIT))
    {
       GUI_DrawBitmap(&bmusbdisk, xSize - 80, 0);
    }
    
    /* MSD */
    if(k_StorageGetStatus(MSD_DISK_UNIT))
    {
       GUI_DrawBitmap(&bmmicrosd, xSize - 80 - 35 * k_StorageGetStatus(USB_DISK_UNIT) , 0);
    }    
    
    sprintf((char *)TempStr, "CPU : %d %%", osGetCPUUsage());
    
    if(osGetCPUUsage() > 95 )
    {
      /* waiting for user input when using dialog box*/
      sprintf((char *)TempStr, "CPU : 95 %%");
    }
    GUI_DispStringAt( (char *)TempStr, 50, 4);
    break;
    
  default:
    WM_DefaultProc(pMsg);
  }
}