⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gui.h

📁 ucOS 的商业版本源代码及相关开发的一些资料
💻 H
📖 第 1 页 / 共 3 页
字号:
/* 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_SetLUTEntry(U8 Pos, LCD_COLOR Color);

/*********************************************************************
*
*             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_DrawRect         (int x0, int y0, int x1, int y1);
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_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
*
**********************************************************************
*/

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(void);


/*********************************************************************
*
*              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);
  U16  GUI_DB2UC (U8 Byte0, U8 Byte1);
#endif

/*    *********************************
      *                               *
      *         GUISTR.C              *
      *                               *
      *********************************

String functions.

*/
void GUI_DispStringHCenterAt(const char GUI_FAR *s, int x, int y);


/*    *********************************
      *                               *
      *         GUIVAL.C              *
      *                               *
      *********************************
*/

void GUI_AddDec(I32 v, U8 Len, char**ps);
void GUI_AddDecMin(I32 v, char**ps);
void GUI_AddDecShift(I32 v, U8 Len, U8 Shift, char**ps);

void GUI_DispBin  (U32  v, U8 Len);
void GUI_DispBinAt(U32  v, I16P x, I16P y, U8 Len);
void GUI_DispCEOL (void);
void GUI_DispDec  (I32 v, U8 Len);
void GUI_DispDecMin(I32 v);
void GUI_DispDecAt (I32 v, I16P x, I16P y, U8 Len);
void GUI_DispDecShift(I32 v, U8 Len, U8 Shift);
void GUI_DispDecSpace(I32 v, U8 MaxDigits);
void GUI_DispHex  (U32 v, U8 Len);
void GUI_DispHexAt(U32 v, I16P x, I16P y, U8 Len);
void GUI_DispSDec(I32 v, U8 Len);
void GUI_DispSDecShift(I32 v, U8 Len, U8 Shift);
int  GUI_Long2Len(I32 v);

/*    *********************************
      *                               *
      *         GUIVALF.C             *
      *                               *
      *********************************

Routines to display floating point values. These routines use the routines
defined in the module GUIVAL.C as base routines.

*/

void GUI_DispFloat    (float v, char Len);
void GUI_DispFloatFix (float v, char Len, char Fract);
void GUI_DispFloatMin (float v, char Fract);
void GUI_DispSFloatFix(float v, char Len, char Fract);
void GUI_DispSFloatMin(float v, char Fract);


/*********************************************************************
*
*         Dynamic memory management
*
**********************************************************************
*/

#if !defined(GUI_ALLOC_ALLOC)
  void        GUI_ALLOC_Init(void);
  void*       GUI_ALLOC_h2p     (GUI_HMEM  hMem);
  void        GUI_ALLOC_Free    (GUI_HMEM  hMem);
  GUI_HMEM    GUI_ALLOC_Alloc(int size);
  /* diagnostics */
  int         GUI_ALLOC_GetUsed(void);
  int         GUI_ALLOC_GetNumFreeBytes(void);
  int         GUI_ALLOC_GetMaxSize(void);
  /* macros */
  #define GUI_ALLOC_ALLOC(size)     GUI_ALLOC_Alloc(size)
  #define GUI_ALLOC_H2P(h)          GUI_ALLOC_h2p(h)
  #define GUI_ALLOC_FREE(handle)    GUI_ALLOC_Free(handle)
  #define GUI_ALLOC_LOCK(handle)    GUI_ALLOC_h2p(handle)
  #define GUI_ALLOC_UNLOCK(handle)
#endif


/*********************************************************************
*
*      Memory device: GUI_MEMDEV
*
**********************************************************************
*/

#define GUI_MEMDEV_HASTRANS       0
#define GUI_MEMDEV_NOTRANS    (1<<0)

