GClasses

GClasses::GRegionBorderIterator Class Reference

Iterates the border of a 2D region by running around the border and reporting the coordinates of each interior border pixel and the direction to the edge. It goes in a counter-clockwise direction. More...

#include <GRegion.h>

List of all members.

Public Member Functions

 GRegionBorderIterator (GImage *pImage, int nSampleX, int nSampleY)
 The point (nSampleX, nSampleY) should be somewhere in the region The image pImage should be a region mask, such that all points in the same region have exactly the same pixel value.
 ~GRegionBorderIterator ()
bool next (int *pX, int *pY, int *pDirection)
 If it returns false, the current values are invalid and it's done. If it returns true, pX and pY will hold the coordinates of an interior border pixel. pDirection will be the direction to the edge. 0=right, 1=up, 2=left, 3=down.

Protected Member Functions

bool look ()
void leap ()

Protected Attributes

GImagem_pImage
unsigned int m_nRegion
int m_x
int m_y
int m_endX
int m_endY
int m_direction
bool m_bOddPass

Detailed Description

Iterates the border of a 2D region by running around the border and reporting the coordinates of each interior border pixel and the direction to the edge. It goes in a counter-clockwise direction.


Constructor & Destructor Documentation

GClasses::GRegionBorderIterator::GRegionBorderIterator ( GImage pImage,
int  nSampleX,
int  nSampleY 
)

The point (nSampleX, nSampleY) should be somewhere in the region The image pImage should be a region mask, such that all points in the same region have exactly the same pixel value.

GClasses::GRegionBorderIterator::~GRegionBorderIterator ( )

Member Function Documentation

void GClasses::GRegionBorderIterator::leap ( ) [protected]
bool GClasses::GRegionBorderIterator::look ( ) [protected]
bool GClasses::GRegionBorderIterator::next ( int *  pX,
int *  pY,
int *  pDirection 
)

If it returns false, the current values are invalid and it's done. If it returns true, pX and pY will hold the coordinates of an interior border pixel. pDirection will be the direction to the edge. 0=right, 1=up, 2=left, 3=down.


Member Data Documentation