?? magichouseview.h
字號:
// MagicHouseView.h : CMagicHouseView 類的接口
//
#pragma once
class CMagicHouseView : public CView
{
DECLARE_MESSAGE_MAP()
DECLARE_DYNCREATE(CMagicHouseView)
public:
BYTE* m_pImageBuffer; // 編輯圖像原始像素數組
BYTE* m_pImageTempBuffer; // 處理后的像素數組
UINT m_nPicWidth; // 當前編輯圖像寬度
UINT m_nPicHeight; // 當前編輯圖像高度
UINT m_nTempWidth; // 處理后圖像的寬度
UINT m_nTempHeight; // 處理后圖像的高度
bool m_bWidhtOut; // 顯示圖像是否超出視圖寬度
bool m_bHeightOut; // 顯示圖像是否超出視圖高度
bool m_bIsEditMode; // 當前是否為編輯模式
int m_nShowType; // 顯示類型
virtual ~CMagicHouseView();
void ShowPicture(CDC* pDC, Image& image, int nShowType);
// 以指定模式顯示圖像
void SetShowType(int nType); // 設置顯示模式
CSize GetShowPicSize(Image& image, int nShowType);
// 獲得指定模式下圖像的大小
void OpenFile(const CString& strPath); // 打開圖像文件
/******************************************************************************
* 作用: 清除圖像的偏移坐標
******************************************************************************/
void ClearOffset(void)
{
m_nXX = m_nYY = m_nXXMax = m_nYYMax = 0;
}
void FixOffset(void); // 修正圖像的偏移坐標
/***************************************************************************
* 作用: 獲得指定索引文件的全路徑
***************************************************************************/
CString GetFilePath(int nIndex)
{
ASSERT(nIndex >= 0 && nIndex < m_nPicNum);
return m_strPath + L"\\" + m_FilesNameAry[nIndex];
}
void RefreshIndicator(); // 更新狀態欄的指示器信息
CMagicHouseDoc* GetDocument() const;
virtual void OnDraw(CDC* pDC); // 重寫以繪制該視圖
// 消息響應函數
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
// 鼠標移動的響應函數
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
// 單擊鼠標左鍵的響應函數
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
// 設置鼠標光標
afx_msg void OnFileOpen(); // "打開"的命令響應函數
afx_msg void OnFileSave(); // "保存"的命令相應函數
afx_msg BOOL OnEraseBkgnd(CDC* pDC);// 禁止重繪背景
afx_msg void OnModeBrowse(); // 瀏覽模式
afx_msg void OnModeEdit(); // 編輯模式
// "模式"更新函數
afx_msg void OnUpdateModeBrowse(CCmdUI *pCmdUI);
afx_msg void OnUpdateModeEdit(CCmdUI *pCmdUI);
// "顯示模式"菜單相關函數
afx_msg void OnModeNormal();
afx_msg void OnModeWidth();
afx_msg void OnModeHeight();
afx_msg void OnModeScreen();
afx_msg void OnUpdateModeNormal(CCmdUI *pCmdUI);
afx_msg void OnUpdateModeWidth(CCmdUI *pCmdUI);
afx_msg void OnUpdateModeHeight(CCmdUI *pCmdUI);
afx_msg void OnUpdateModeScreen(CCmdUI *pCmdUI);
// "視圖"下"圖像"菜單相關函數
afx_msg void OnImagePrev();
afx_msg void OnImageNext();
afx_msg void OnImageFirst();
afx_msg void OnImageLast();
afx_msg void OnUpdateImagePrev(CCmdUI *pCmdUI);
afx_msg void OnUpdateImageNext(CCmdUI *pCmdUI);
afx_msg void OnUpdateImageFirst(CCmdUI *pCmdUI);
afx_msg void OnUpdateImageLast(CCmdUI *pCmdUI);
// "顯示特效"菜單相關函數
afx_msg void OnEffectNone();
afx_msg void OnEffectRand();
afx_msg void OnEffectScan();
afx_msg void OnEffectDscan();
afx_msg void OnEffectMove();
afx_msg void OnEffectVBlind();
afx_msg void OnEffectHRaster();
afx_msg void OnEffectMosaic();
afx_msg void OnEffectHsmove();
afx_msg void OnEffectSblind();
afx_msg void OnEffectVraster();
afx_msg void OnEffectRaindrop();
afx_msg void OnUpdateEffectNone(CCmdUI *pCmdUI);
afx_msg void OnUpdateEffectRand(CCmdUI *pCmdUI);
afx_msg void OnUpdateEffectScan(CCmdUI *pCmdUI);
afx_msg void OnUpdateEffectDscan(CCmdUI *pCmdUI);
afx_msg void OnUpdateEffectMove(CCmdUI *pCmdUI);
afx_msg void OnUpdateEffectBlind(CCmdUI *pCmdUI);
afx_msg void OnUpdateEffectRaster(CCmdUI *pCmdUI);
afx_msg void OnUpdateEffectMosaic(CCmdUI *pCmdUI);
afx_msg void OnUpdateEffectHsmove(CCmdUI *pCmdUI);
afx_msg void OnUpdateEffectSblind(CCmdUI *pCmdUI);
afx_msg void OnUpdateEffectVraster(CCmdUI *pCmdUI);
afx_msg void OnUpdateEffectRaindrop(CCmdUI *pCmdUI);
protected:
CMagicHouseView();
virtual void OnInitialUpdate(); // 更新函數
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
private:
int m_nEffectDisplayType;// 當前特效類型
bool m_bEffectDraw; // 是否使用特效顯示
Bitmap* m_pBitmap; // 雙緩存繪圖
int m_nPicNum; // 當前目錄的文件個數
CString m_strPath; // 當前打開目錄
CStringArray m_FilesNameAry; // 保存當前目錄下所有文件名的容器
int m_nPos; // 當前文件在容器中的索引
int m_nShowPicHeight; // 顯示圖片的高度
int m_nShowPicWidth; // 顯示圖片的寬度
CPoint m_psMove; // 記錄移動前鼠標的位置
int m_nXX; // 圖片X坐標的偏移量
int m_nYY; // 圖片Y坐標的偏移量
int m_nXXMax; // X坐標最大偏移量
int m_nYYMax; // Y坐標最大偏移量
void PreDrawImage(void); // 在內存中預先繪制圖像
void EffectDisplayImage(CDC* pDC, CDC* pMemDC);
// 使用特效顯示圖像
bool GetImageBuffer(CString& strPath);
// 將指定路徑的圖像信息提取到數組中
void FreeImageBuffer(void); // 釋放圖像信息占用的內存
void WriteBufferToBMP(BYTE *im_buffer, WORD X_bitmap, WORD Y_bitmap, const char* BMPname);
// 將圖像信息寫入bmp文件中
void ResetImage(); // 重置m_pImageTempBuffer的信息
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
};
#ifndef _DEBUG // MagicHouseView.cpp 中的調試版本
inline CMagicHouseDoc* CMagicHouseView::GetDocument() const
{ return reinterpret_cast<CMagicHouseDoc*>(m_pDocument); }
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -