一个非GUI(vc++)程序对图片进行处理,处理完成后获得某个区域比如(x,y,width,heigh),想保存这个区域为本地图片,该如何做?
(x,y,width,heigh)
走同样的路,发现不同的人生
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();
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.