www.pudn.com > JingXiang-Design-Jeff.rar > ImageInfo.cpp


// ImageInfo.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Design.h" 
#include "ImageInfo.h" 
#include "MainFrm.h" 
#include "DesignDoc.h" 
#include "DesignView.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// ImageInfo dialog 
 
 
ImageInfo::ImageInfo(CWnd* pParent /*=NULL*/) 
	: CDialog(ImageInfo::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(ImageInfo) 
	m_ColorBit = 0; 
	m_CompressionMethod = _T(""); 
	m_Height = 0; 
	m_Type = _T(""); 
	m_Width = 0; 
	m_NumOfColor = 0; 
	m_Curren_Ratio = 0.0f; 
	m_Current_Color_Status = _T(""); 
	//}}AFX_DATA_INIT 
} 
 
 
void ImageInfo::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(ImageInfo) 
	DDX_Text(pDX, IDC_IMAGE_COLOR_BIT, m_ColorBit); 
	DDV_MinMaxInt(pDX, m_ColorBit, 1, 24); 
	DDX_Text(pDX, IDC_IMAGE_COMPRESS_METHOD, m_CompressionMethod); 
	DDX_Text(pDX, IDC_IMAGE_HEIGHT, m_Height); 
	DDX_Text(pDX, IDC_IMAGE_TYPE, m_Type); 
	DDX_Text(pDX, IDC_IMAGE_WIDTH, m_Width); 
	DDX_Text(pDX, IDC_IMAGE_COLOR_NUM, m_NumOfColor); 
	DDX_Text(pDX, IDC_IMAGE_CURRENT_RATIO, m_Curren_Ratio); 
	DDX_Text(pDX, IDC_IMAGE_CURRENT_COLOR_STATUS, m_Current_Color_Status); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(ImageInfo, CDialog) 
	//{{AFX_MSG_MAP(ImageInfo) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// ImageInfo message handlers 
 
BOOL ImageInfo::OnInitDialog()  
{	 
	GetImageInfo(); 
	CDialog::OnInitDialog(); 
    return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
int ImageInfo::DoModal()  
{ 
	MessageBeep(0); 
 
	return CDialog::DoModal(); 
} 
 
void ImageInfo::GetImageInfo() 
{ 
 
      CDesignDoc *pDoc; 
	  CDesignView *pView; 
	  CMainFrame* pMFrame=(CMainFrame*)(AfxGetApp()->m_pMainWnd); 
      pDoc=(CDesignDoc*)pMFrame->GetActiveDocument(); 
      pView=(CDesignView*)pMFrame->GetActiveView(); 
	  this->m_Type=pDoc->BitMap.ImageType; 
	  this->m_ColorBit=pDoc->BitMap.InfoHeader_Bak.biBitCount; 
	  this->m_Width=pDoc->BitMap.InfoHeader_Bak.biWidth; 
	  this->m_Height=pDoc->BitMap.InfoHeader_Bak.biHeight; 
	  this->m_Curren_Ratio=pView->mNowRatio>0?(float)pView->mNowRatio:(float)(-1.0/pView->mNowRatio); 
	  this->m_Current_Color_Status=pDoc->BitMap.GetIsGray()?"»Ò¶ÈͼÏñ":"²ÊɫͼÏñ";    
		  if(m_ColorBit<24) 
		     this->m_NumOfColor=pDoc->BitMap.InfoHeader_Bak.biClrUsed?pDoc->BitMap.InfoHeader_Bak.biClrUsed:1<m_NumOfColor=1<<24; 
	  (m_ColorBit!=24)? 
		  1<BitMap.NumOfColor:1<BitMap.InfoHeader_Bak.biCompression) 
	  { 
	  case 0:this->m_CompressionMethod="δѹËõ"; 
		     break; 
	  case 1:this->m_CompressionMethod="REL_8"; 
		    break; 
	  case 2:this->m_CompressionMethod="REL_4"; 
		    break; 
	  default:this->m_CompressionMethod="δ֪"; 
		    break; 
	  } 
 
     return; 
}