mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-06-08 02:12:40 +08:00
partial doxygen ccstruct/coutln.cpp
This commit is contained in:
parent
0b5b35cb34
commit
b81c766e28
@ -42,14 +42,15 @@ ICOORD C_OUTLINE::step_coords[4] = {
|
|||||||
* @name C_OUTLINE::C_OUTLINE
|
* @name C_OUTLINE::C_OUTLINE
|
||||||
*
|
*
|
||||||
* Constructor to build a C_OUTLINE from a CRACKEDGE LOOP.
|
* Constructor to build a C_OUTLINE from a CRACKEDGE LOOP.
|
||||||
|
* @param startpt outline to convert
|
||||||
|
* @param bot_left bounding box
|
||||||
|
* @param top_right bounding box
|
||||||
|
* @param length length of loop
|
||||||
*/
|
*/
|
||||||
|
|
||||||
C_OUTLINE::C_OUTLINE (
|
C_OUTLINE::C_OUTLINE (CRACKEDGE * startpt, ICOORD bot_left,
|
||||||
//constructor
|
ICOORD top_right, inT16 length)
|
||||||
CRACKEDGE * startpt, //outline to convert
|
: box (bot_left, top_right), start (startpt->pos), offsets(NULL) {
|
||||||
ICOORD bot_left, //bounding box
|
|
||||||
ICOORD top_right, inT16 length //length of loop
|
|
||||||
):box (bot_left, top_right), start (startpt->pos), offsets(NULL) {
|
|
||||||
inT16 stepindex; //index to step
|
inT16 stepindex; //index to step
|
||||||
CRACKEDGE *edgept; //current point
|
CRACKEDGE *edgept; //current point
|
||||||
|
|
||||||
@ -134,12 +135,11 @@ inT16 length //length of loop
|
|||||||
* @name C_OUTLINE::C_OUTLINE
|
* @name C_OUTLINE::C_OUTLINE
|
||||||
*
|
*
|
||||||
* Constructor to build a C_OUTLINE from a rotation of a C_OUTLINE.
|
* Constructor to build a C_OUTLINE from a rotation of a C_OUTLINE.
|
||||||
|
* @param srcline outline to rotate
|
||||||
|
* @param rotation rotate to coord
|
||||||
*/
|
*/
|
||||||
|
|
||||||
C_OUTLINE::C_OUTLINE( //constructor
|
C_OUTLINE::C_OUTLINE(C_OUTLINE *srcline, FCOORD rotation) : offsets(NULL) {
|
||||||
C_OUTLINE *srcline, //outline to
|
|
||||||
FCOORD rotation //rotate
|
|
||||||
) : offsets(NULL) {
|
|
||||||
TBOX new_box; //easy bounding
|
TBOX new_box; //easy bounding
|
||||||
inT16 stepindex; //index to step
|
inT16 stepindex; //index to step
|
||||||
inT16 dirdiff; //direction change
|
inT16 dirdiff; //direction change
|
||||||
@ -337,11 +337,10 @@ inT32 C_OUTLINE::outer_area() const {
|
|||||||
* @name C_OUTLINE::count_transitions
|
* @name C_OUTLINE::count_transitions
|
||||||
*
|
*
|
||||||
* Compute the number of x and y maxes and mins in the outline.
|
* Compute the number of x and y maxes and mins in the outline.
|
||||||
|
* @param threshold winding number on size
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inT32 C_OUTLINE::count_transitions( //winding number
|
inT32 C_OUTLINE::count_transitions(inT32 threshold) {
|
||||||
inT32 threshold //on size
|
|
||||||
) {
|
|
||||||
BOOL8 first_was_max_x; //what was first
|
BOOL8 first_was_max_x; //what was first
|
||||||
BOOL8 first_was_max_y;
|
BOOL8 first_was_max_y;
|
||||||
BOOL8 looking_for_max_x; //what is next
|
BOOL8 looking_for_max_x; //what is next
|
||||||
@ -536,11 +535,11 @@ inT16 C_OUTLINE::winding_number(ICOORD point) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**
|
||||||
* C_OUTLINE::turn_direction
|
* C_OUTLINE::turn_direction
|
||||||
*
|
*
|
||||||
* Return the sum direction delta of the outline.
|
* @return the sum direction delta of the outline.
|
||||||
**********************************************************************/
|
*/
|
||||||
|
|
||||||
inT16 C_OUTLINE::turn_direction() const { //winding number
|
inT16 C_OUTLINE::turn_direction() const { //winding number
|
||||||
DIR128 prevdir; //previous direction
|
DIR128 prevdir; //previous direction
|
||||||
@ -565,11 +564,11 @@ inT16 C_OUTLINE::turn_direction() const { //winding number
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**
|
||||||
* C_OUTLINE::reverse
|
* @name C_OUTLINE::reverse
|
||||||
*
|
*
|
||||||
* Reverse the direction of an outline.
|
* Reverse the direction of an outline.
|
||||||
**********************************************************************/
|
*/
|
||||||
|
|
||||||
void C_OUTLINE::reverse() { //reverse drection
|
void C_OUTLINE::reverse() { //reverse drection
|
||||||
DIR128 halfturn = MODULUS / 2; //amount to shift
|
DIR128 halfturn = MODULUS / 2; //amount to shift
|
||||||
@ -625,11 +624,15 @@ bool C_OUTLINE::IsLegallyNested() const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this outline is smaller than the given min_size, delete this and
|
/**
|
||||||
// remove from its list, via *it, after checking that *it points to this.
|
* If this outline is smaller than the given min_size, delete this and
|
||||||
// Otherwise, if any children of this are too small, delete them.
|
* remove from its list, via *it, after checking that *it points to this.
|
||||||
// On entry, *it must be an iterator pointing to this. If this gets deleted
|
* Otherwise, if any children of this are too small, delete them.
|
||||||
// then this is extracted from *it, so an iteration can continue.
|
* On entry, *it must be an iterator pointing to this. If this gets deleted
|
||||||
|
* then this is extracted from *it, so an iteration can continue.
|
||||||
|
* @param min_size minimum size for outline
|
||||||
|
* @parm it outline iterator
|
||||||
|
*/
|
||||||
void C_OUTLINE::RemoveSmallRecursive(int min_size, C_OUTLINE_IT* it) {
|
void C_OUTLINE::RemoveSmallRecursive(int min_size, C_OUTLINE_IT* it) {
|
||||||
if (box.width() < min_size || box.height() < min_size) {
|
if (box.width() < min_size || box.height() < min_size) {
|
||||||
ASSERT_HOST(this == it->data());
|
ASSERT_HOST(this == it->data());
|
||||||
@ -901,8 +904,13 @@ void C_OUTLINE::render(int left, int top, Pix* pix) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Renders just the outline to the given pix (no fill), with left and top
|
/**
|
||||||
// being the coords of the upper-left corner of the pix.
|
* Renders just the outline to the given pix (no fill), with left and top
|
||||||
|
* being the coords of the upper-left corner of the pix.
|
||||||
|
* @param left coord
|
||||||
|
* @param top coord
|
||||||
|
* @param pix the pix to outline
|
||||||
|
*/
|
||||||
void C_OUTLINE::render_outline(int left, int top, Pix* pix) const {
|
void C_OUTLINE::render_outline(int left, int top, Pix* pix) const {
|
||||||
ICOORD pos = start;
|
ICOORD pos = start;
|
||||||
for (int stepindex = 0; stepindex < stepcount; ++stepindex) {
|
for (int stepindex = 0; stepindex < stepcount; ++stepindex) {
|
||||||
@ -920,17 +928,17 @@ void C_OUTLINE::render_outline(int left, int top, Pix* pix) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**
|
||||||
* C_OUTLINE::plot
|
* @name C_OUTLINE::plot
|
||||||
*
|
*
|
||||||
* Draw the outline in the given colour.
|
* Draw the outline in the given colour.
|
||||||
**********************************************************************/
|
* @param window window to draw in
|
||||||
|
* @param colour colour to draw in
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef GRAPHICS_DISABLED
|
#ifndef GRAPHICS_DISABLED
|
||||||
void C_OUTLINE::plot( //draw it
|
void C_OUTLINE::plot(ScrollView* window,
|
||||||
ScrollView* window, // window to draw in
|
ScrollView::Color colour) const {
|
||||||
ScrollView::Color colour // colour to draw in
|
|
||||||
) const {
|
|
||||||
inT16 stepindex; // index to cstep
|
inT16 stepindex; // index to cstep
|
||||||
ICOORD pos; // current position
|
ICOORD pos; // current position
|
||||||
DIR128 stepdir; // direction of step
|
DIR128 stepdir; // direction of step
|
||||||
@ -989,16 +997,14 @@ void C_OUTLINE::plot_normed(const DENORM& denorm, ScrollView::Color colour,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**
|
||||||
* C_OUTLINE::operator=
|
* @name C_OUTLINE::operator=
|
||||||
*
|
*
|
||||||
* Assignment - deep copy data
|
* Assignment - deep copy data
|
||||||
**********************************************************************/
|
* @param source assign from this
|
||||||
|
*/
|
||||||
|
|
||||||
//assignment
|
C_OUTLINE & C_OUTLINE::operator= (const C_OUTLINE & source) {
|
||||||
C_OUTLINE & C_OUTLINE::operator= (
|
|
||||||
const C_OUTLINE & source //from this
|
|
||||||
) {
|
|
||||||
box = source.box;
|
box = source.box;
|
||||||
start = source.start;
|
start = source.start;
|
||||||
if (steps != NULL)
|
if (steps != NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user