#if GUI_SUPPORT_MEMDEV
  typedef GUI_HMEM GUI_MEMDEV_Handle;
  typedef void GUI_CALLBACK_VOID_P(/*const*/ void* p);
  typedef int GUI_MEMDEV_tfDraw(GUI_RECT* pRect, GUI_CALLBACK_VOID_P* pfDraw, void* pData, int MemSize, int Flags);

  typedef struct {
    GUI_RECT rView, rPrev;
    char FirstCall;
  } GUI_AUTODEV;

  typedef struct {
    char DrawFixed;
  } GUI_AUTODEV_INFO;

  int  GUI_MEMDEV_DrawAuto(GUI_AUTODEV * pAutoDev, GUI_AUTODEV_INFO * pAutoDevInfo, GUI_CALLBACK_VOID_P * pfDraw, void * pData);
  void GUI_MEMDEV_DeleteAuto(GUI_AUTODEV * pAutoDev);
  int  GUI_MEMDEV_CreateAuto(GUI_AUTODEV * pAutoDev);

  /* Create a memory device which is compatible to the selected LCD */
  GUI_MEMDEV_Handle GUI_MEMDEV_Create  ( int x0, int y0, int XSize, int YSize);
  GUI_MEMDEV_Handle GUI_MEMDEV_CreateEx( int x0, int y0, int XSize, int YSize, int Flags);
  void GUI_MEMDEV_Select(GUI_MEMDEV_Handle hMem);  /* Select (activate) a particular memory device. */
  void GUI_MEMDEV_Clear(GUI_MEMDEV_Handle hMem);
  void GUI_MEMDEV_CopyFromLCDAA(GUI_MEMDEV_Handle hMem);
  void GUI_MEMDEV_CopyToLCD(GUI_MEMDEV_Handle hMem);
  void GUI_MEMDEV_CopyToLCDAA(GUI_MEMDEV_Handle hMem);
  int  GUI_MEMDEV_CompareWithLCD(GUI_MEMDEV_Handle hMem, int*px, int*py, int *pExp, int*pAct);
  void GUI_MEMDEV_SetOrg(GUI_MEMDEV_Handle hMem, int x0, int y0);
  void GUI_MEMDEV_ReduceYSize(GUI_MEMDEV_Handle hMem, int YSize);
  int  GUI_MEMDEV_GetYSize(GUI_MEMDEV_Handle hMem);
  void GUI_MEMDEV_Load(void);
  void GUI_MEMDEV_Delete(GUI_MEMDEV_Handle MemDev);
  void GUI_SelectLCD(void);
  unsigned int GUI_SelLCD(unsigned int Index);
  GUI_MEMDEV_tfDraw GUI_MEMDEV_Draw;

  void GUI_MEMDEV_CopyToLCDAt(GUI_MEMDEV_Handle hMem, int x, int y);
  void GUI_MEMDEV_CopyToLCD(GUI_MEMDEV_Handle hMem);
  void GUI_MEMDEV_CopyFromLCD(GUI_MEMDEV_Handle hMem);

#else
  #define GUI_SelectLCD()
#endif

/**************************************************************
*
*      Measure device: GUI_MEASDEV
*
***************************************************************
*/

typedef GUI_HMEM GUI_MEASDEV_Handle;

GUI_MEASDEV_Handle GUI_MEASDEV_Create (void);
void               GUI_MEASDEV_Delete (GUI_MEASDEV_Handle hMemDev);
void               GUI_MEASDEV_Select (GUI_MEASDEV_Handle hMem);
void               GUI_MEASDEV_GetRect(GUI_MEASDEV_Handle hMem, GUI_RECT *pRect);
void               GUI_MEASDEV_ClearRect(GUI_MEASDEV_Handle hMem);

/************************************************************
*
*                 Polygon helpers
*
*************************************************************
*/
void GUI_RotatePolygon(GUI_POINT* pDest, const GUI_POINT* pSrc, int NumPoints, float Angle);
void GUI_MagnifyPolygon(GUI_POINT* pDest, const GUI_POINT* pSrc, int NumPoints, int Mag);
void GUI_EnlargePolygon(GUI_POINT* pDest, const GUI_POINT* pSrc, int NumPoints, int Len);

