dib_draw.h
来自「实时监控」· C头文件 代码 · 共 64 行
H
64 行
#ifndef _DIB_DRAW_H
#define _DIB_DRAW_H
#include "vfw.h"
#pragma comment(lib,"vfw32.lib")
/// DrawDibXXX函数族封装类.
class dib_draw
{
HDRAWDIB handle; // handle
CWnd *o; // owner
BITMAPINFOHEADER bih;
public:
dib_draw():handle(NULL), o(NULL){}
~dib_draw(){destroy();}
bool create(CWnd* owner, int w, int h, DWORD fourcc, int bitcount)
{
o = owner;
ZeroMemory(&bih, sizeof(bih));
bih.biSize = sizeof(bih);
bih.biBitCount = bitcount;
bih.biCompression = fourcc;
bih.biWidth = w;
bih.biHeight = h;
bih.biPlanes = 1;
handle = DrawDibOpen();
return handle != NULL;
}
void destroy()
{
if( handle )
{
DrawDibClose(handle);
handle = NULL;
}
o = NULL;
}
void draw(void* buf)
{
if( !handle || !o ) return;
CClientDC dc(o);
CRect rc;
o->GetClientRect(rc);
draw(buf, &dc, rc);
}
void draw(void* buf, CDC* pdc, CRect rc)
{
DrawDibDraw(handle, pdc->m_hDC, rc.left, rc.top, rc.Width(), rc.Height(),
&bih, buf,
0, 0, bih.biWidth, bih.biHeight,
SRCCOPY);
}
};
#endif // _DIB_DRAW_H
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?