题目
急!在线等~~C++怎么把图象缩小或放大一倍?
HDIB ChangeDIBSize(HDIB hDIB, int nWidth, int nHeight)
{ LPBITMAPINFO lpbmi = NULL;
LPBYTE lpSourceBits, lpTargetBits, lpResult;
HDC hDC = NULL, hSourceDC, hTargetDC;
HBITMAP hSourceBitmap, hTargetBitmap, hOldTargetBitmap, hOldSourceBitmap;
DWORD dwSourceBitsSize, dwTargetBitsSize, dwTargetHeaderSize;
HDIB hNewDIB;
DWORD dwSize;
WaitCursorBegin()
if (! hDIB)
{WaitCursorEnd();
return NULL;}
LPBITMAPINFO lpSrcDIB = (LPBITMAPINFO)GlobalLock(hDIB);
if (! lpSrcDIB)
{WaitCursorEnd();
return NULL;}
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,
HDIB ChangeDIBSize(HDIB hDIB, int nWidth, int nHeight)
{ LPBITMAPINFO lpbmi = NULL;
LPBYTE lpSourceBits, lpTargetBits, lpResult;
HDC hDC = NULL, hSourceDC, hTargetDC;
HBITMAP hSourceBitmap, hTargetBitmap, hOldTargetBitmap, hOldSourceBitmap;
DWORD dwSourceBitsSize, dwTargetBitsSize, dwTargetHeaderSize;
HDIB hNewDIB;
DWORD dwSize;
WaitCursorBegin()
if (! hDIB)
{WaitCursorEnd();
return NULL;}
LPBITMAPINFO lpSrcDIB = (LPBITMAPINFO)GlobalLock(hDIB);
if (! lpSrcDIB)
{WaitCursorEnd();
return NULL;}
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,
提问时间:2020-11-02
答案
HDIB是原始图像的句柄, nWidth和nHeight就是缩小或放大后的大小.直接调用就行.
WaitCursorBegin()
WaitCursorEnd();两句删掉;
WaitCursorBegin()
WaitCursorEnd();两句删掉;
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
热门考点