Class for converting a binary raster to a region. More...
#include <mi32/bintoreg.h>

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 Member Functions | |
| virtual void | v_Clear () |
| virtual ERRVALUE | v_ProcessLine (LPOINT2D *points, int numpts)=0 |
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.
| BINARYTOREGIONINTERFACE::BINARYTOREGIONINTERFACE | ( | ) | [protected] |
| virtual BINARYTOREGIONINTERFACE::~BINARYTOREGIONINTERFACE | ( | ) | [protected, virtual] |
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.
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.
Determine if specified point is on existing span.
| ERRVALUE BINARYTOREGIONINTERFACE::ProcessSpans | ( | ) |
Process the spans that have been set.
| virtual void BINARYTOREGIONINTERFACE::v_Clear | ( | ) | [private, virtual] |
Clear the current region.
Will be called by the Clear() method, which also gets called by the destructor.
| virtual ERRVALUE BINARYTOREGIONINTERFACE::v_ProcessLine | ( | LPOINT2D * | points, | |
| int | numpts | |||
| ) | [private, pure virtual] |
Add or remove a line from the 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.
1.6.1