📄 monochromebitmap.h
字号:
// MonochromeBitmap.h: interface for the CMonochromeBitmap class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_MONOCHROMEBITMAP_H__49989ED5_536B_11D1_91FE_843B0AC10000__INCLUDED_)
#define AFX_MONOCHROMEBITMAP_H__49989ED5_536B_11D1_91FE_843B0AC10000__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include <list>
#include <vector>
#include "line.h"
#include "blob.h"
#include "QuadTree.h"
using namespace std;
// All lines within the same raster are within the same vector
// This means that they're contiguous in memory (which means they
// maintain cache coherency and that we can reference them with
// an iterator that operates efficiently).
typedef vector<CLine> CLineVector;
typedef CLineVector::iterator CLineVectorIterator;
typedef vector<CLineVectorIterator> CLineVectorIteratorVector;
typedef vector<CLineVector *> CLineVectorPointerVector;
typedef vector<CBlob *> CBlobPtrVector;
typedef vector<CLine *> CLinePointerVector;
typedef CLinePointerVector::iterator CLinePointerVectorIterator;
class CMonochromeBitmap
{
public:
void ClearBlobList();
void AddBlob(CBlob *pBlob);
virtual int Height() const = 0;
virtual int Width() const = 0;
virtual const BYTE * GetRaster(int nLine) = 0;
virtual void GetBrightnessHistogram(vector<int> &aHistogram,vector<int> &aBrightness);
CMonochromeBitmap();
virtual ~CMonochromeBitmap();
virtual void BuildBlobList();
CBlob *GetBlob(int nIndex);
const CBlob *GetBlob(int nIndex) const;
int GetBlobCount() const;
CQuadTree<CBlob> &GetQuadTree();
protected:
void AllocateLineBlock(CLineVectorIterator &clviStart,CLineVectorIterator &clviEnd);
void DeallocateMemoryForBitmap();
// This holds a list of all of the vectors that have
// been allocated.
CLineVectorPointerVector m_clvpvAllocatedVector;
enum {eMaxLinesPerVector = 2048,eBlobsPerBlock = 256};
CBlobPtrVector m_pBlob;
CQuadTree<CBlob> m_quadTree;
};
#endif // !defined(AFX_MONOCHROMEBITMAP_H__49989ED5_536B_11D1_91FE_843B0AC10000__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -