#if !defined(AFX_SLIMSCROLLVIEW_H__08F7FD45_AE99_43B5_85BC_41CC19F62C8E__INCLUDED_) #define AFX_SLIMSCROLLVIEW_H__08F7FD45_AE99_43B5_85BC_41CC19F62C8E__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // SampleView.h : header file // #define MSG_SCANVIEW (WM_USER+105) #define MSG_SCANVIEW_MOUSEPOS (WM_USER+106) #define MSG_SCANVIEW_POS_ADD (WM_USER+107)//20140528 #define MSG_SCANVIEW_POS_MOD (WM_USER+108)//20140528 enum SLIM_MODECOMMAND{SLIM_MODE_ZOOMIN=0,SLIM_MODE_ZOOMOUT,SLIM_MODE_NORMAL,SLIM_MODE_POINT}; #define SLIM_MAXZOOMIN 10 // Maximum zoom-in factor #define SLIM_MAXZOOMOUT 2 const LONG SLIM_IMG_MAX_WIDTH = 200; const LONG SLIM_IMG_MAX_HEIGHT = 120; const double SLIM_SCALE_FACTOR = 1; //Region of interest (ROI) #ifndef _FV_ROI_ #define _FV_ROI_ typedef struct { LONG u1; LONG v1; LONG u2; LONG v2; } FV_ROI, *FV_LPROI; #endif #ifndef RANGEIN #define RANGEIN(a, r1, r2) (((a>=r1)&&(a<=r2)) ? (1) : (0)) #endif ////////////////////////////////////////////////////////////////////////// // °á°ú¿µ»ó ¹× °á°ú¸¦ µð½ºÇ÷¹ÀÌÇØÁØ´Ù. ////////////////////////////////////////////////////////////////////////// class CSlimScrollView : public CScrollView { public: CSlimScrollView(); // protected constructor used by dynamic creation virtual ~CSlimScrollView(); DECLARE_DYNCREATE(CSlimScrollView) public: void SetBrightHwnd(CWnd *pWnd){m_pBrightHWnd=pWnd;} void SetOrgImgSize(int width, int height) {m_ImageWidth=m_ScaleWidth=width,m_ImageHeight=m_ScaleHeight=height,m_zoomScale=1.0,m_pDispBuf=m_pSetupIMG;} CSize GetOrgImgSize(){return CSize(m_ImageWidth,m_ImageHeight);} void SetDrawRect(BOOL bDraw){m_bDrawRect=bDraw;} void SetDrawNotchInsPos(BOOL bDraw){m_bDrawNotchInsPos=bDraw;}//20140528 void SetRectPoint(CPoint point){m_pRectPoint=point;} BOOL InitGDI(int width, int height, bool bColor); void SetHWnd(CWnd *pWnd){m_pParents=pWnd;} LPBYTE GetBuffer(){return m_pSetupIMG;} void DrawRefresh(); void SetMode(SLIM_MODECOMMAND nMode); void SetDefectRect(CRect* a_rtDefect){ if(a_rtDefect) m_rtDefect.SetRect(a_rtDefect->left,a_rtDefect->top,a_rtDefect->right,a_rtDefect->bottom);} void SetDrawDefect(bool bDraw){m_bDefect = bDraw;} void SetSendMessage(bool bMessage){m_bMessage = bMessage;} void SetZoomMode(bool bZoom){m_bZoomMode = bZoom;} void ResetImgBuf(){ ZeroMemory(m_pSetupIMG,sizeof(BYTE)*m_width*m_height); m_pDispBuf = m_pSetupIMG;} void ReleaseMemory(); void SetMarkPos(CPoint origin,CPoint offset){m_OriginPos=origin,m_OffsetPos=offset;} CRect GetDrawRect(); void SetSplinePosition(std::multimap *pPoint,CPoint pointOffset); std::multimap *GetSplinePos(){return &m_pSplinePos;} CPoint GetSplineOffset(){return m_pointSplineOffset;} void SetNotchInsPosition(std::multimap *pPoint);//20140528 void SetNotchInsListIdx(int Idx){m_nNotchInsListIdx = Idx;}//20140528 void SetNotchInsPosMod(BOOL bMod){m_bNotchInsPosMod = bMod;}//20140528 void SetNotchCadCenterPos(int nPosX, int nPosY);//20140528 protected: void EnlargeImage(BYTE *pInBuff, LONG wSrcWidth, LONG wSrcHeight, BYTE *pOutBuff, LONG wDestWidth, LONG wDestHeight,double scale); BYTE CalcWeightedColor(BYTE* pPixels, CSize size, double dX, double dY); void ShrinkImage(BYTE *pInBuff, LONG wSrcWidth, LONG wSrcHeight, BYTE *pOutBuff, LONG wDestWidth, LONG wDestHeight,double scale); BOOL CalcScaleSize(); BOOL DoZoomInOut(); void DisplayError(); void DrawImage(LPBYTE pImg); void DrawRectangle(CRect rect,COLORREF color); void DrawMark(); void DrawLine(long sx, long sy, long ex, long ey, COLORREF color,int nStyle=PS_SOLID); void DrawPoint(); void DrawSpline(); void DrawNotchInsPos();//20140528 void DoOrigin(); CString GetMoneyRule(CString strMoney, int nRuleSpace/*=0*/); private: HDC m_hMemDC; HDC m_hMainDC; CDC* m_pDC; BITMAPINFO *m_pBMI; HWND m_hImageWnd; CWnd *m_pParents; LPBYTE m_pSetupIMG; LPBYTE m_pScaleIMg; LPBYTE m_pDispBuf; HBITMAP m_hBitmap; CPoint m_pRectPoint; BOOL m_bDrawRect; BOOL m_bDrawNotchInsPos;//20140528 SLIM_MODECOMMAND m_nCurMode; HCURSOR m_pCursor; LONG m_ImageWidth; LONG m_ImageHeight; LONG m_ScaleWidth; LONG m_ScaleHeight; double m_zoomScale; CWnd* m_pBrightHWnd; CRect m_rtDefect; bool m_bDefect; CRect m_rtRect; bool m_bRect; bool m_bMessage; int m_width; int m_height; CPoint m_OriginPos; CPoint m_OffsetPos; CPoint m_MousePoint; bool m_bZoomMode; // Áß¿ä ÁÜ ¸ðµå¿Í ³ë¸» ¸ðµå¸¦ ±¸ºÐ std::multimap m_pSplinePos; CPoint m_pointSplineOffset; std::multimap m_pNotchInsPos;//20140528 int m_nNotchInsListIdx;//20140528 BOOL m_bNotchInsPosMod;//20140528 int m_nNotchCadCenterX;//20140528 int m_nNotchCadCenterY;//20140528 // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CSlimScrollView) public: virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL); virtual BOOL DestroyWindow(); protected: virtual void OnDraw(CDC* pDC); // overridden to draw this view virtual void OnInitialUpdate(); // first time after construct virtual void PostNcDestroy(); //}}AFX_VIRTUAL #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif // Generated message map functions //{{AFX_MSG(CSlimScrollView) afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnRButtonDown(UINT nFlags, CPoint point); afx_msg void OnRButtonUp(UINT nFlags, CPoint point); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); //}}AFX_MSG afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message); DECLARE_MESSAGE_MAP() public: afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);//20140528 }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_SAMPLEVIEW_H__08F7FD45_AE99_43B5_85BC_41CC19F62C8E__INCLUDED_)