📄 pex.h
字号:
int deleteimage();
#ifdef _GRAPH_LIB_BUILD_
public:
#else
private:
#endif
viewporttype m_vpt;
textsettingstype m_texttype;
linestyletype m_linestyle;
COLORREF m_bk_color;
private:
void inittest(WCHAR* strCallFunction = NULL) const;
public:
IMAGE();
IMAGE(int width, int height);
IMAGE(IMAGE &img); // 拷贝构造函数
IMAGE& operator = (const IMAGE &img); // 赋值运算符重载函数
~IMAGE();
int getwidth() {return m_width; }
int getheight() {return m_height;}
PDWORD getbuffer() {return m_pBuffer;}
int createimage(int width, int height);
void getimage(int srcX, int srcY, int srcWidth, int srcHeight);
void getimage(const IMAGE *pSrcImg, int srcX, int srcY, int srcWidth, int srcHeight);
int getimage(LPCSTR pImgFile, int zoomWidth = 0, int zoomHeight = 0);
int getimage(LPCWSTR pImgFile, int zoomWidth = 0, int zoomHeight = 0);
int getimage(LPCSTR pResType, LPCSTR pResName, int zoomWidth = 0, int zoomHeight = 0);
int getimage(LPCWSTR pResType, LPCWSTR pResName, int zoomWidth = 0, int zoomHeight = 0);
int getimage(void* pMem, long size);
void putimage(int dstX, int dstY, DWORD dwRop = SRCCOPY) const;
void putimage(int dstX, int dstY, int dstWidth, int dstHeight, int srcX, int srcY, DWORD dwRop = SRCCOPY) const;
void putimage(IMAGE *pDstImg, int dstX, int dstY, DWORD dwRop = SRCCOPY) const;
void putimage(IMAGE *pDstImg, int dstX, int dstY, int dstWidth, int dstHeight, int srcX, int srcY, DWORD dwRop = SRCCOPY) const;
void putimage(IMAGE *pDstImg, int dstX, int dstY, int dstWidth, int dstHeight, int srcX, int srcY, int srcWidth, int srcHeight, DWORD dwRop = SRCCOPY) const;
int
putimage_transparent(
PIMAGE imgdest, // handle to dest
int nXOriginDest, // x-coord of destination upper-left corner
int nYOriginDest, // y-coord of destination upper-left corner
COLORREF crTransparent, // color to make transparent
int nXOriginSrc = 0, // x-coord of source upper-left corner
int nYOriginSrc = 0, // y-coord of source upper-left corner
int nWidthSrc = 0, // width of source rectangle
int nHeightSrc = 0 // height of source rectangle
);
int
putimage_alphablend(
PIMAGE imgdest, // handle to dest
int nXOriginDest, // x-coord of destination upper-left corner
int nYOriginDest, // y-coord of destination upper-left corner
unsigned char alpha, // alpha
int nXOriginSrc = 0, // x-coord of source upper-left corner
int nYOriginSrc = 0, // y-coord of source upper-left corner
int nWidthSrc = 0, // width of source rectangle
int nHeightSrc = 0 // height of source rectangle
);
int
putimage_alphatransparent(
PIMAGE imgdest, // handle to dest
int nXOriginDest, // x-coord of destination upper-left corner
int nYOriginDest, // y-coord of destination upper-left corner
COLORREF crTransparent, // color to make transparent
unsigned char alpha, // alpha
int nXOriginSrc = 0, // x-coord of source upper-left corner
int nYOriginSrc = 0, // y-coord of source upper-left corner
int nWidthSrc = 0, // width of source rectangle
int nHeightSrc = 0 // height of source rectangle
);
int
imagefilter_blurring_4 (
int intensity,
int alpha,
int nXOriginDest,
int nYOriginDest,
int nWidthDest,
int nHeightDest
);
int
imagefilter_blurring_8 (
int intensity,
int alpha,
int nXOriginDest,
int nYOriginDest,
int nWidthDest,
int nHeightDest
);
int
imagefilter_blurring (
int intensity,
int alpha,
int nXOriginDest = 0,
int nYOriginDest = 0,
int nWidthDest = 0,
int nHeightDest = 0
);
};
void getimage(IMAGE *pDstImg, int srcX, int srcY, int srcWidth, int srcHeight); // 从屏幕获取图像
void getimage(IMAGE *pDstImg, const IMAGE *pSrcImg, int srcX, int srcY, int srcWidth, int srcHeight); // 从另一个 IMAGE 对象中获取图像
int getimage(IMAGE *pDstImg, LPCSTR pImgFile, int zoomWidth = 0, int zoomHeight = 0); // 从图片文件获取图像(bmp/jpg/gif/emf/wmf)
int getimage(IMAGE *pDstImg, LPCWSTR pImgFile, int zoomWidth = 0, int zoomHeight = 0); // 从图片文件获取图像(bmp/jpg/gif/emf/wmf)
int getimage(IMAGE *pDstImg, LPCSTR pResType, LPCSTR pResName, int zoomWidth = 0, int zoomHeight = 0); // 从资源文件获取图像(bmp/jpg/gif/emf/wmf)
int getimage(IMAGE *pDstImg, LPCWSTR pResType, LPCWSTR pResName, int zoomWidth = 0, int zoomHeight = 0); // 从资源文件获取图像(bmp/jpg/gif/emf/wmf)
void putimage(int dstX, int dstY, const IMAGE *pSrcImg, DWORD dwRop = SRCCOPY); // 绘制图像到屏幕
void putimage(int dstX, int dstY, int dstWidth, int dstHeight, const IMAGE *pSrcImg, int srcX, int srcY, DWORD dwRop = SRCCOPY); // 绘制图像到屏幕(指定宽高)
void putimage(int dstX, int dstY, int dstWidth, int dstHeight, const IMAGE *pSrcImg, int srcX, int srcY, int srcWidth, int srcHeight, DWORD dwRop = SRCCOPY); // 绘制图像到屏幕(指定源宽高和目标宽高进行拉伸)
void putimage(IMAGE *pDstImg, int dstX, int dstY, const IMAGE *pSrcImg, DWORD dwRop = SRCCOPY); // 绘制图像到另一图像中
void putimage(IMAGE *pDstImg, int dstX, int dstY, int dstWidth, int dstHeight, const IMAGE *pSrcImg, int srcX, int srcY, DWORD dwRop = SRCCOPY); // 绘制图像到另一图像中(指定宽高)
void putimage(IMAGE *pDstImg, int dstX, int dstY, int dstWidth, int dstHeight, const IMAGE *pSrcImg, int srcX, int srcY, int srcWidth, int srcHeight, DWORD dwRop = SRCCOPY); // 绘制图像到另一图像中(指定源宽高和目标宽高进行拉伸)
int putimage_transparent(
PIMAGE imgdest, // handle to dest
PIMAGE imgsrc, // handle to source
int nXOriginDest, // x-coord of destination upper-left corner
int nYOriginDest, // y-coord of destination upper-left corner
COLORREF crTransparent, // color to make transparent
int nXOriginSrc = 0, // x-coord of source upper-left corner
int nYOriginSrc = 0, // y-coord of source upper-left corner
int nWidthSrc = 0, // width of source rectangle
int nHeightSrc = 0 // height of source rectangle
);
int putimage_alphablend(
PIMAGE imgdest, // handle to dest
PIMAGE imgsrc, // handle to source
int nXOriginDest, // x-coord of destination upper-left corner
int nYOriginDest, // y-coord of destination upper-left corner
unsigned char alpha, // alpha
int nXOriginSrc = 0, // x-coord of source upper-left corner
int nYOriginSrc = 0, // y-coord of source upper-left corner
int nWidthSrc = 0, // width of source rectangle
int nHeightSrc = 0 // height of source rectangle
);
int putimage_alphatransparent(
PIMAGE imgdest, // handle to dest
PIMAGE imgsrc, // handle to source
int nXOriginDest, // x-coord of destination upper-left corner
int nYOriginDest, // y-coord of destination upper-left corner
COLORREF crTransparent, // color to make transparent
unsigned char alpha, // alpha
int nXOriginSrc = 0, // x-coord of source upper-left corner
int nYOriginSrc = 0, // y-coord of source upper-left corner
int nWidthSrc = 0, // width of source rectangle
int nHeightSrc = 0 // height of source rectangle
);
int imagefilter_blurring (
PIMAGE imgdest, // handle to dest
int intensity,
int alpha,
int nXOriginDest = 0,
int nYOriginDest = 0,
int nWidthDest = 0,
int nHeightDest = 0
);
// 其它函数
#define getmaxx getwidth
#define getmaxy getheight
int getwidth(IMAGE* pimg = NULL); // 获取图片宽度
int getheight(IMAGE* pimg = NULL); // 获取图片高度
int getx(IMAGE* pimg = NULL); // 获取当前 x 坐标
int gety(IMAGE* pimg = NULL); // 获取当前 y 坐标
void BeginBatchDraw(); // 开始批量绘制
void FlushBatchDraw(); // 执行未完成的绘制任务
void FlushBatchDraw(int left, int top, int right, int bottom); // 执行指定区域内未完成的绘制任务
void EndBatchDraw(); // 结束批量绘制,并执行未完成的绘制任务
void EndBatchDraw(int left, int top, int right, int bottom); // 结束批量绘制,并执行指定区域内未完成的绘制任务
HWND GetHWnd(); // 获取绘图窗口句柄
HINSTANCE GetHInstance();
int GetGraphicsVer(); // 获取当前版本 ###
float GetFPS(int flag = 1); // 获取当前帧率,请使用默认参数
//随机函数
void randomize();
unsigned int random(unsigned int n);
double randomf();
//高级输入函数
// title 对话框标题, text 对话框提示文字, buf接收输入数据的字符串指针, len指出buf的最大长度,也同时会限制输入内容长度
int InputBoxGetLine(LPCSTR title, LPCSTR text, LPSTR buf, int len); //弹出对话框,让用户输入,当前程序运行暂停,返回非0表示输入有效,0为无效
int InputBoxGetLine(LPCWSTR title, LPCWSTR text, LPWSTR buf, int len); //弹出对话框,让用户输入,当前程序运行暂停,返回非0表示输入有效,0为无效
// 鼠标消息
// 支持如下消息:
// WM_MOUSEMOVE 鼠标移动
// WM_MOUSEWHEEL 鼠标滚轮拨动
// WM_LBUTTONDOWN 左键按下
// WM_LBUTTONUP 左键弹起
// WM_LBUTTONDBLCLK 左键双击
// WM_MBUTTONDOWN 中键按下
// WM_MBUTTONUP 中键弹起
// WM_MBUTTONDBLCLK 中键双击
// WM_RBUTTONDOWN 右键按下
// WM_RBUTTONUP 右键弹起
// WM_RBUTTONDBLCLK 右键双击
struct MOUSEMSG
{
UINT uMsg; // 当前鼠标消息
bool mkCtrl; // Ctrl 键是否按下
bool mkShift; // Shift 键是否按下
bool mkLButton; // 鼠标左键是否按下
bool mkMButton; // 鼠标中键是否按下
bool mkRButton; // 鼠标右键是否按下
short x; // 当前鼠标 x 坐标
short y; // 当前鼠标 y 坐标
short wheel; // 鼠标滚轮滚动值(120为基数)
};
int MouseHit(); // 检查是否存在鼠标消息
MOUSEMSG GetMouseMsg(); // 获取一个鼠标消息。如果没有,就等待
void FlushMouseMsgBuffer(); // 清空鼠标消息缓冲区
int ShowMouse(int bShow); // 设置是否显示鼠标
int GetMousePos(int *x, int *y);// 获取当前鼠标位置
/*
callback function define as:
int __stdcall on_msg_key(void* param, unsigned msg, int key);
msg: see 'enum message_event'
key: keycode
return zero means process this message, otherwise means pass it and then process with 'getkey' function
*/
//int message_addkeyhandler(void* param, LPMSG_KEY_PROC func); //设置键盘回调函数
/*
callback function define as:
int __stdcall on_msg_mouse(void* param, unsigned msg, int key, int x, int y);
msg: see 'enum message_event'
key: see 'enum message_mouse', if msg==MSG_EVENT_WHELL, key is a int number that indicates the distance the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA, which is 120.
x,y: current mouse (x, y)
return zero means process this message, otherwise means pass it and then process with 'GetMouseMsg' function
*/
//int message_addmousehandler(void* param, LPMSG_MOUSE_PROC func); //设置鼠标回调函数
int SetCloseHandler(LPCALLBACK_PROC func);
#ifndef _GRAPH_LIB_BUILD_
#if defined(_MSC_VER) && (defined(HIDE_CONSOLE) || !defined(SHOW_CONSOLE))
#pragma comment( linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"" )
#endif
#define Sleep(ms) delay_ms(ms)
#endif
#if !defined(_MSC_VER)
#define WinMain(...) WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
#elif defined(_CONSOLE)
#if (_MSC_VER > 1200)
#define WinMain(...) main(int argc, char* argv[])
#else
#define WinMain() main(int argc, char* argv[])
#endif
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -