区域切图实例

/*
			//切图区域
			s_Image_Info &stDispImgInfo = spImgInfo->m_stDispInfo;
			s_Image_Info stCutImgInfo;
			CRect rtImgRegion = theDataService.GetModelAnalyzer()->GetCurtImgRegion(m_iWorkStationNo);
			nWidth = rtImgRegion.Width();
			nHeight = rtImgRegion.Height();
			
			auto f1 = [&rtImgRegion,&stCutImgInfo,&stDispImgInfo]() {
				CRect rtCutMy;
				rtCutMy.left = min(rtImgRegion.left, rtImgRegion.right);
				rtCutMy.right = max(rtImgRegion.left, rtImgRegion.right);
				rtCutMy.top = stDispImgInfo.nImageHeight - 1 - max(rtImgRegion.top, rtImgRegion.bottom);
				rtCutMy.bottom = stDispImgInfo.nImageHeight - 1 - min(rtImgRegion.top, rtImgRegion.bottom);


				s_Image_Info temp;
				temp.nImageWidth = rtCutMy.right - rtCutMy.left + 1;
				temp.nImageHeight = rtCutMy.bottom - rtCutMy.top + 1;
				temp.nImageBits = stDispImgInfo.nImageBits;
				//temp.pImageBuf = new BYTE[getImageBufferSize(temp.nImageWidth, temp.nImageHeight, temp.nImageBits)];
				int size = temp.nImageWidth * temp.nImageHeight * temp.nImageBits / 8;
				temp.pImageBuf = new BYTE[size];

				//int nLineWidthSrc = (stDispImgInfo.nImageWidth * (stDispImgInfo.nImageBits / 8) + 3) / 4 * 4;
				//int nLineWidthDst = (temp.nImageWidth * (temp.nImageBits / 8) + 3) / 4 * 4;
				int nLineWidthSrc = stDispImgInfo.nImageWidth * (stDispImgInfo.nImageBits / 8);
				int nLineWidthDst = temp.nImageWidth * (temp.nImageBits / 8);
				const BYTE* const sImageInfoSrcBuffer = stDispImgInfo.pImageBuf;
				BYTE* const sImageInfoDstBuffer = temp.pImageBuf;

				for (int i = rtCutMy.top; i <= rtCutMy.bottom; i++) {
					const auto pSrc = sImageInfoSrcBuffer + i * nLineWidthSrc + rtCutMy.left * (stDispImgInfo.nImageBits / 8);
					const auto pDst = sImageInfoDstBuffer + (i - rtCutMy.top) * nLineWidthDst;
					memcpy(pDst, pSrc, nLineWidthDst);
				}

				//stCutImgInfo = std::move(temp);
				stCutImgInfo = temp;
			};
			f1();
			*/
s_Image_Info_Re dstImage;
			s_Image_Info &srcImage = spImgInfo->m_stDispInfo;
			CRect rect = theDataService.GetModelAnalyzer()->GetCurtImgRegion(m_iWorkStationNo);
			theDataService.GetModelAnalyzer()->GetCutImage(dstImage, srcImage, rect);
			nWidth = dstImage.width;
			nHeight = dstImage.height;
			PBYTE pImageBuf = &dstImage.data[0];
			m_wndImageShow.DisplayImage(pImageBuf, nWidth, nHeight, (srcImage.nImageBits + 7) / 8, false);
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值