鸿 网 互 联 www.68idc.cn

当前位置 : 服务器租用 > 手机系统开发 > J2ME > >

cxImage 在VC2005中取两幅图片共同的部分(or) 两幅图片大小相同

来源:互联网 作者:佚名 时间:2015-09-25 05:44
CString str; str.Format(_T("%s"),"d://2.bmp"); imagemode.Load(str,CXIMAGE_FORMAT_BMP); byte r, g, b; RGBQUAD pixel1,pixel2,pixel3; long maxY = imagepic.GetHeight(); long maxX = imagepic.GetWidth(); long maxxY=imagemode.GetHeight(); long ma

CString str;
 str.Format(_T("%s"),"d://2.bmp");
 imagemode.Load(str,CXIMAGE_FORMAT_BMP);
 byte r, g, b;
    RGBQUAD  pixel1,pixel2,pixel3;
 long maxY = imagepic.GetHeight();
    long maxX = imagepic.GetWidth();
 long maxxY=imagemode.GetHeight();
 long maxxX=imagemode.GetWidth();
 for(long i=0;i<maxxY-1;i++)
 {
  for(long j=0;j<maxxX-1;j++)
  { 
   pixel1=imagepic.GetPixelColor(j,i);
   pixel2=imagemode.GetPixelColor(j,i);
   pixel3.rgbRed= pixel1.rgbRed|pixel2.rgbRed;
   pixel3.rgbGreen= pixel1.rgbGreen|pixel2.rgbGreen;
   pixel3.rgbBlue= pixel1.rgbBlue|pixel2.rgbBlue;
   imagemode.SetPixelColor(j,i,pixel3);

  }
 }
 CString str1;
 str1.Format(_T("%s"),"d://3.bmp");
 imagemode.Save(str1,CXIMAGE_FORMAT_BMP);
     //将整个控件调整为与图像同一尺寸
 GetDlgItem(IDC_PicMode)->SetWindowPos(NULL,0,0,300,300,SWP_NOMOVE);
 CRect zcRect;
 GetDlgItem(IDC_PicMode)->GetClientRect(&zcRect);
 CDC *pDC=GetDlgItem(IDC_PicMode)->GetDC();
 imagemode.Draw(pDC->m_hDC,zcRect.left,zcRect.top,300,300);

网友评论
<