/************************************************************
*
*                 Streamed bitmap
*
*************************************************************
*/
typedef void GUI_CALLBACK_VOID_U8_P(U8 Data, void* p);

void GUI_DrawStreamedBitmap(const GUI_BITMAP_STREAM *pBitmapStream, int x, int y);
void GUI_StreamBMP (GUI_RECT* pRect, GUI_CALLBACK_VOID_U8_P* pfStream, void*p);

/*********************************************************************
*
*                 Time related routines
*
**********************************************************************
*/
void GUI_Delay  (int Period);
int  GUI_GetTime(void);

/*********************************************************************
*
*                 MessageBox
*
**********************************************************************
*/
int GUI_MessageBox(const char* sMessage, const char*sCaption, int Flags);

/*********************************************************************
*
*                 GUI_TIMER module
*
**********************************************************************
*/

typedef struct GUI_TIMER_Message GUI_TIMER_MESSAGE;
struct GUI_TIMER_Message {
  GUI_TIMER_TIME Time;
	U32        Context;
};

typedef GUI_HMEM GUI_TIMER_Handle;
typedef void GUI_TIMER_CALLBACK(/*const*/ GUI_TIMER_MESSAGE* pTM);

GUI_TIMER_Handle GUI_TIMER_Create      (    GUI_TIMER_CALLBACK* cb, int Time,  U32 Context, int Flags);
void         GUI_TIMER_Delete      (GUI_TIMER_Handle pObj);

/* Methods changing properties */
void GUI_TIMER_SetPeriod (GUI_TIMER_Handle hObj, GUI_TIMER_TIME Period);
void GUI_TIMER_SetTime   (GUI_TIMER_Handle hObj, GUI_TIMER_TIME Period);
void GUI_TIMER_SetDelay  (GUI_TIMER_Handle hObj, GUI_TIMER_TIME Delay);
void GUI_TIMER_Restart   (GUI_TIMER_Handle hObj);
void GUI_TIMER_Exec(void);


/******************************************************************
*
*                 Anti Aliasing
*
*******************************************************************
*/

void GUI_AA_DisableHiRes   (void);
void GUI_AA_EnableHiRes    (void);
int  GUI_AA_GetFactor      (void);
void GUI_AA_SetFactor      (int Factor);
void GUI_AA_DrawArc        (int x0, int y0, int rx, int ry, int a0, int a1);
void GUI_AA_DrawLine       (int x0, int y0, int x1, int y1);
void GUI_AA_DrawPolyOutline(const GUI_POINT* pSrc, int NumPoints, int Thickness, int x, int y);
void GUI_AA_FillCircle     (int x0, int y0, int r);
void GUI_AA_FillPolygon    (GUI_POINT* pPoints, int NumPoints, int x0, int y0);

/* Defines for compatibility with older versins*/
#if GUI_COMPATIBLE_MODE
  #define GUI_DrawArcAA             GUI_AA_DrawArc
  #define GUI_DrawPolyOutlineAA     GUI_AA_DrawPolyOutline
  #define GUI_FillCircleAA          GUI_AA_FillCircle
  #define GUI_FillPolygonAA         GUI_AA_FillPolygon
#endif

/******************************************************************
*
*                 Keyboard
*
*******************************************************************
*/
int GUI_GetKey(void);
int GUI_WaitKey(void);
void GUI_StoreKey(int c);
void GUI_ClearKeyBuffer(void);

/*********************************************************************
*
*          TOUCH
*
*          types
*
**********************************************************************
*/
typedef struct {
  int x,y;
  unsigned char PressedCnt;
} GUI_TOUCH_tState;


/*********************************************************************
*
*          TOUCH
*

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -