BINARYTOREGIONINTERFACE Class Reference

Class for converting a binary raster to a region. More...

#include <mi32/bintoreg.h>

Inheritance diagram for BINARYTOREGIONINTERFACE:

Inheritance graph
[legend]
List of all members.

Public Member Functions

ERRVALUE AddSpan (INT32 x1, INT32 x2, INT32 y)
ERRVALUE AddSpanFast (INT32 x1, INT32 x2, INT32 y)
ERRVALUE AddSpansFromBytes (INT32 lin, INT32 col, INT32 len, const UINT8 *buf, bool bFast=false)
void Clear ()
bool IsPointOnSpan (INT32 x, INT32 y) const
ERRVALUE ProcessSpans ()

Protected Member Functions

 BINARYTOREGIONINTERFACE ()
virtual ~BINARYTOREGIONINTERFACE ()

Private Types

typedef SIMPLE_ARRAY< SPANSPANDATA

Private Member Functions

virtual void v_Clear ()
virtual ERRVALUE v_ProcessLine (LPOINT2D *points, int numpts)
virtual ERRVALUE v_Subtract (const POLYLINE &polyline)
virtual bool v_TestPoint (const DPOINT2D &point) const
virtual ERRVALUE v_Union (const POLYLINE &polyline)

Static Private Member Functions

int FillSpan (INT32 x1, INT32 x2, INT32 y, void *cbdata)
int TraceTest (INT32 x, INT32 y, void *cbdata)

Private Attributes

SIMPLE_ARRAY< SPANDATA * > m_Spans

Detailed Description

Class for converting a binary raster to a region.

This is a generic base class which can be extended to create any sort of region: REGION2D, X region or Windows Region.

Definition at line 40 of file bintoreg.h.


Member Typedef Documentation

typedef SIMPLE_ARRAY<SPAN> BINARYTOREGIONINTERFACE::SPANDATA [private]
 

Definition at line 113 of file bintoreg.h.


Constructor & Destructor Documentation

BINARYTOREGIONINTERFACE::BINARYTOREGIONINTERFACE  )  [protected]
 

virtual BINARYTOREGIONINTERFACE::~BINARYTOREGIONINTERFACE  )  [protected, virtual]
 


Member Function Documentation

ERRVALUE BINARYTOREGIONINTERFACE::AddSpan INT32  x1,
INT32  x2,
INT32  y
 

Add a span to the region.

This is used to transfer the binary object (whatever the source) into a format that this class can use. Note, this method makes sure that the spans are kept in order and combines spans which overlap. If you know you're adding spans in top-to-bottom, left-to-right order, call AddSpanFast() instead.

ERRVALUE BINARYTOREGIONINTERFACE::AddSpanFast INT32  x1,
INT32  x2,
INT32  y
 

Add a span to the region.

This is used to transfer the binary object (whatever the source) into a format that this class can use. Note, no attempt is made to keep the spans sorted or make sure the span does not overlap any existing spans. If you know you're adding spans in top-to-bottom, left-to-right order, you can use this method and it will be much faster than AddSpan()

ERRVALUE BINARYTOREGIONINTERFACE::AddSpansFromBytes INT32  lin,
INT32  col,
INT32  len,
const UINT8 buf,
bool  bFast = false
 

Add spans to the region from a buffer of UINT8s.

This function takes an array of UINT8s representing a raster line and adds spans for all of the non-zero runs. The buffer is treated as one byte per pixel with 0 being false and non-zero being true.

The bFast parameter tells the function whether or not you're procssing lines in a top-down order without back-tracking. If you are, pass true and it can add the spans without having to keep them sorted.

void BINARYTOREGIONINTERFACE::Clear  ) 
 

Clear any existing spans.

int BINARYTOREGIONINTERFACE::FillSpan INT32  x1,
INT32  x2,
INT32  y,
void *  cbdata
[static, private]
 

bool BINARYTOREGIONINTERFACE::IsPointOnSpan INT32  x,
INT32  y
const
 

Determine if specified point is on existing span.

ERRVALUE BINARYTOREGIONINTERFACE::ProcessSpans  ) 
 

Process the spans that have been set.

int BINARYTOREGIONINTERFACE::TraceTest INT32  x,
INT32  y,
void *  cbdata
[static, private]
 

virtual void BINARYTOREGIONINTERFACE::v_Clear  )  [inline, private, virtual]
 

Clear the current region.

Will be called by the Clear() method, which also gets called by the destructor.

Reimplemented in BINARYTOXREGION.

Definition at line 120 of file bintoreg.h.

virtual ERRVALUE BINARYTOREGIONINTERFACE::v_ProcessLine LPOINT2D points,
int  numpts
[private, virtual]
 

Add or remove a line from the region.

The default implementation of this method converts the points to a POLYLINE and calls v_CheckPoint followed by v_Union of v_Subtract. Override this ONLY if you can deal with integer (raster) coordinates more effeciently than POLYLINES. (For example, to create an X Region). Note that the points array passed in is not const for a reason. The method is allowed to modify the points in the buffer before adding them to the region. Just don't free the buffer.

Reimplemented in BINARYTOXREGION.

virtual ERRVALUE BINARYTOREGIONINTERFACE::v_Subtract const POLYLINE polyline  )  [private, virtual]
 

Subtract a polyline from the region.

The polyline is "validated"

Reimplemented in BINARYTOREGION2D.

virtual bool BINARYTOREGIONINTERFACE::v_TestPoint const DPOINT2D point  )  const [private, virtual]
 

Check to see if a point is inside the region.

Should return true if it is, false if not.

Reimplemented in BINARYTOREGION2D.

virtual ERRVALUE BINARYTOREGIONINTERFACE::v_Union const POLYLINE polyline  )  [private, virtual]
 

Add a polyline to the region.

The polyline is "validated"

Reimplemented in BINARYTOREGION2D.


Member Data Documentation

SIMPLE_ARRAY<SPANDATA*> BINARYTOREGIONINTERFACE::m_Spans [private]
 

Definition at line 115 of file bintoreg.h.


The documentation for this class was generated from the following file:
Generated on Tue Dec 14 13:19:38 2004 for TNTsdk by  doxygen 1.3.8-20040913