📄 dib.h
字号:
#if !defined(AFX_DIB_H__33817561_072D_11D1_8C94_000021003EA5__INCLUDED_)
#define AFX_DIB_H__33817561_072D_11D1_8C94_000021003EA5__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// Dib.h : header file
//
#include "DIBAPI.H"
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
////////////////////////////////////////////////////////////////////////////
// CDib
class CDib : public CObject
{
DECLARE_SERIAL(CDib)
// Public member function
public:
// constructor
CDib();
// create
BOOL Create(DWORD dwWidth, DWORD dwHeight);
BOOL Create(DWORD dwWidth, DWORD dwHeight, WORD wBitCount);
BOOL Create(LPBYTE lpDIB);
BOOL Create(LPBYTE lpDIB, // DIB pointer
WORD wBitCount); // bits/pixel
BOOL Create(HBITMAP hBitmap); // DIBSection
BOOL Create(HBITMAP hBitmap, // DIBSection
WORD wBitCount); // bits/pixel
BOOL Create(HBITMAP hBitmap, // Bitmap handle
HPALETTE hPalette); // Palette handle
BOOL Create(HBITMAP hBitmap, // Bitmap handle
HPALETTE hPalette, // Palette handle
WORD wBitCount); // bits/pixel
BOOL Create(CRect rcScreen);
BOOL Create(HWND hWnd, WORD fPrintArea);
BOOL Create(HWND hWnd, CRect rcClientArea);
// load/save
BOOL Load(UINT uIDS, LPCTSTR lpszDibType);
BOOL Load(LPCTSTR lpszDibRes, LPCTSTR lpszDibType);
BOOL Load(LPCTSTR lpszDibFile);
BOOL Save(LPCTSTR lpszDibFile);
BOOL Read(CFile *pFile);
BOOL Write(CFile *pFile);
// clone
CDib * Clone();
BOOL Robetedgefix();
int egefenge();
BOOL Cannyedge();
// deconstructor
virtual ~CDib();
// destroy
void Destroy();
HDIB Detach();
// overlaying Serialize
virtual void Serialize(CArchive &ar);
// display
BOOL Display(CDC * pDC, int xDest, int yDest, int nWidthDest, int nHeightDest,
int xSrc, int ySrc, DWORD dwRop=SRCCOPY);
BOOL Display(CDC * pDC, int xDest, int yDest, int nWidthDest, int nHeightDest,
int xSrc, int ySrc, int nWidthSrc, int nHeightSrc, DWORD dwRop=SRCCOPY);
BOOL Display(CDC* pDC, int x, int y, DWORD dwRop=SRCCOPY);
BOOL Display(CDC* pDC, CRect rcDest, CRect rcSrc,DWORD dwRop=SRCCOPY);
BOOL DisplayPalette(CDC* pDC, CRect rc);
// DC for modify DIB
CDC* BeginPaint(CDC *pDC);
void EndPaint();
// color process
BOOL IsRequireDither(CDC* pDC);
BOOL DitherDisplay(CDC* pDC, CRect rcDest, CRect rcSrc, DWORD dwRop=SRCCOPY);
BOOL ColorQuantize(int nColorBits);
BOOL ChangeToGrayscale(int nMethod = MEAN_GRAY,
double fRedWeight = 0.30,
double fGreenWeight = 0.59,
double fBlueWeight = 0.11);
BOOL AdjustColor(int nColorModel, int v1, int v2, int v3);
BOOL AdjustBrightness(int v);
BOOL AdjustContrast(int v);
BOOL SeparateRGB(int nIndex);
BOOL FilteRGB(int nIndex);
BOOL ChangeToGray(int nMethod = MEAN_GRAY,
double fRedWeight = 0.30,
double fGreenWeight = 0.59,
double fBlueWeight = 0.11);
//transform
BOOL ChangeImageSize(int nWidth, int nHeight);
BOOL ZoomDib(float r);
BOOL abssub(CDib* m_dib);
BOOL Threshold();
BOOL YUZHI(BYTE i);
BOOL fushi(int nMode , int structure[3][3]);
BOOL penzhang(int nMode , int structure[3][3]);
int Trace(int th,tr* trsu);
BOOL colrsubgray(CDib* ci);
BOOL MedianFilterDib( int iFilterH, int iFilterW,
int iFilterMX, int iFilterMY);
BOOL MedianFilterD();
BOOL ShadowDelSub(CDib* m_dib);
BOOL MyFushi();
int BoatNumDetect(CDib* m_dib,CDib* bjdib,int minsize,CString& str);
BOOL bjdetect(CDib* m_dib,CString &message);
BOOL AlarmDetect(CDib* m_dib,UINT level);
BOOL CDib:: RegionSegAdaptive();
// DDB and palette
BOOL BuildBitmap();
BOOL BuildPalette();
BOOL ConvertFormat(WORD wBitCount);
// attributes
BOOL IsEmpty();
DWORD GetCompression();
WORD GetBitCount();
LONG GetWidth();
LONG GetHeight();
LONG GetWidthBytes();
WORD GetColorNumber();
WORD GetPaletteSize();
CBitmap* GetBitmap();
CPalette* GetPalette();
HANDLE GetHandle();
LPBYTE GetBitsPtr();
COLORREF GetPixel(LONG x, LONG y);
LONG GetPixelOffset(LONG x, LONG y);
BOOL rectange(int k,tr* trsu);
int fix(int k,tr* trsu);
BOOL Robetedge();
// private member function
private:
BOOL UpdateInternal();
// public member data
public:
BOOL Attach(HDIB hDib);
HDIB ChangeSize(int x);
HDIB m_hDib;
HBITMAP m_hBitmap; // handle of DIBSection
CPalette* m_pPalette;
CBitmap* m_pBitmap;
// private member data
private:
// for drawing in DIB
CDC * m_pMemDC;
CBitmap* m_pBitmapTmp;
CPalette* m_pPaletteTmp;
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DIB_H__33817561_072D_11D1_8C94_000021003EA5__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -