图像渐变算法--记录

	CString m_path1,m_path2;
        m_path1="1.jpg";m_path2="2.jpg";
	if(m_path1 != "" && m_path2 != "")
	{
	
		setPath(file1,file2);
		BeginWaitCursor();
		CString strPath = m_path1;

		SAFE_FREE(m_pImage1);

		CFile file;
		file.Open(strPath,CFile::modeRead);

		BITMAPFILEHEADER bfh;
		file.Read(&bfh,sizeof(BITMAPFILEHEADER));
		file.Read(&m_bmpBuf1,sizeof(BITMAPINFOHEADER));

		if ( IsBMP(m_bmpBuf1) == FALSE)
		{
			file.Close();
			return;
		}

		m_pImage1 = (LPBYTE) malloc (m_bmpBuf1.biSizeImage);
		file.Read(m_pImage1,m_bmpBuf1.biSizeImage);	
		file.Close();
		EndWaitCursor();
		Invalidate();	

		BeginWaitCursor();
		//CString
		strPath = m_path2;
		SAFE_FREE(m_pImage2);

		//CFile file;
		file.Open(strPath,CFile::modeRead);

		//BITMAPFILEHEADER bfh;
		file.Read(&bfh,sizeof(BITMAPFILEHEADER));
		file.Read(&m_bmpBuf2,sizeof(BITMAPINFOHEADER));

		if ( IsBMP(m_bmpBuf2) == FALSE)
		{
			file.Close();
			return;
		}

		m_pImage2 = (LPBYTE) malloc (m_bmpBuf2.biSizeImage);
		file.Read(m_pImage2,m_bmpBuf2.biSizeImage);
		file.Close();

		GraphTransformation();
		EndWaitCursor();
		Invalidate();
	}
	else
	{
	//	AfxMessageBox(L"请先选择好两个图");
		return;
	}

你可能感兴趣的:(VC/MFC)