Bitmap改变大小

来源:百度知道 编辑:UC知道 时间:2024/06/02 06:12:55
如何在VC里将Bitmap大小改变一下.BitMap里有GetHeight(),GetWidth(),
但就是没有SetHeight()和SetWidth();
我想通过BitMap得到一幅压缩的图片,大小比原来的小,如何实现.我用的是在VC6.0环境下GDI+,不能用CImage这个类.

用StretchBlt可以放大或缩小bitmap

The StretchBlt function copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap to fit the dimensions of the destination rectangle, if necessary. The system stretches or compresses the bitmap according to the stretching mode currently set in the destination device context.

BOOL StretchBlt(
HDC hdcDest, // handle to destination DC
int nXOriginDest, // x-coord of destination upper-left corner
int nYOriginDest, // y-coord of destination upper-left corner
int nWidthDest, // width of destination rectangle
int nHeightDest, // height of destination rectangle
HDC hdcSrc, // handle to source DC
int nXOriginSrc, // x-coord of source upper-left corner
int nYOriginSrc, // y-coord of source upper-left corner
int nWidthSrc, // width of source rectangle
int nHeightSrc, // height of source rectangle
DWORD