c++ - 如何用IPicture保存指定区域?
怪我咯
怪我咯 2017-04-17 13:58:07
0
1
621
  1. 一个非GUI(vc++)程序对图片进行处理,处理完成后获得某个区域比如(x,y,width,heigh),想保存这个区域为本地图片,该如何做?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(1)
刘奇

The main function of IPicture is the render function, which can redraw any area of ​​the screen. Controls, windows, etc. can be abstracted as CDC (device context), then CImage also belongs to CDC, so just draw the area on CImage.

CImage image;
image.Create( weight, height, 32 );//指定image的大小参数
pPic->Render( image.GetDC(), 0, 0, weight, height, x, hmHeight - y, w, 0 - h, NULL );//参数为自己需要的区域。注意:要了解一下render图像是从左下角开始的,然后参数涉及矩阵的运算
image.Save( "D:\abc.jpg" );
image.ReleaseDC();
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template