📄 display.h
字号:
#ifndef __DISPLAY_H__#define __DISPLAY_H__#include "figure.h"#define FONTSIZE_SMALL 1#define FONTSIZE_MIDDLE 2#define FONTSIZE_BIG 3#define FONT_TRANSPARENT 4 //透明背景#define FONT_BLACKBK 8 //黑底白字#define GRAPH_MODE_NORMAL 0x00 //普通绘图模式#define GRAPH_MODE_OR 0x10 //绘图模式 或#define GRAPH_MODE_AND 0x20 //绘图模式 与#define GRAPH_MODE_XOR 0x30 //绘图模式 异或#define GRAPH_MODE_NOR 0x40 //绘图模式 或非#define COLOR_BLACK 0 //黑色前景色#define COLOR_WHITE 0xffffffff //白色前景色#define GRAPH_ARC_BACKWARD 0 //逆时针画圆#define GRAPH_ARC_FORWARD 1 //顺时针画圆#define GRAPH_3D_UP 0 //突起的3D矩形框#define GRAPH_3D_DOWN 1 //凹陷的3D矩形框//***********************************************/#define TEXTOUT_MID_X 1#define TEXTOUT_MID_Y 2typedef struct tagBITMAPFILEHEADER { U32 bfSize; U32 bfReserved12; U32 bfOffBits;} BITMAPFILEHEADER, *PBITMAPFILEHEADER;typedef struct tagBITMAPINFOHEADER { U32 biSize; U32 biWidth; U32 biHeight; U16 biPlanes; U16 biBitCount; U32 biCompression; U32 biSizeImage; U32 biXPelsPerMeter; U32 biYPelsPerMeter; U32 biClrUsed; U32 biClrImportant;} BITMAPINFOHEADER;typedef U32 COLORREF;//定义绘图设备结构typedef struct{ int DrawPointx; int DrawPointy; //绘图所使用的坐标点 int PenWidth; //画笔宽度 U32 PenMode; //画笔模式 COLORREF PenColor; //画笔的颜色 int DrawOrgx; //绘图的坐标原点位置 int DrawOrgy; int WndOrgx; //绘图的窗口坐标位置 int WndOrgy; int DrawRangex; //绘图的区域范围 int DrawRangey; structRECT DrawRect;//绘图的有效范围 U8 bUpdataBuffer; //是否更新后台缓冲区及显示 U32 Fontcolor; //字符颜色}DC,*PDC;#define RGB(r,g,b) (((r)<<16)|((g)<<8)|(b))void initOSDC();PDC CreateDC();void DestoryDC(PDC pdc);void SetPixel(PDC pdc, int x, int y, COLORREF color);void SetPixelOR(PDC pdc,int x, int y, COLORREF color);void SetPixelAND(PDC pdc,int x, int y, COLORREF color);void SetPixelXOR(PDC pdc, int x, int y, COLORREF color);int GetFontHeight(U8 fnt);void TextOut(PDC pdc,int x, int y, U16 *ch, U8 bunicode, U8 fnt); //显示文字void TextOutRect(PDC pdc, structRECT* prect, U16* ch, U8 bunicode, U8 fnt, U32 outMode); //在指定矩形的范围内显示文字void MoveTo(PDC pdc, int x, int y);void LineTo(PDC pdc, int x, int y);void DrawRectFrame(PDC pdc, int left,int top ,int right, int bottom);void DrawRectFrame2(PDC pdc, structRECT *rect);void FillRect(PDC pdc, int left,int top ,int right, int bottom,U32 DrawMode, U32 color);void FillRect2(PDC pdc, structRECT *rect,U32 DrawMode, U32 color);void ClearScreen();U8 SetPenWidth(PDC pdc, U8 width);U32 SetPenMode(PDC pdc, U32 mode);void Circle(PDC pdc, int x0, int y0, int r);int Getdelta1(int x0,int y0, int R);int Getdelta2(int x0,int y0, int R);void ArcTo1(PDC pdc, int x1, int y1, int R);void ArcTo2(PDC pdc, int x1, int y1, int R);void ArcTo(PDC pdc, int x1, int y1, U8 arctype, int R);//void ArcTo(int x1,int y1, U8 arctype, int cenx,int ceny);U8 SetLCDUpdata(PDC pdc, U8 isUpdata);void Draw3DRect(PDC pdc, int left,int top, int right, int botton, COLORREF color1, COLORREF color2);void Draw3DRect2(PDC pdc, structRECT *rect, COLORREF color1, COLORREF color2);U8 GetPenWidth(PDC pdc);U32 GetPenMode(PDC pdc);U32 SetPenColor(PDC pdc, U32 color);U32 GetPenColor(PDC pdc);void GetBmpSize(char filename[], int* Width, int *Height);void ShowBmp(PDC pdc, char filename[], int x, int y);void SetDrawOrg(PDC pdc, int x,int y, int* oldx, int *oldy);//设置绘图的原点void SetDrawRange(PDC pdc, int x,int y, int* oldx, int *oldy);//设置绘图的范围////////////////////有延时绘图/////////////////void LineToDelay(PDC pdc, int x, int y, int ticks);void ArcToDelay(PDC pdc, int x1, int y1, U8 arctype, int R, int ticks);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -