Graphics::DrawImage()函数的使用

 

Graphics 有18个DrawImage()重载函数,用于绘制图像,其中值得注意的有:

 

Status DrawImage(Image *image, INT x, INT y); 



         这是使用很方便一个函数,用于将图像绘制在(x,y)处,但是需注意的是:此函数会根据分辨率自动缩放所得的显示图片的长宽与源图像可能不一致。

 

 

 

———————————————————————————————————————————————————————

Status DrawImage(Image *image, INT x, INT y, INT width, INT height); // 可缩放(坐标对与宽高)


 

这个函数可用来对源图像进行整体缩放。

 

——————————————————————————————————————————————————————

 

 

 

Status DrawImage(Image* image, const RectF& destRect, REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, Unit srcUnit, const ImageAttributes* imageAttributes = NULL, DrawImageAbort callback = NULL, VOID* callbackData = NULL); // 可缩放(实数版)
// 可缩放(实数版) // 
Status DrawImage(Image *image, RectF &destRect, RectF &sourceRect, 
Unit srcUnit, ImageAttributes *imageAttributes = NULL); 

 

 

这两个函数可对源图像的指定部分进行缩放

如下实例:


 

 

  

			RectF destRC;
			destRC.X=0;
			destRC.Y=0;

			destRC.Width=100;      //   目标图片宽
			destRC.Height=100;  //  目标图片高

			m_pGbmp->DrawImage(m_pMemBmp,destRC,source_x,source_y,source_w,source_h,UnitPixel);


 

你可能感兴趣的:(图形图像处理)