📄 gui.h
字号:
extern const GUI_FONT GUI_FontD24x32;
extern const GUI_FONT GUI_FontD32;
/* Comic fonts */
extern const GUI_FONT GUI_FontComic18B_ASCII, GUI_FontComic18B_1;
extern const GUI_FONT GUI_FontComic24B_ASCII, GUI_FontComic24B_1;
/* 汉字库 */
extern const GUI_FONT GUI_FontHZ12;
/*************************************************************************************************************
* Text and drawing mode defines--文本和绘图模式定义
* These defines come in two flavors: the long version (.._DRAWMODE_..) and the short ones (.._DM_..).
* They are identical, feel free to use which ever one you like best.
*************************************************************************************************************/
#define GUI_DRAWMODE_NORMAL LCD_DRAWMODE_NORMAL
#define GUI_DRAWMODE_XOR LCD_DRAWMODE_XOR
#define GUI_DRAWMODE_TRANS LCD_DRAWMODE_TRANS
#define GUI_DRAWMODE_REV LCD_DRAWMODE_REV
#define GUI_DM_NORMAL LCD_DRAWMODE_NORMAL
#define GUI_DM_XOR LCD_DRAWMODE_XOR
#define GUI_DM_TRANS LCD_DRAWMODE_TRANS
#define GUI_DM_REV LCD_DRAWMODE_REV
#define GUI_TEXTMODE_NORMAL LCD_DRAWMODE_NORMAL
#define GUI_TEXTMODE_XOR LCD_DRAWMODE_XOR
#define GUI_TEXTMODE_TRANS LCD_DRAWMODE_TRANS
#define GUI_TEXTMODE_REV LCD_DRAWMODE_REV
#define GUI_TM_NORMAL LCD_DRAWMODE_NORMAL
#define GUI_TM_XOR LCD_DRAWMODE_XOR
#define GUI_TM_TRANS LCD_DRAWMODE_TRANS
#define GUI_TM_REV LCD_DRAWMODE_REV
/* Text alignment flags, horizontal--文字对齐标志,水平 */
#define GUI_TA_HORIZONTAL (3<<0)
#define GUI_TA_LEFT (0<<0)
#define GUI_TA_RIGHT (1<<0)
#define GUI_TA_CENTER (2<<0)
#define GUI_TA_HCENTER GUI_TA_CENTER /* easier to remember :-) */
/* Text alignment flags, vertical--文字对齐标志,垂直 */
#define GUI_TA_VERTICAL (3<<2)
#define GUI_TA_TOP (0<<2)
#define GUI_TA_BOTTOM (1<<2)
#define GUI_TA_BASELINE (2<<2)
#define GUI_TA_VCENTER (3<<2)
/*************************************************************************************************************
* Min/Max coordinates--最小/最大坐标
*************************************************************************************************************/
/* Define minimum and maximum coordinates in x and y */
#define GUI_XMIN -4095
#define GUI_XMAX 4095
#define GUI_YMIN -4095
#define GUI_YMAX 4095
/*************************************************************************************************************
* GUI_CONTEXT
* This structure is public for one reason only: To allow the application to save and restore the context.
*************************************************************************************************************/
typedef union
{
U8 aColorIndex8[2];
U16 aColorIndex16[2];
} LCD_COLORINDEX_UNION;
typedef struct GUI_Context_struct GUI_CONTEXT;
#if !defined (__C51__) /* To bypass Keil-compiler bug */
typedef struct tLCDDEV_APIList_struct tLCDDEV_APIList;
#endif
struct GUI_Context_struct
{
/* Variables in LCD module */
LCD_COLORINDEX_UNION LCD;
LCD_RECT ClipRect;
const tLCD_HL_APIList* pLCD_HL;
U8 DrawMode;
/* Variables in GL module */
GUI_RECT* pClipRect_HL;
U8 PenSize;
U8 PenShape;
U8 LineStyle;
U8 FillStyle;
/* Variables in GUICHAR module */
const GUI_FONT* pAFont;
I16P LBorder;
I16P DispPosX, DispPosY;
I16P DrawPosX, DrawPosY;
I16P TextMode;
I16P TextAlign;
/* Variables in WM module */
#if GUI_WINSUPPORT
const GUI_RECT *WM__pUserClipRect;
GUI_HWIN hAWin;
#endif
/* Variables in MEMDEV module (with memory devices only) */
#if GUI_SUPPORT_MEMDEV
const tLCDDEV_APIList *pDeviceAPI; /* function pointers only */
GUI_HMEM hDevData;
GUI_RECT ClipRectPrev;
#endif
/* Variables Anitaliasing module */
U8 AA_Factor;
U8 AA_HiResEnable;
};
/*************************************************************************************************************
* General routines--一般程序
*************************************************************************************************************/
int GUI_Init(void);
void GUI_SetDefault(void);
GUI_DRAWMODE GUI_SetDrawMode(GUI_DRAWMODE dm);
const char *GUI_GetVersionString(void);
void GUI_SaveContext(GUI_CONTEXT* pContext);
void GUI_RestoreContext(const GUI_CONTEXT* pContext);
/*************************************************************************************************************
* Rectangle helper functions --矩形辅助功能
*************************************************************************************************************/
int GUI_RectsIntersect(const GUI_RECT* pr0, const GUI_RECT* pr1);
void GUI_MoveRect (GUI_RECT *pRect, int x, int y);
void GUI_MergeRect (GUI_RECT* pDest, const GUI_RECT* pr0, const GUI_RECT* pr1);
int GUI__IntersectRects(GUI_RECT* pDest, const GUI_RECT* pr0, const GUI_RECT* pr1);
void GUI__IntersectRect (GUI_RECT* pDest, const GUI_RECT* pr0);
void GUI__ReduceRect (GUI_RECT* pDest, const GUI_RECT *pRect, int Dist);
/*************************************************************************************************************
* Misc helper functions--其它辅助功能
*************************************************************************************************************/
int GUI__DivideRound(int a, int b);
/*************************************************************************************************************
* Get / Set Attributes--获取/设置 属性
*************************************************************************************************************/
GUI_COLOR GUI_GetBkColor (void);
GUI_COLOR GUI_GetColor (void);
int GUI_GetBkColorIndex(void);
int GUI_GetColorIndex (void);
U8 GUI_GetPenSize (void);
U8 GUI_GetLineStyle (void);
U8 GUI_GetFillStyle (void);
void GUI_SetBkColor (GUI_COLOR);
void GUI_SetColor (GUI_COLOR);
void GUI_SetBkColorIndex(int Index);
void GUI_SetColorIndex(int Index);
U8 GUI_SetPenSize (U8 Size);
U8 GUI_SetPenShape (U8 Shape);
U8 GUI_SetLineStyle (U8 Style);
U8 GUI_SetFillStyle (U8 Style);
/* Get/Set Character used as decimal point (usually '.' or ',')--获取/设置为小数点字符 */
char GUI_GetDecChar(void);
char GUI_SetDecChar(char c);
/*************************************************************************************************************
* Color / Index related functions--颜色/指数相关函数
*************************************************************************************************************/
int GUI_Color2Index(GUI_COLOR color);
GUI_COLOR GUI_Color2VisColor(GUI_COLOR color);
char GUI_ColorIsAvailable(GUI_COLOR color);
GUI_COLOR GUI_Index2Color(int Index);
void GUI_InitLUT(void);
void GUI_SetLUTEntry (U8 Pos, GUI_COLOR Color);
void GUI_SetLUTColor (U8 Pos, GUI_COLOR Color);
void GUI_SetPhysColor(U8 Pos, GUI_COLOR Color);
/*************************************************************************************************************
* Logging
*************************************************************************************************************/
void GUI_Log (const char *s);
void GUI_Log1 (const char *s, int p0);
void GUI_Log2 (const char *s, int p0, int p1);
void GUI_Log3 (const char *s, int p0, int p1, int p2);
void GUI_Log4 (const char *s, int p0, int p1, int p2,int p3);
void GUI_Warn (const char *s);
void GUI_Warn1 (const char *s, int p0);
void GUI_Warn2 (const char *s, int p0, int p1);
void GUI_Warn3 (const char *s, int p0, int p1, int p2);
void GUI_Warn4 (const char *s, int p0, int p1, int p2, int p3);
void GUI_ErrorOut (const char *s);
void GUI_ErrorOut1(const char *s, int p0);
void GUI_ErrorOut2(const char *s, int p0, int p1);
void GUI_ErrorOut3(const char *s, int p0, int p1, int p2);
void GUI_ErrorOut4(const char *s, int p0, int p1, int p2, int p3);
/*************************************************************************************************************
* 2d - GUI
*************************************************************************************************************/
void GUI_Clear (void);
void GUI_ClearRect (int x0, int y0, int x1, int y1);
void GUI_DrawArc (int x0, int y0, int rx, int ry, int a0, int a1);
void GUI_DrawBitmap (const GUI_BITMAP* pBM, int x0, int y0);
void GUI_DrawBitmapMag (const GUI_BITMAP* pBM, int x0, int y0, int XMul, int YMul);
void GUI_DrawBitmapExp (int x0, int y0, int XSize, int YSize, int XMul, int YMul,
int BitsPerPixel, int BytesPerLine,
const U8* pData, const GUI_LOGPALETTE* pPal);
void GUI_DrawCircle (int x0, int y0, int r);
void GUI_DrawEllipse (int x0, int y0, int rx, int ry);
void GUI_DrawGraph (I16 *pay, int NumPoints, int x0, int y0);
void GUI_DrawHLine (int y0, int x0, int x1);
void GUI_DrawLine (int x0, int y0, int x1, int y1);
void GUI_DrawLineRel (int dx, int dy);
void GUI_DrawLineTo (int x, int y);
void GUI_DrawPie (int x0, int y0, int r, int a0, int a1, int Type);
void GUI_DrawPixel (int x, int y);
void GUI_DrawPoint (int x, int y);
void GUI_DrawPolygon (const GUI_POINT*, int NumPoints, int x0, int y0);
void GUI_DrawPolyLine (const GUI_POINT*, int NumPoints, int x0, int y0);
void GUI_DrawFocusRect (const GUI_RECT *pRect, int Dist);
void GUI_DrawRect (int x0, int y0, int x1, int y1);
void GUI_DrawRectEx (const GUI_RECT *pRect);
void GUI_DrawVLine (int x0, int y0, int y1);
void GUI_FillCircle (int x0, int y0, int r);
void GUI_FillEllipse (int x0, int y0, int rx, int ry);
void GUI_FillPolygon (const GUI_POINT*, int NumPoints, int x0, int y0);
void GUI_FillRect (int x0, int y0, int x1, int y1);
void GUI_FillRectEx (const GUI_RECT* pRect);
void GUI_GetClientRect (GUI_RECT* pRect);
void GUI_InvertRect (int x0, int y0, int x1, int y1);
void GUI_MoveRel (int dx, int dy);
void GUI_MoveTo (int x, int y);
/*************************************************************************************************************
* Cursor routines--光标函数
*************************************************************************************************************/
#if GUI_SUPPORT_CURSOR
void GUI_CURSOR_Activate(void);
void GUI_CURSOR_Deactivate(void);
void GUI_CURSOR_Clear(void);
void GUI_CURSOR_SetXor(const GUI_BITMAP* pBM, int x, int y);
void GUI_CURSOR_SetPosition(int x, int y);
void GUI_CURSOR_TempHide (const GUI_RECT* pRect);
void GUI_CURSOR_TempUnhide(const GUI_RECT* pRect);
void GUI_CURSOR_Show(void);
#else
#define GUI_CURSOR_Show()
#endif
extern const GUI_BITMAP GUI_MouseArrow;
/*************************************************************************************************************
* Text related routines--文本相关的例程
*************************************************************************************************************/
void GUI_DispChar (U16 c);
void GUI_DispChars (U16 c, int Cnt);
void GUI_DispCharAt(U16 c, I16P x, I16P y);
void GUI_DispString(const char GUI_FAR *s);
void GUI_DispStringAt(const char GUI_FAR *s, int x, int y);
void GUI_DispStringAtCEOL(const char GUI_FAR *s, int x, int y);
void GUI_DispStringInRect(const char GUI_FAR *s, GUI_RECT* pRect, int Flags);
void GUI_DispStringLen(const char GUI_FAR *s, int Len);
void GUI_GetTextExtend(GUI_RECT* pRect, const char* s, int Len);
int GUI_GetYAdjust(void);
int GUI_GetDispPosX(void);
int GUI_GetDispPosY(void);
const GUI_FONT* GUI_GetFont(void);
int GUI_GetCharDistX(U16 c);
int GUI_GetStringDistX(const char GUI_FAR *s);
int GUI_GetFontDistY(void);
int GUI_GetFontSizeY(void);
int GUI_GetFontSizeYOf(const GUI_FONT* pFont);
void GUI_GetFontInfo(const GUI_FONT*pFont, GUI_FONTINFO* pfi);
int GUI_GetYSizeOfFont(const GUI_FONT* pFont);
int GUI_GetYDistOfFont(const GUI_FONT* pFont);
int GUI_GetTextAlign(void);
int GUI_GetTextMode(void);
char GUI_IsInFont(const GUI_FONT*pFont, U16 c);
void GUI_ScrollWin(int Win, int xDiff, int yDiff);
int GUI_SetTextAlign(int Align);
int GUI_SetTextMode(int Mode);
int GUI_SetLBorder(int x);
void GUI_SetOrg(int x, int y);
void GUI_SetCursor(int x, int y, int xlen);
void GUI_DispFatal(char*s);
const GUI_FONT* GUI_SetFont(const GUI_FONT* pNewFont);
char GUI_GotoXY(int x, int y);
char GUI_GotoX(int x);
char GUI_GotoY(int y);
void GUI_Scroll(int x, int y);
void GUI_DispNextLine(void);
#if GUI_SUPPORT_UNICODE
void GUI_DispString_UC(const U16 GUI_FAR *s);
void GUI_UC2DB (U16 Code, U8* pOut);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -