Пример #1
0
/*******************************************************************
*
*       _DemoAntialiasing

  Draws lines with different antialiasing factors
*/
static void _DemoAntialiasing(void) {
  int i, x1, x2, y1, y2;
  const GUI_FONT *font_old;
  y1 = 65;
  y2 = 5;
  /* Set drawing attributes */
  GUI_SetColor(GUI_WHITE);
  GUI_SetBkColor(GUI_BLACK);
  GUI_SetPenShape(GUI_PS_FLAT);
  GUI_Clear();
  /* draw headline */
  font_old = GUI_SetFont(&GUI_Font24_ASCII);
  GUI_SetTextAlign(GUI_TA_HCENTER);
  GUI_DispStringAt("AA_Lines - Sample", 160, 5);
  /* Draw lines without antialiased */
  GUI_Delay(1000);
  GUI_SetFont(&GUI_Font8x16);
  GUI_SetTextAlign(GUI_TA_LEFT);
  GUI_DispStringAtCEOL("draw normal lines using", 5, 40);
  GUI_DispStringAtCEOL("GUI_DrawLine", 5, 55);
  GUI_Delay(2500);
  x1 = 20;
  x2 = 100;
  GUI_SetFont(font_old);
  GUI_DispStringHCenterAt("Normal", (x1 + x2) / 2, 30 + y1);
  for (i = 1; i < 8; i++) {
    GUI_SetPenSize(i);
    GUI_DrawLine(x1, 40 + i * 15 + y1, x2, 40 + i * 15 + y1 + y2);
  }
  /* Draw lines with antialiasing quality factor 2 */
  GUI_Delay(3000);
  GUI_SetFont(&GUI_Font8x16);
  GUI_DispStringAtCEOL("", 5, 40);
  GUI_DispStringAtCEOL("", 5, 55);
  GUI_Delay(200);
  GUI_DispStringAtCEOL("draw antialiased lines using", 5, 40);
  GUI_DispStringAtCEOL("GUI_AA_DrawLine", 5, 55);
  GUI_Delay(3500);
  x1 = 120;
  x2 = 200;
  GUI_AA_SetFactor(2);
  GUI_SetFont(font_old);
  GUI_DispStringHCenterAt("Antialiased\nusing factor 2", (x1 + x2) / 2, 30 + y1);
  for (i = 1; i < 8; i++) {
    GUI_SetPenSize(i);
    GUI_AA_DrawLine(x1, 40 + i * 15 + y1, x2, 40 + i * 15 + y1 + y2);
  }
  /* Draw lines with antialiasing quality factor 6 */
  GUI_Delay(1500);
  x1 = 220;
  x2 = 300;
  GUI_AA_SetFactor(6);
  GUI_SetFont(font_old);
  GUI_DispStringHCenterAt("Antialiased\nusing factor 6", (x1 + x2) / 2, 30 + y1);
  for (i = 1; i < 8; i++) {
    GUI_SetPenSize(i);
    GUI_AA_DrawLine(x1, 40 + i * 15 + y1, x2, 40 + i * 15 + y1 + y2);
  }
  GUI_Delay(7500);
}
Пример #2
0
/*******************************************************************
*
*       _DrawScale

  Drawing a scale using GUI-functions
*/
static void _DrawScale(void) {
  int XSize = LCD_GetXSize();
  int YSize = LCD_GetYSize();
  int XMid  = XSize / 2;
  int i;
  int r1   = 110;
  int r2   = 140;
  int rt   = 100;
  int y    = 240;
  int step =  15;
  int r = (r1 + r2) / 2;
  GUI_SetBkColor(GUI_BLACK);
  GUI_Clear();
  GUI_SetColor(GUI_WHITE);
  GUI_SetFont(&GUI_Font24_ASCII);
  GUI_SetTextAlign(GUI_TA_HCENTER);
  GUI_DispStringAt("DrawScale - Sample", 160, 5);
  while (1) {
    int c = 0;
    GUI_SetColor(GUI_WHITE);
    GUI_SetFont(&GUI_Font8x16);
    GUI_SetTextAlign(GUI_TA_LEFT);
    GUI_Delay(SPEED / 2);
    GUI_DispStringAtCEOL("using", 5, 40);
    GUI_DispStringAtCEOL("GUI_AA_DrawArc", 5, 55);
    GUI_Delay(SPEED * 2);
    GUI_SetPenSize(r2 - r1);
    GUI_SetColor(0x0000AA);
    GUI_AA_DrawArc(XMid, y, r, r, 45, 60);
    GUI_Delay(SPEED);
    GUI_SetColor(0x00AA00);
    GUI_AA_DrawArc(XMid, y, r, r, 60, 90);
    GUI_Delay(SPEED);
    GUI_SetPenSize(2);
    GUI_SetColor(GUI_WHITE);
    GUI_AA_DrawArc(XMid, y, r1, r1, 45, 135);
    GUI_Delay(SPEED);
    GUI_AA_DrawArc(XMid, y, r2, r2, 45, 135);
    GUI_Delay(SPEED);
    GUI_DispStringAtCEOL("", 5, 55);
    GUI_Delay(200);
    GUI_DispStringAtCEOL("using", 5, 40);
    GUI_DispStringAtCEOL("GUI_AA_DrawLine & GUI_DispCharAt", 5, 55);
    GUI_Delay(SPEED * 3);
    for (i = 45; i <= 135; i += step) {
      float co = cos(i * 3.1415926 / 180);
      float si = sin(i * 3.1415926 / 180);
      int   x1 = XMid - r1 * co;
      int   y1 = y    - r1 * si;
      int   x2 = XMid - (r2 - 1) * co;
      int   y2 = y    - (r2 - 1) * si;
      int   xt = XMid - rt * co;
      int   yt = y    - rt * si;
      GUI_SetColor(GUI_WHITE);
      GUI_SetPenSize(2);
      GUI_AA_DrawLine(x1, y1, x2, y2);
      GUI_SetColor(GUI_GREEN);
      GUI_SetFont(&GUI_Font8x8);
      GUI_DispCharAt('0' + c++, xt - 4, yt - 4);
      GUI_Delay(SPEED / 2);
    }
    GUI_Delay(SPEED * 3);
    GUI_ClearRect(0, 30, 320, 240);
  }
}
Пример #3
0
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
	
	WM_HWIN hWin;
	WM_HWIN hText;
	const WM_KEY_INFO* pInfo;
	WM_HWIN  hItem  = 0;
  int     i  = 0;
  int     NCode;
  int     Id;
	hWin = pMsg->hWin;
  // USER START (Optionally insert additional variables)
  // USER END
  switch (pMsg->MsgId) 
	{
		  case USER_MSG_LANGUAGE:
					    InfoSel(0,1);
					    break;
				case WM_PAINT:
									GUI_SetBkColor(GUI_WHITE);
									GUI_Clear();
									GUI_SetColor(GUI_BLACK);
									GUI_AA_DrawLine(190,0,220,60);
									GUI_AA_DrawLine(220,60,800,60);
// 				     if (Language == 0)
// 									{
// 									   GUI_DispStringAt("所处      页/共      页",560,435);	
// 									}
// 									else
// 									{
//   										GUI_DispStringAt (pLanguage->Page,560,435);
// 									}
// 										 	GUI_DispDecAt(thispage,605,435,3);
// 							   		GUI_DispDecAt(pageNum,700,435,3);
									//GUI_DispStringAt("高电压警告",230,28);
				     GUI_PNG_Draw(&acPOWER,sizeof(acPOWER),755,35);

									break;
		
		case WM_INIT_DIALOG:
			
			    pLanguage = &Lgumainwin[Language];
							hButton = WM_GetDialogItem (hWin,ID_BUTTON_0);
							BUTTON_SetBkColor (hButton,BUTTON_CI_UNPRESSED,GUI_WHITE);
							BUTTON_SetTextColor (hButton,BUTTON_CI_UNPRESSED,GUI_BLACK);
							BUTTON_SetTextAlign (hButton,GUI_TA_HCENTER|GUI_TA_VCENTER);
							BUTTON_SetText(hButton,pLanguage->ButtonInfo[0]);
							BUTTON_SetFocusColor (hButton,GUI_WHITE);
							WIDGET_SetEffect (hButton,&WIDGET_Effect_None);
							WM_SetCallback (hButton,&mybutton);
							WM_SetFocus (hButton);
							hListview = WM_GetDialogItem (hWin,ID_LV_0);
							hListhead = LISTVIEW_GetHeader(hListview);
							LISTVIEW_SetFont(hListview,&GUI_Font30);
							LISTVIEW_SetRowHeight(hListview,40);
							LISTVIEW_SetHeaderHeight(hListview,30);
							LISTVIEW_SetBkColor (hListview,LISTVIEW_CI_SELFOCUS,GUI_GRAY);
							LISTVIEW_SetBkColor (hListview,LISTVIEW_CI_SEL,GUI_WHITE);
							LISTVIEW_SetTextColor (hListview,LISTVIEW_CI_SEL,GUI_BLACK);
							LISTVIEW_SetTextColor(hListview,LISTVIEW_CI_SELFOCUS,GUI_WHITE);
							WIDGET_SetEffect(hListhead,&WIDGET_Effect_3D);
							HEADER_SetBkColor (hListhead,GUI_BLACK);
							HEADER_SetTextColor(hListhead,GUI_WHITE);
							HEADER_SetFont(hListhead,&GUI_Font24);
							LISTVIEW_AddColumn(hListview,80,"序号",GUI_TA_HCENTER|GUI_TA_VCENTER);
							LISTVIEW_AddColumn(hListview,100,"信息编码",GUI_TA_HCENTER|GUI_TA_VCENTER);
							LISTVIEW_AddColumn(hListview,130,"yyy/mm/dd",GUI_TA_HCENTER|GUI_TA_VCENTER);
							LISTVIEW_AddColumn(hListview,90,"hh:mm",GUI_TA_HCENTER|GUI_TA_VCENTER);
							LISTVIEW_AddColumn(hListview,120,"频道",GUI_TA_HCENTER|GUI_TA_VCENTER);
							LISTVIEW_AddColumn(hListview,100,"信息类型",GUI_TA_HCENTER|GUI_TA_VCENTER);
							LISTVIEW_AddColumn(hListview,100,"信息状态",GUI_TA_HCENTER|GUI_TA_VCENTER);
							LISTVIEW_SetTextAlign(hListview,6,GUI_TA_LEFT|GUI_TA_VCENTER);
							
							// WM_HWIN - TEXT
							mainwinText[0] = WM_GetDialogItem(hWin,ID_TEXT_3); //高压警告
							mainwinText[1] = WM_GetDialogItem(hWin,ID_TEXT_0); //INT
							mainwinText[2] = WM_GetDialogItem(hWin,ID_TEXT_1); //loc1,loc2,chs
							mainwinText[3] = WM_GetDialogItem(hWin,ID_TEXT_2); //time
							mainwinText[4] = WM_GetDialogItem(hWin,ID_TEXT_4); //page
							
							WM_SetCallback(mainwinText[1],&mytext);
							WM_SetCallback(mainwinText[2],&mytext);			
							
							TEXT_SetText(mainwinText[0],"");
							
							TEXT_SetFont(mainwinText[4],&GUI_Font30);
							TEXT_SetTextAlign(mainwinText[4],TEXT_CF_RIGHT);
							TEXT_SetText(mainwinText[4],"所处 01页/共 02页");
							//time
							TEXT_SetTextAlign(mainwinText[3],TEXT_CF_VCENTER);
							TEXT_SetFont(mainwinText[3],&GUI_Font30);
							TEXT_SetText(mainwinText[3],"UTC 2015.10.24 17:30");
							for (i=0;	i<16; i++)
							{
									INFO_add(&TESTDATA[i]);
							}
							if (rowNum < 8)
							 	pageNum = 1;
							else if (rowNum%8 == 0)
						 		pageNum = rowNum/8;
							else pageNum = rowNum/8+1;	
							InfoSel(0,1);
							//DisPage();	 
					 	WM_SetCallback (hListview,&mylistview);
							
					  break;
						
		 default:
       WM_DefaultProc(pMsg);
       break;
	}
}