GUI.h 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /****************************************Copyright (c)**************************************************
  2. * File Name: GDI.h
  3. * Function Describe: Header file for GDI.c
  4. * Explain:
  5. * Writer: ShiLiangWen
  6. * Date: 2016-1-8
  7. ********************************************************************************************************/
  8. #ifndef __GDI_H
  9. #define __GDI_H
  10. //-------------------------------------------------------------------------------------------------------
  11. #include "stm32f10x.h"
  12. //设置字库文件名,GUI会从sFlash中找到该文件作为字库文件
  13. #define HZK16_FILE_NAME "HZK16"
  14. #define HZK12_FILE_NAME "HZK12"
  15. //以下定义各种颜色,原色按0xRRGGBB格式
  16. #define COLOR_BLACK 0x000000
  17. #define COLOR_WHITE 0xFFFFFF
  18. #define COLOR_RED 0xFF0000
  19. #define COLOR_GREEN 0x00FF00
  20. #define COLOR_BLUE 0x0000FF
  21. #define COLOR_YELLOW 0xFFFF00
  22. #define COLOR_PURPLE 0x800080
  23. #define COLOR_ORANGE 0x0288D1//0xFF7F24 //橙色
  24. #define COLOR_DARKBLUE 0x00008B //RGB(0,0,139) ■★●◆darkblue(深蓝)
  25. #define USING_DRAW_WITH_COLOR_OPTION
  26. #define COLOR_DEFAULT_BLUE 1
  27. #define COLOR_WARN_RED 2
  28. #define COLOR_CHARGE_BLUE 3
  29. //#define LCD_TYPE 0 //旧屏
  30. #define LCD_TYPE 1 //新屏
  31. //汉字库
  32. typedef struct SUT_HZK
  33. {
  34. unsigned char width;//字库点阵宽度
  35. unsigned char heigh;//字库点阵高度
  36. unsigned char len; //字库点阵数据长度,一般等于width*heigh/8
  37. int FileIndex; //字库文件在sFlash中索引
  38. int FileLen; //字库文件大小
  39. }SUT_HZK;
  40. void GuiInit(void); //GUI初始化
  41. void GuiSetColor(unsigned long ForeColor,unsigned long BackColor,unsigned long WarnColor);//设置前景色和背景色
  42. void GuiSetForeColor(unsigned long ForeColor);//设置前景色
  43. void GuiSetBackColor(unsigned long BackColor);//设置背景色
  44. void GuiShowStr(u16 x, u16 y,const char *string,u8 mode);//显示字符串 font=mode&0xf0 cover=mode&0x0f
  45. void GuiShowBmp(u16 x,u16 y,const char * filename);//显示BMP图片 filename为在sFlash中存储的BMP文件名
  46. void GuiDrawHLine(u16 x1, u16 x2, u16 y, u8 width);//画水平线
  47. #ifdef USING_DRAW_WITH_COLOR_OPTION
  48. void GuiDrawVLine(u16 y1, u16 y2, u16 x, u8 width, u8 colorIndex);//画垂直线
  49. void GuiFillRect(u16 x1, u16 y1, u16 x2, u16 y2,u8 colorIndex);//画矩形框并填充为前景色
  50. #else
  51. void GuiDrawVLine(u16 y1, u16 y2, u16 x, u8 width);
  52. void GuiFillRect(u16 x1, u16 y1, u16 x2, u16 y2);//画矩形框并填充为前景色
  53. #endif
  54. void GuiDrawRect(u16 x1, u16 y1, u16 x2, u16 y2,u8 width);//画矩形框,只画边框,内部不填充
  55. void GuiClearRect(u16 x1, u16 y1, u16 x2, u16 y2);//清空矩形区域,填充背景色
  56. void GuiClearArea(u16 x, u16 y, u16 width, u16 heigh);//清空一个区域,填充背景色,和GuiClearRect等效,只是入口参数有区别
  57. void GuiMoveRect(u16 xstart,u16 ystart,u16 width,u16 height,u16 xend,u16 yend);//移动矩形区域
  58. void GuiDrawBmpMoving(u16 xstart,u16 ystart,u16 xend,u16 yend,const char *filename,int t);//显示一张BMP图片,并使之移动
  59. void GuiReverseRect2(u16 x,u16 y,u16 width,u16 height);//将一个矩形区域反色显示,即背景色变前景色,非背景色变前景色
  60. void GuiPaste(u16 x1,u16 y1,u16 x2,u16 y2);
  61. void GuiCopy(u16 x1,u16 y1,u16 x2,u16 y2);
  62. void GuiClearAll(void);
  63. void GuiReverseArea(u16 x1,u16 y1,u16 x2,u16 y2);
  64. void GuiShowArrow(u16 x,u16 y,u16 len,u8 mode);
  65. void GuiShowSingle(int CSQ);//显示信号
  66. void GuiShowBat(int bat);//显示电量
  67. void GuiClearAllM20(void);
  68. void GuiClearRectM20(u16 x1, u16 y1, u16 x2, u16 y2);
  69. void GuiReverseRect(u16 x,u16 y,u16 width,u16 height);
  70. void GuiShowStrM20(u16 x, u16 y,const char *string,u8 mode,unsigned char Fore,unsigned char Back);
  71. u16 RGB888toRGB565(unsigned char R,unsigned char G, unsigned char B);//将RGB888格式转RGB565格式
  72. extern u8 g_ucWarnColorId;
  73. extern unsigned char RedColorId;//红色值
  74. extern unsigned char BlueColorId;//绿色值
  75. extern unsigned char GreenColorId;//绿色值
  76. extern unsigned char OrangeColorId;//橙色值
  77. void SysIniRead(void);
  78. //-------------------------------------------------------------------------------------------------------
  79. #endif
  80. /*********************************************************************************************************
  81. END FILE
  82. *********************************************************************************************************/