📄 histogram.h
字号:
#if !defined(AFX_HISTOGRAM_H__01FCC481_4C4A_40B2_95AB_509564E99655__INCLUDED_)#define AFX_HISTOGRAM_H__01FCC481_4C4A_40B2_95AB_509564E99655__INCLUDED_#if _MSC_VER > 1000#pragma once#endif // _MSC_VER > 1000// Histogram.h : header file///////////////////////////////////////////////////////////////////////////////// RxHistogram window#include "Spectrum.h"// fixed layout size#define HGSZ_SCROLL 10 // Scroll Bar Height#define HGSZ_SCROLL_MARGIN 6 // Scroll Bar客 Histogram 荤捞狼 咯归#define HGSZ_OTF_TMARGIN 5 // 洒胶配弊伐 郴何 惑困 咯归#define HGSZ_OTF_BMARGIN 14 // 洒胶配弊伐 郴何 窍困 咯归#define HGSZ_SPECTRUM 20 // Spectrum Bar Height#define HGSZ_HITTEST 3 // 付快胶 hit test甫 困茄 康开阑 瘤沥秦 敌促// defined hittest#define HGHT_SCROLL_LEFT 10#define HGHT_SCROLL_CENTER 11#define HGHT_SCROLL_RIGHT 12#define HGHT_OTF_POINT1 20#define HGHT_OTF_POINT2 21#define HGHT_OTF_POINT3 22#define HGHT_OTF_POINT4 23#define HGHT_OTF_LINE1 24#define HGHT_OTF_LINE2 25#define HGHT_OTF_LINE3 26#define HGHT_OTF_POLYGON 27// function argument apply count#define HGARG_1 0x0001#define HGARG_2 0x0002#define HGARG_3 0x0004#define HGARG_4 0x0008#define HGARG_ALL 0x000Ftypedef struct{ int nMinSize; // bar狼 弥家 农扁(Pixel窜困) int nRangeMinOut, nRangeMaxOut; // Scroll Bar狼 弥措/弥家 农扁 int nRangeMinIn, nRangeMaxIn; // Histogram狼 弥措/弥家 农扁 int nPoMin, nPoMax; // Scroll Bar狼 困摹(蔼 窜困) int nPiMin, nPiMax; // Scroll Bar狼 困摹(侨伎 窜困)} _SCROLL;typedef struct{ int nMaxMagnitude; // 弥措 后档荐 int nSize; // Histogram data size UINT *pHistogram; // Histogram data} _HISTOGRAM;typedef struct{ BOOL bVisible; int nLevel; int nWidth; BYTE byTable[4097];} _WINDOWING;typedef struct{ BOOL bEnable; COLORREF crPoint[4]; int nPointPoX[4]; int nPointPiX[4]; int nPointPiY[4]; float fOpacityPo;} _OTF_POLYGON;// WM_NOTIFY message#define OTF_POS_CHANGED 0x0001#define OTF_ACTIVE_CHANGED 0X0002#define OTF_COLOR_CHANGED 0x0003typedef struct{ NMHDR hdr; int nCurOTF; void *pHistogram;} _NMHISTO_CTRL;class RxHistogram : public CWnd{// Constructionpublic: RxHistogram();// Attributespublic: // Color Information(setting in construction) COLORREF m_crBackHistogram_in; COLORREF m_crBackHistogram_out; COLORREF m_crBackground; COLORREF m_crBackOTFMargin; COLORREF m_crBackSpectrum; COLORREF m_crHistogram; COLORREF m_crGrid; COLORREF m_crWindowing; CSize m_szWindow; // settting in WM_SIZE message handler _SCROLL m_stScroll; _HISTOGRAM m_stHistogram; _WINDOWING m_stWindowing; int m_nActiveOTF; CPtrArray m_ArrayOTFPolygon; RxSpectrum m_SpectrumTable;// Operationspublic: // Draw functions void RedrawWnd(); void DrawFillRect (CDC *pDC, CRect rect, COLORREF color); void DrawScroll (CDC *pDC, CRect rect); void DrawBackground (CDC *pDC, CRect rect); void DrawHistogram (CDC *pDC, CRect rect); void DrawHistogramGrid (CDC *pDC, CRect rect); void DrawWindowing (CDC *pDC, CRect rect); void DrawOTF (CDC *pDC); void DrawSpectrum (CDC *pDC, CRect rect); // Convert the coordinate functions // histogram width俊 措茄 谅钎函券 int PoToPiH (int nPos, int nPosRangeMin, int nPosRangeMax, BOOL bFitTail = TRUE); int PiToPoH (int nPixel, int nPosRangeMin, int nPosRangeMax, BOOL bFitTail = TRUE); // Opacity Height俊 措茄 谅钎函券 int PoToPiO (float fPos); float PiToPoO (int nPixel); // Hit Test int HitTest (CPoint point, int *pOTFIndex = NULL); // SCROLL management functions void SetScroll (_SCROLL *pScroll, BOOL bRedraw = TRUE); void SetScroll (int nMin, int nMax, BOOL bRedraw = TRUE); void RecalcScroll (); // HISTOGRAM management functions void SetHistogram (UINT *pHistogram, int nSize, int nMaxMagnitude); void RemoveHistogram (); // WINDOWING management functions void SetWindowing (int nLevel, int nWidth); void SetWindowingLevel (int nLevel); void SetWindowingWidth (int nWidth); _WINDOWING* GetWindowing (); void UpdateWindowingTable(); void SetWindowingVisible (BOOL bShow); BOOL GetWindowingVisible (); // OTF management functions void AddOTFPolygon (int *nPoint, COLORREF *crPoint, float fOpacity, BOOL bEnable); int GetOTFCount (); _OTF_POLYGON* GetOTFPolygon (int nIndex = -1); void RemoveOTFPolygon (int nIndex = -1); void RemoveAllOTFPolygon (); void EnableOTFPolygon (BOOL bEnable, int nIndex = -1); BOOL IsEnableOTFPolygon (int nIndex = -1); void SetOTFPointX (WORD wArg, int nPt1, int nPt2, int nPt3, int nPt4, int nIndex = -1); void SetOTFOpacity (float fOpacity, int nIndex = -1); void RecalcOTFPolygon (BOOL bWithHeight = TRUE); // SPECTRUM management functions void* GetSpectrumMPR (); void* GetSpectrum (); void UpdateSpectrum (); // fill the NOTIFY message and send message to Owner void SendMessageToOwner (WORD wMessage);// Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(RxHistogram) protected: virtual void PostNcDestroy(); //}}AFX_VIRTUAL// Implementationpublic: virtual ~RxHistogram(); // Generated message map functionsprotected: //{{AFX_MSG(RxHistogram) afx_msg void OnPaint(); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnDestroy(); afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); afx_msg void OnRButtonUp(UINT nFlags, CPoint point); //}}AFX_MSG DECLARE_MESSAGE_MAP()};///////////////////////////////////////////////////////////////////////////////{{AFX_INSERT_LOCATION}}// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_HISTOGRAM_H__01FCC481_4C4A_40B2_95AB_509564E99655__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -