fheight *=2;
htemp ++;
}
float* tData = new float[fwidth*fheight];
float* fData = new float[fwidth*fheight];
unsigned char* pTempData= NULL;
for (x = 0; x<fheight; x++)
{
for (y = 0; y<fwidth; y++)
{
pTempData = (unsigned char*)pBits + bLines* (bHeight-1-x)+y;
tData[y+x*fwidth] = *(pTempData);
}
}
for (x = 0 ; x< fheight; x++)
{
DCT(&tData[fwidth*x],&fData[fwidth*x],wtemp);
}
for (x = 0; x<fheight; x++)
{
for (y = 0; y<fwidth; y++)
{
tData[y*fheight+x] = fData[y+fwidth*x];
}
}
for (y = 0; y<fwidth; y++)
{
DCT(&tData[y*fheight],&fData[y*fheight],htemp);
}
for (x = 0; x<fheight; x++)
{
for (y = 0; y<fwidth;y++)
{
temp = fabs(fData[y*fheight+x]);
if (temp>255)
temp = 255;
pTempData = (unsigned char*) pBits+bLines* (bHeight-1-x)+y;
*(pTempData) = (BYTE)temp;
}
}
free(tData);
free(fData);
}
void CConsinConvertDlg::OnConvert()
{
if (!m_Convert)
{
CBitmap bmp;
bmp.Attach(m_hBmp);
BITMAPINFO bInfo;
bmp.GetObject(sizeof(bInfo),&bInfo);
BITMAP bMap;
bmp.GetBitmap(&bMap);
CFile file;
file.Open(".\\Source.bmp",CFile::modeReadWrite);
int len = file.GetLength();
HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT,len);
LPSTR pFile= (LPSTR) GlobalLock(hData)
上一篇:
ConsinConvert.cpp
下一篇:
浮生若萍