Exemple #1
0
void GUI_Rectangle( u8 sx,u16 sy,u8 ex,u16 ey,u16 color)
{
	GUI_Line(sx,sy,ex,sy,color);
	GUI_Line(sx,sy,sx,ey,color);
	GUI_Line(ex,sy,ex,ey,color);
	GUI_Line(sx,ey,ex,ey,color);
}
Exemple #2
0
/****************************************************************************
* 名称:GUI_WindowsDraw()
* 功能:显示窗口。根据提供的窗口参数进行画窗口。
* 入口参数:win		窗口句柄
* 出口参数:返回0表示操作失败,返回1表示操作成功
****************************************************************************/
uint8  GUI_WindowsDraw(WINDOWS *win)
{  uint8  *str;
   int32  bak, bak1, bak2;
   
   /* 参数过滤,若窗口起出范围,则返回0 */
   if( ( (win->with)<20 ) || ( (win->hight)<20 ) ) return(0);		// 宽度、高度检查,限制最小窗口
   if( (win->x + win->with ) > GUI_LCM_XMAX ) return(0);			// 窗口宽度是否溢出
   if( (win->y + win->hight ) > GUI_LCM_YMAX ) return(0);			// 窗口高度是否溢出
    
   /* 开始画窗口 */
   GUI_RectangleFill(win->x, win->y, win->x + win->with - 1, win->y + win->hight - 1, back_color);
   GUI_Rectangle(win->x, win->y, win->x + win->with - 1, win->y + win->hight - 1, disp_color);	// 画窗口
   GUI_HLine(win->x, win->y + 12, win->x + win->with - 1, disp_color);							// 画标题目栏
   GUI_RLine(win->x + 12, win->y, win->y + 12, disp_color);										// 画关闭窗号按钮
   GUI_Line(win->x, win->y, win->x + 12, win->y + 12, disp_color);
   GUI_Line(win->x + 12, win->y, win->x, win->y + 12, disp_color);
   

   /* 写标题 */
   if( win->title != NULL ) 
   {  str = win->title;
      bak = win->x + 15;
      bak1 = win->y + 3;
      bak2 = win->x + win->with -1;
     
      while(1)						
      {  if( (bak+8) > bak2 ) break;								// 判断标题是否溢出
         if(*str=='\0') break;										// 判断字符串是否结束
         
         GUI_PutChar(bak, bak1, *str++);							// 显示标题
         bak += 6;
      }
   }


   /* 写状态栏 */
   if( win->state != NULL )
   {  if( win->hight < 60) return(0);								// 判断是否可以画状态栏
      /* 画状态栏 */
      GUI_HLine(win->x, win->y + win->hight - 11, win->x + win->with - 1, disp_color);
      
      str = win->state;
      bak = win->x + 3;
      bak1 = win->y + win->hight - 9;
      bak2 = win->x + win->with -1;
      
      while(1)						
      {  if( (bak+8) > bak2 ) break;								// 判断标题是否溢出
         if(*str=='\0') break;										// 判断字符串是否结束
         
         GUI_PutChar(bak, bak1, *str++);							// 显示标题
         bak += 6;
      }      
   }
   
   return(1);

}
Exemple #3
0
/****************************************************************************
* 名称:GUI_LineS()
* 功能:多个点之间的连续连线。从第一点连到第二点,再连到第三点...
* 入口参数: points  多个点坐标数据的指针,数据排列为(x0,y0)、(x1,y1)、(x2,y2)...
*           no      点数目,至少要大于1
*           color	显示颜色
* 出口参数:无
* 说明:操作失败原因是指定地址超出有效范围。
****************************************************************************/
void  GUI_LineS(uint32_t const *points, uint8_t no, TCOLOR color)
{  uint32_t  x0, y0;
   uint32_t  x1, y1;
   uint8_t  i;

   /* 入口参数过滤 */
   if(0==no) return;
   if(1==no)						// 单点
   {  x0 = *points++;
      y0 = *points;
      GUI_Point(x0, y0, color);
   }
   
   /* 画多条线条 */
   x0 = *points++;					// 取出第一点坐标值,作为原起点坐标值
   y0 = *points++;
   for(i=1; i<no; i++)
   {  x1 = *points++;				// 取出下一点坐标值
      y1 = *points++;
      GUI_Line(x0, y0, x1, y1, color);
      x0 = x1;						// 更新原起点坐标
      y0 = y1;
   }
}
void GUIDEMO_Intro(void)
{
 int xCenter = LCD_GET_XSIZE() / 2;
 int y;
 char acText[50] = "Version of 礐/GUI: ";
  
  strcat(acText, GUI_GetVersionString());
  
  GUI_SetBkColor(GUI_BLUE);
  GUI_SetColor(GUI_LIGHTRED);
  GUI_Clear();
  GUI_SetFont(&GUI_Font24B_1);
  GUI_DispStringHCenterAt("礐/GUI", xCenter, y= 15);
  
//  GUI_SetColor(GUI_WHITE);
//  GUI_SetFont(&GUI_Font13H_ASCII);
//  GUI_DispStringHCenterAt("Universal graphic software"
//                          "\nfor embedded applications"
//                          , xCenter, y += 30);
  
//  GUI_SetColor(GUI_LIGHTRED);
//  GUI_SetFont(&GUI_Font16_ASCII);
//  GUI_DispStringHCenterAt("Any CPU - Any LCD - Any Application", xCenter, y += 40);
  
//  GUI_SetFont(&GUI_Font10S_ASCII);
//  GUI_DispStringHCenterAt("Compiled " __DATE__ " "__TIME__, xCenter, y += 25);
  
  
  
  GUI_SetFont(&GUI_Font13HB_1);
  GUI_SetColor(GUI_WHITE);
  GUI_DispStringHCenterAt(acText, xCenter, y += 26);
  
  GUI_DrawBitmap(&bmMicriumLogo, (LCD_GET_XSIZE() - bmMicriumLogo.XSize) / 2, y += 16);

  GUI_Line(0, y+45, 320-1, y+45, GUI_WHITE);
  GUI_Line(0, y+46, 320-1, y+46, GUI_WHITE);
  
  //GUI_SetFont(&GUI_Font24B_1);

  GUI_SetFont(&GUI_FontHZ_hwhb_32);
  GUI_SetColor(GUI_RED);
  //GUI_DispStringHCenterAt("FD-STM32-Sun68", LCD_GET_XSIZE() / 2, y += 50);
  GUI_DispStringHCenterAt("STM32研究开发平台", LCD_GET_XSIZE() / 2, y += 50);	  

  GUI_SetFont(&GUI_Font13HB_1);//GUI_Font16_ASCII
  GUI_SetColor(GUI_RED);
  GUI_DispStringHCenterAt("http://www.heyaodz.com", LCD_GET_XSIZE() / 2, y += 36);
  
  

//  GUI_SetColor(GUI_WHITE);
//  GUI_SetFont(&GUI_Font10S_ASCII);
//  GUI_DispStringAt("GUI_OS: ", 0,210); GUI_DispDecMin(GUI_OS);
//  GUI_DispStringAt("GUI_ALLOC_SIZE: ",0, 220); GUI_DispDecMin(GUI_ALLOC_SIZE);
//  GUI_DispStringAt("Compiler: "
//  #ifdef _MSC_VER
//    "Microsoft"
//  #elif defined (NC308)
//    "Mitsubishi NC308"
//  #elif defined (NC30)
//    "Mitsubishi NC30"
//  #elif defined (__TID__)
//    #if (((__TID__ >>8) &0x7f) == 48)            /* IAR MC80 */
//      "IAR M32C"
//    #elif (((__TID__ >>8) &0x7f) == 85)          /* IAR V850 */
//      "IAR V850"
//    #else                                        /* IAR MC16 */
//      "IAR M32C"
//    #endif
//  #else
//    "RealViewMDK 3.50"
//  #endif
//    ,0, 230);
  
  GUIDEMO_Delay(5000);
}