//截图
int cropImage(const char* file, int left, int top, int right, int bottom, BYTE* &dstData, DWORD& dstLen)
{
DWORD dw1 = GetTickCount();
fipImage image;
BOOL bSuccess = image.load(file);
if ( !bSuccess )
{
printf("image.load fail\n");
return -;
}
//bSuccess = image.crop(0, 0, 300, 200);
bSuccess = image.crop(left, top, right, bottom);
if ( !bSuccess )
{
printf("image.crop fail\n");
return -;
} // fipImage -> fipMenoryIO
fipMemoryIO memIO;
bSuccess = image.saveToMemory(FIF_JPEG, memIO, JPEG_DEFAULT);
if ( !bSuccess )
{
printf("image.saveToMemory fail\n");
return -;
} // fipMemoryIO -> char*
BYTE* srcData = NULL;;
DWORD size_in_bytes = ;
bSuccess = memIO.acquire(&srcData, &size_in_bytes);
if ( !bSuccess )
{
printf("memIO.acquire fail\n");
return -;
} DWORD dw2 = GetTickCount() - dw1;
printf("%u\n", dw2); dstLen = size_in_bytes;
BYTE* data = new BYTE[dstLen];
memcpy(data, srcData, dstLen);
dstData = data;
// bSuccess = image.save("crop.jpg");
return ;
} //函数使用
BYTE* data = NULL;;
DWORD dataLen = ;
cropImage(lpszTestFile, , , , , data, dataLen);