急!在线等~~C++怎么把图象缩小或放大一倍?
HDIBChangeDIBSize(HDIBhDIB,intnWidth,intnHeight)
{LPBITMAPINFOlpbmi=NULL;
LPBYTElpSourceBits,lpTargetBits,lpResult;
HDChDC=NULL,hSourceDC,hTargetDC;
HBITMAPhSourceBitmap,hTargetBitmap,hOldTargetBitmap,hOldSourceBitmap;
DWORDdwSourceBitsSize,dwTargetBitsSize,dwTargetHeaderSize;
HDIBhNewDIB;
DWORDdwSize;
WaitCursorBegin()
if(!hDIB)
{WaitCursorEnd();
returnNULL;}
LPBITMAPINFOlpSrcDIB=(LPBITMAPINFO)GlobalLock(hDIB);
if(!lpSrcDIB)
{WaitCursorEnd();
returnNULL;}
dwTargetHeaderSize=sizeof(BITMAPINFOHEADER)+PaletteSize(lpSrcDIB);
lpbmi=(LPBITMAPINFO)malloc(dwTargetHeaderSize);
memcpy(lpbmi,lpSrcDIB,dwTargetHeaderSize);
lpbmi->bmiHeader.biWidth=nWidth;
lpbmi->bmiHeader.biHeight=nHeight;
hDC=GetDC(NULL);
hTargetBitmap=CreateDIBSection(hDC,lpbmi,DIB_RGB_COLORS,(VOID**)&lpTargetBits,NULL,0);
hSourceBitmap=CreateDIBSection(hDC,lpSrcDIB,DIB_RGB_COLORS,(VOID**)&lpSourceBits,NULL,0);
hSourceDC=CreateCompatibleDC(hDC);
hTargetDC=CreateCompatibleDC(hDC);
dwSourceBitsSize=lpSrcDIB->bmiHeader.biHeight*BytesPerLine((LPBYTE)&(lpSrcDIB->bmiHeader));
dwTargetBitsSize=lpbmi->bmiHeader.biHeight*BytesPerLine((LPBYTE)&(lpbmi->bmiHeader));
memcpy(lpSourceBits,FindDIBBits((LPBYTE)lpSrcDIB),dwSourceBitsSize);
lpbmi->bmiHeader.biSizeImage=dwTargetBitsSize;
hOldSourceBitmap=(HBITMAP)SelectObject(hSourceDC,hSourceBitmap);
hOldTargetBitmap=(HBITMAP)SelectObject(hTargetDC,hTargetBitmap);
SetStretchBltMode(hTargetDC,COLORONCOLOR);
StretchBlt(hTargetDC,0,0,lpbmi->bmiHeader.biWidth,lpbmi->bmiHeader.biHeight,hSourceDC,0,0,lpSrcDIB->bmiHeader.biWidth,lpSrcDIB->bmiHeader.biHeight,SRCCOPY);
SelectObject(hSourceDC,hOldSourceBitmap);
SelectObject(hTargetDC,hOldTar