?? ic_dec.h
字號:
#ifndef _IC_DEC_H
#define _IC_DEC_H
#include "vfw.h"
#pragma comment(lib,"vfw32.lib")
#include "is.h"
struct bih: public BITMAPINFOHEADER
{
public:
bih()
{
init();
}
void init()
{
biSize = init_struct(*this);
biPlanes = 1;
}
void set_size(int w, int h)
{
biWidth = w;
biHeight = h;
}
void set_bytes(DWORD bytes)
{
biSizeImage = bytes;
}
// fcc: 0 indicates RGB
void set_fcc(DWORD fcc, int bitcount)
{
biCompression = fcc;
biBitCount = bitcount;
}
};
class ic_dec
{
HIC h;
bih bi; // bih_in
bih bo; // bih_out
void init()
{
bi.init();
bi.init();
}
public:
ic_dec():h(NULL){}
~ic_dec(){destroy();}
bool create(int in_w, int in_h, DWORD in_fcc, DWORD out_fcc, int out_bitcount)
{
if( h )
return true;
h = ICOpen(ICTYPE_VIDEO, in_fcc, ICMODE_DECOMPRESS);
if( !h )
return false;
bi.set_size(in_w, in_h);
bi.set_fcc(in_fcc, 0);
bo.set_size(in_w, in_h);
bo.set_fcc(out_fcc, out_bitcount);
bo.set_bytes(in_w*in_h*out_bitcount/8);
return true;
}
void destroy(){if(h) {ICClose(h); h = NULL;}}
bool begin()
{
int err = ICDecompressBegin(h, &bi, &bo);
if( err != ICERR_OK )
return false;
return true;
}
void end()
{
ICDecompressEnd(h);
}
bool decode(void* in_buf, DWORD in_bytes, void* out_buf)
{
bi.set_bytes(in_bytes);
if( ICERR_OK != ICDecompress(h, 0, &bi, in_buf, &bo, out_buf) )
return false;
return true;
}
};
#endif // _IC_DEC_H
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -