📄 imagecamview.h
字号:
// imageCAMView.h : interface of the CimageCAMView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_imageCAMVIEW_H__57ECEFD3_C909_11D2_83AE_5254AB1C48FD__INCLUDED_)
#define AFX_imageCAMVIEW_H__57ECEFD3_C909_11D2_83AE_5254AB1C48FD__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Dib.h"
#include "FloatDibWnd.h"
// Define a new message to handle palette
#define WM_REALIZEPAL (WM_USER + 0x100)
#define MD_HORZ 1
#define MD_VERT 2
#define DT_SELECT 0
#define DT_FREELINE 1
#define DT_LINE 2
#define DT_CURVE 3
#define DT_RECT_H 4
#define DT_RECT_F 5
#define DT_ROUNDRECT_H 6
#define DT_ROUNDRECT_F 7
#define DT_ELLIP_H 8
#define DT_ELLIP_F 9
#define DT_FILL 10
#define DT_TEXT 11
#define DT_PICKER 12
#define DT_ERASER 13
#define DT_ZOOMMODE 14 //定义为视图显示模式的类型
typedef struct _Dot
{
double xx; //存放数据点的 X 坐标
double yy; //存放数据点的 Y 坐标
long sn; //存放数据点的组号
} Dot;
class CimageCAMView : public CScrollView
{
protected: // create from serialization only
CimageCAMView();
DECLARE_DYNCREATE(CimageCAMView)
CTypedPtrArray<CPtrArray, Dot*> DotArray; //定义一个类模板的实例用以所画图形的所有点
// Attributes
public:
CimageCAMDoc* GetDocument();
int m_nLengthUnit;
CDib* m_pDib;
CFloatDibWnd* m_pFloatWnd;
CRect m_rcClip;
CRect m_rcRubber;
CPoint m_ptStart;
BOOL m_bDrawingRubber;
int m_nDrawType;
int m_nPenStyle;
int m_nPenWidth;
COLORREF m_crPenColor;
COLORREF m_crFillColor;
CEdit m_EditText;
CFont* m_pFont;
BOOL m_bDrawFreeline;
BOOL m_bErasing;
CPoint m_ptFreelineStart;
int m_nDrawCurveStep;
BOOL m_bDrawCurve;
CPoint m_ptCurve[4];
HCURSOR m_hCursorFreeline;
HCURSOR m_hCursorEraser;
HCURSOR m_hCursorPicker;
HCURSOR m_hCursorFill;
HCURSOR m_hCursorCurve;
HCURSOR m_hCursorGeneralDraw;
int m_nTextAlign;
// Operations
public:
void EdgeEnhance(int nAlgorithm);
void SetStatusBarLengthUnit(int nUnit);
void SetStatusBarCursorPosition(CPoint point);
void SetStatusBarImageSize(CSize size);
void SetLengthUnit(int nUnit);
void SetStatusBarBitCount(WORD wBitcount);
void ShowPenColor();
void ShowFillColor();
void ShowPenWidth();
void ShowPenStyle();
void ShowColorGrid();
BOOL AdjustSize(HDIB hDib);
void Initialize(CDib* pDib);
BOOL PointInDib(CPoint point,double zoom);
void CreateFloatWnd(HDIB hDib, CPoint ptTopLeft);
void DeleteFloatWnd();
void MergeFloatDib();
void CutSelectedRect();
void StartDrawRubber(CPoint point);
void DrawRubber(CPoint point);
void StopDrawRubber();
void ClientToDib(CPoint& point);
void ClientToDib(CRect& rect);
void DibToClient(CPoint& point);
void DibToClient(CRect& rect);
BOOL AdjustPointinDib(CPoint& point);
void DoDrawRubber(CDC *pDC, CRect rc);
void DeleteFloatDib();
void CutFloatDib();
BOOL PasteDibFromClipboard();
BOOL PasteBitmapFromClipboard();
BOOL PastePalFromClipboard();
void Cut();
void Delete();
void CopyToClipboard();
void Paste();
void SelectPaste(int nCF);
void Rotate(int nAngle);
void Flip(int nDirection);
void Zoom(double fRatioX, double fRatioY);
void ChangeCanvasSize(int nWidth, int nHeight, int nPosition);
void ChangeImageSize(int nWidth, int nHeight);
void Crop();
BOOL MergeText();
void DrawCurve();
void DrawTmpCurve();
BOOL IsClipRectExist()
{
return (! m_rcClip.IsRectEmpty());
}
void SetDrawType(int nDrawType=DT_SELECT)
{
MergeFloatDib();
MergeText();
m_nDrawType = nDrawType;
}
void SetPenStyle(int nStyle=PS_SOLID)
{
m_nPenStyle = nStyle;
}
void SetPenWidth(int nWidth=1)
{
m_nPenWidth = nWidth;
}
void SetPenColor(COLORREF color=RGB(0,0,0))
{
m_crPenColor= color;
}
void SetFillColor(COLORREF color=RGB(0,0,0))
{
m_crFillColor = color;
}
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CimageCAMView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void OnInitialUpdate(); // called first time after construct
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView);
//}}AFX_VIRTUAL
// Implementation
public:
int m_zoommode;
void zoom(CPoint p,double r);
BOOL ImageDirectNC(double depth,int dir,int col,double radius,double overp,int dist,double rex,CString head,double rot,bool b_detail);
//depth为加工深度,dir 为方向,col为颜色优先
int CalculateDirection(long x1,long x2,long x3,long x4, long x5,long x6,long x7,long x8,int olddir);
BOOL CalculateGraphics(double rx,double depth,double rot,CString headin);
virtual ~CimageCAMView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CimageCAMView)
afx_msg void OnPencolor();
afx_msg void OnFillcolor();
afx_msg void OnSelect();
afx_msg void OnUpdateSelect(CCmdUI* pCmdUI);
afx_msg void OnPicker();
afx_msg void OnUpdatePicker(CCmdUI* pCmdUI);
afx_msg void OnEraser();
afx_msg void OnUpdateEraser(CCmdUI* pCmdUI);
afx_msg void OnFreeline();
afx_msg void OnUpdateFreeline(CCmdUI* pCmdUI);
afx_msg void OnLine();
afx_msg void OnUpdateLine(CCmdUI* pCmdUI);
afx_msg void OnCurve();
afx_msg void OnUpdateCurve(CCmdUI* pCmdUI);
afx_msg void OnRectH();
afx_msg void OnUpdateRectH(CCmdUI* pCmdUI);
afx_msg void OnRectF();
afx_msg void OnUpdateRectF(CCmdUI* pCmdUI);
afx_msg void OnRoundrectH();
afx_msg void OnUpdateRoundrectH(CCmdUI* pCmdUI);
afx_msg void OnRoundrectF();
afx_msg void OnUpdateRoundrectF(CCmdUI* pCmdUI);
afx_msg void OnEllipseH();
afx_msg void OnUpdateEllipseH(CCmdUI* pCmdUI);
afx_msg void OnEllipseF();
afx_msg void OnUpdateEllipseF(CCmdUI* pCmdUI);
afx_msg void OnFill();
afx_msg void OnUpdateFill(CCmdUI* pCmdUI);
afx_msg void OnText();
afx_msg void OnUpdateText(CCmdUI* pCmdUI);
afx_msg void OnSolid();
afx_msg void OnUpdateSolid(CCmdUI* pCmdUI);
afx_msg void OnDash();
afx_msg void OnUpdateDash(CCmdUI* pCmdUI);
afx_msg void OnDot();
afx_msg void OnUpdateDot(CCmdUI* pCmdUI);
afx_msg void OnPw1();
afx_msg void OnUpdatePw1(CCmdUI* pCmdUI);
afx_msg void OnPw2();
afx_msg void OnUpdatePw2(CCmdUI* pCmdUI);
afx_msg void OnPw3();
afx_msg void OnUpdatePw3(CCmdUI* pCmdUI);
afx_msg void OnPw4();
afx_msg void OnUpdatePw4(CCmdUI* pCmdUI);
afx_msg void OnPw5();
afx_msg void OnUpdatePw5(CCmdUI* pCmdUI);
afx_msg void OnPwOther();
afx_msg void OnUpdatePwOther(CCmdUI* pCmdUI);
afx_msg void OnFont();
afx_msg void OnLeft();
afx_msg void OnUpdateLeft(CCmdUI* pCmdUI);
afx_msg void OnCenter();
afx_msg void OnUpdateCenter(CCmdUI* pCmdUI);
afx_msg void OnRight();
afx_msg void OnUpdateRight(CCmdUI* pCmdUI);
afx_msg void OnEditSelectAll();
afx_msg void OnUpdateEditSelectAll(CCmdUI* pCmdUI);
afx_msg void OnEditPaste();
afx_msg void OnEditCut();
afx_msg void OnUpdateEditCut(CCmdUI* pCmdUI);
afx_msg void OnEditCopy();
afx_msg void OnUpdateEditCopy(CCmdUI* pCmdUI);
afx_msg void OnEditClear();
afx_msg void OnUpdateEditClear(CCmdUI* pCmdUI);
afx_msg void OnCopyto();
afx_msg void OnUpdateCopyto(CCmdUI* pCmdUI);
afx_msg void OnPastefrom();
afx_msg void OnUpdatePastefrom(CCmdUI* pCmdUI);
afx_msg void OnNorthwest();
afx_msg void OnUpdateNorthwest(CCmdUI* pCmdUI);
afx_msg void OnNortheast();
afx_msg void OnUpdateNortheast(CCmdUI* pCmdUI);
afx_msg void OnNorth();
afx_msg void OnUpdateNorth(CCmdUI* pCmdUI);
afx_msg void OnMm();
afx_msg void OnUpdateMm(CCmdUI* pCmdUI);
afx_msg void OnLf3();
afx_msg void OnUpdateLf3(CCmdUI* pCmdUI);
afx_msg void OnLf2();
afx_msg void OnUpdateLf2(CCmdUI* pCmdUI);
afx_msg void OnLf1();
afx_msg void OnInch();
afx_msg void OnUpdateInch(CCmdUI* pCmdUI);
afx_msg void OnHough();
afx_msg void OnUpdateHough(CCmdUI* pCmdUI);
afx_msg void OnHorz();
afx_msg void OnUpdateHorz(CCmdUI* pCmdUI);
afx_msg void OnHmirror();
afx_msg void OnUpdateHmirror(CCmdUI* pCmdUI);
afx_msg void OnHf3();
afx_msg void OnUpdateHf3(CCmdUI* pCmdUI);
afx_msg void OnHf2();
afx_msg void OnUpdateHf2(CCmdUI* pCmdUI);
afx_msg void OnHf1();
afx_msg void OnUpdateHf1(CCmdUI* pCmdUI);
afx_msg void OnGray();
afx_msg void OnUpdateGray(CCmdUI* pCmdUI);
afx_msg void OnCrop();
afx_msg void OnUpdateCrop(CCmdUI* pCmdUI);
afx_msg void OnColorbits();
afx_msg void OnCanvassize();
afx_msg void OnUpdateCanvassize(CCmdUI* pCmdUI);
afx_msg void OnBc();
afx_msg void OnUpdateBc(CCmdUI* pCmdUI);
afx_msg void OnAdjustcolor();
afx_msg void OnUpdateAdjustcolor(CCmdUI* pCmdUI);
afx_msg void OnScale();
afx_msg void OnUpdateScale(CCmdUI* pCmdUI);
afx_msg void OnRuler();
afx_msg void OnUpdateRuler(CCmdUI* pCmdUI);
afx_msg void OnVmirror();
afx_msg void OnSelectpaste();
afx_msg void OnUpdateSelectpaste(CCmdUI* pCmdUI);
afx_msg void OnPixel();
afx_msg void OnUpdatePixel(CCmdUI* pCmdUI);
afx_msg void OnImageThin();
afx_msg void OnImageFtreat();
afx_msg void OnImageOutput();
afx_msg void OnVert();
afx_msg void OnUpdateVert(CCmdUI* pCmdUI);
afx_msg void OnVerthorz();
afx_msg void OnUpdateVerthorz(CCmdUI* pCmdUI);
afx_msg void OnEast();
afx_msg void OnUpdateEast(CCmdUI* pCmdUI);
afx_msg void OnSoutheast();
afx_msg void OnUpdateSoutheast(CCmdUI* pCmdUI);
afx_msg void OnSouth();
afx_msg void OnUpdateSouth(CCmdUI* pCmdUI);
afx_msg void OnSouthwest();
afx_msg void OnUpdateSouthwest(CCmdUI* pCmdUI);
afx_msg void OnWest();
afx_msg void OnUpdateWest(CCmdUI* pCmdUI);
afx_msg void OnSobel();
afx_msg void OnUpdateSobel(CCmdUI* pCmdUI);
afx_msg void OnRotate();
afx_msg void OnUpdateRotate(CCmdUI* pCmdUI);
afx_msg void OnRotate180();
afx_msg void OnUpdateRotate180(CCmdUI* pCmdUI);
afx_msg void OnRotate270();
afx_msg void OnUpdateRotate270(CCmdUI* pCmdUI);
afx_msg void OnRotateother();
afx_msg void OnUpdateRotateother(CCmdUI* pCmdUI);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnUpdateLf1(CCmdUI* pCmdUI);
afx_msg void OnMedianfilter();
afx_msg void OnUpdateMedianfilter(CCmdUI* pCmdUI);
afx_msg void OnZoomout();
afx_msg void OnUpdateZoomout(CCmdUI* pCmdUI);
afx_msg void OnZoomin();
afx_msg void OnUpdateZoomin(CCmdUI* pCmdUI);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnToolsbase();
afx_msg void OnimageCAM();
afx_msg void OnZoommode();
afx_msg void OnZoomnormal();
afx_msg void OnUpdateZoomnormal(CCmdUI* pCmdUI);
afx_msg void OnUpdateZoommode(CCmdUI* pCmdUI);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnUpdateVmirror(CCmdUI* pCmdUI);
afx_msg void OnUpdateEditPaste(CCmdUI* pCmdUI);
afx_msg void OnOutline();
afx_msg void OnOutlinenc();
//}}AFX_MSG
afx_msg void OnFillcolor1();
afx_msg void OnPencolor1();
afx_msg void OnPenColorGrid(UINT nID);
afx_msg void OnRealizePal(WPARAM wParam, LPARAM lParam);
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // debug version in imageCAMView.cpp
inline CimageCAMDoc* CimageCAMView::GetDocument()
{ return (CimageCAMDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_imageCAMVIEW_H__57ECEFD3_C909_11D2_83AE_5254AB1C48FD__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -