📄 gdi.h
字号:
/**************************SeekFor GUI Cool(TM) V1.0 for S3C44B0x**********************************
程序设计:Seek_For@163.com,Seek_For@eyou.com,Seek_For@tom.com
个人说明:
这是个免费的GUI,但请不要用于商业用途,否则本人保留收取1xxx RMB的权利,嘿嘿。
个人学习使用,请注明出处,谢谢!
软件说明:
这个GUI和Microsoft的GDI在API上基本兼容,因此熟悉了Windows的GDI就很容易使用GUI COOL(TM)。
但有很多特性不支持,比如CreateFont()只支持前两个参数nHeight和nWidth。
使用说明:
1.使用HDC之前必须先初始化LCD,因此在使用前必须调用GetDC(NULL)或GDI_RUN()。
2.整个屏幕的HDC可以再次调用GetDC(NULL),返回值就是屏幕的HDC指针
3.可以建立很多的HDC,并且可以用BitBlt()把这些HDC画到屏幕上
代码示范:
HDC hScr=CreateDC(NULL);*********这行代码获取显示器的HDC指针(如果没有初始化会自动启动)
LineTo(hScr,100,100);************从画笔的当前位置画线到(100,100)
***************************************************************************************************/
#ifndef _GDI_H
#define _GDI_H
#include "lcd.h"
#include "def.h"
typedef DWORD HANDLE;
typedef void * HICON;
typedef void *HCURSOR;
typedef void *HBRUSH;
typedef void *HGDIOBJ ;
typedef struct
{
int nObject;
int nXScale;
int nYScale;
int nXOrg;
int nYOrg;
}_HFONT_,*HFONT;
typedef struct
{
int nObject;
COLORREF ccColor;
}_HPEN_,*HPEN;
/************SelectObject()使用的标志*******************/
#define OBJ_FONT 0
#define OBJ_PEN 1
#define OBJ_BRUSH 2
/***********SetBkMode()和GetBkMode()*******************/
#define OPAQUE 0
#define TRANSPARENT 1
typedef struct
{
int nWidth;
int nHeight;
int nColors;
}DEVMODE,*LPDEVMODE;
typedef struct
{
int nSize;
int nWidth;
int nHeight;
int nColors;
int nX;
int nY;
COLORREF ccTextColor;
COLORREF ccBkColor;
int bLocked;
int bFilled;
int nMode;
/*Objects*/
HFONT hFont;
HPEN hPen;
UINT *lpImage;
}_HDC_,*HDC;
typedef struct
{
UINT style;
UINT lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HANDLE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPCTSTR lpszMenuName;
LPCTSTR lpszClassName;
} WNDCLASS;
typedef struct
{
HDC hDC;
WNDCLASS wcClass;
DWORD dwStyle;
unsigned char szCaption[32];
}_HWND_,*HWND;
/***************************************************GDI API*******************************************************/
HDC GetDC(HWND hWnd);
HDC CreateDC(LPSTR lpszDrive,LPSTR lpszDevice,LPSTR lpszOutput,LPDEVMODE lpInitData);
BOOL DeleteDC(HDC hDC);
BOOL ReleaseDC(HWND hWnd,HDC hDC);
HDC GetWindowDC(HWND hWnd);
int TextOut(HDC hDC,int x,int y,LPSTR lpszText,int cbCount);
COLORREF GetTextColor(HDC hDC);
COLORREF SetTextColor(HDC hDC,COLORREF ccColor);
COLORREF SetBkColor(HDC hDC,COLORREF ccColor);
COLORREF GetBkColor(HDC);
int SetBkMode(HDC hDC,int iMode);
int GetBkMode(HDC hDC);
COLORREF SetPixel(HDC hDC,int x,int y,COLORREF ccColor);
COLORREF GetPixel(HDC hDC,int x,int y);
BOOL LineTo(HDC hDC,int x,int y);
BOOL MoveToEx(HDC hDC,int x,int y,LPPOINT pt);
BOOL MoveTo(HDC hDC,int x,int y);
BOOL Polyline(HDC hDC,POINT *pt,int ccPoints);
BOOL Rectangle(HDC hDC,int nLeft,int nTop,int nRight,int nBottom);
BOOL BitBlt(HDC hdcDest,int nXDest,int nYDest,int nWidth,int nHeight,HDC hdcSrc,int nXSrc,int nYSrc,DWORD dwRop);
BOOL FloodFill(HDC hdc,int nXStart,int nYStart,COLORREF crFill);
HFONT CreateFont(int nHeight,int nWidth,int nReserved1,int nReserved2,int nReserved3,int nReserved4,int nReserved5,int nReserved6,int nReserved7,int nReserved8,int nReserved,int nReserved10,int nReserved11,LPSTR szFontName);
HGDIOBJ SelectObject(HDC hDC,HGDIOBJ hObj);
HPEN CreatePen(UINT nPenStyle,UINT nWidth,COLORREF ccColor);
#define GDI_RUN() GetDC(NULL)
/**************************************************USER API******************************************************/
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -