更新时间:2015-10-08 21:14:53浏览次数:1+次
Bitmap bmp(L"wlh.bmp");
INT height=bmp.GetHeight();
INT width=bmp.GetWidth();
RectF dest[4];
dest[0]=RectF(0,0,width/2,height/2);
dest[1]=RectF(width/2,0,width/2,height/2);
dest[2]=RectF(0,height/2,width/2,height/2);
dest[3]=RectF(width/2,height/2,width/2,height/2);
//把原图像分为分四块克隆
Bitmap *s[4];
s[0]=bmp.Clone(dest[0],PixelFormatDontCare);
s[1]=bmp.Clone(dest[1],PixelFormatDontCare);
s[2]=bmp.Clone(dest[2],PixelFormatDontCare);
s[3]=bmp.Clone(dest[3],PixelFormatDontCare);
//绘图
graphics.DrawImage(s[0],RectF(0,0,width/2,height/2));
graphics.DrawImage(s[1],RectF(width/2+10,0,width/2,height/2));
graphics.DrawImage(s[2],RectF(0,height/2+10,width/2,height/2));
graphics.DrawImage(s[3],RectF(width/2+10,height/2+10,width/2,height/2));
看结果:
相关资讯