|
Tesseract
3.02
|
rectangle iterator More...
#include <pdblock.h>
Public Member Functions | |
| BLOCK_LINE_IT (PDBLK *blkptr) | |
| void | set_to_block (PDBLK *blkptr) |
| inT16 | get_line (inT16 y, inT16 &xext) |
| BLOCK_LINE_IT::BLOCK_LINE_IT | ( | PDBLK * | blkptr | ) | [inline] |
get a line
| y | line to get |
| xext | output extent |
Definition at line 375 of file pdblock.cpp.
{
ICOORD bleft; //bounding box
ICOORD tright; //of block & rect
//get block box
block->bounding_box (bleft, tright);
if (y < bleft.y () || y >= tright.y ()) {
// block->print(stderr,FALSE);
BADBLOCKLINE.error ("BLOCK_LINE_IT::get_line", ABORT, "Y=%d", y);
}
//get rectangle box
rect_it.bounding_box (bleft, tright);
//inside rectangle
if (y >= bleft.y () && y < tright.y ()) {
//width of line
xext = tright.x () - bleft.x ();
return bleft.x (); //start of line
}
for (rect_it.start_block (); !rect_it.cycled_rects (); rect_it.forward ()) {
//get rectangle box
rect_it.bounding_box (bleft, tright);
//inside rectangle
if (y >= bleft.y () && y < tright.y ()) {
//width of line
xext = tright.x () - bleft.x ();
return bleft.x (); //start of line
}
}
LOSTBLOCKLINE.error ("BLOCK_LINE_IT::get_line", ABORT, "Y=%d", y);
return 0; //dummy to stop warning
}
| void BLOCK_LINE_IT::set_to_block | ( | PDBLK * | blkptr | ) | [inline] |
start (new) block
| blkptr | block to start |
Definition at line 176 of file pdblock.h.
{
block = blkptr; //remember block
//set iterator
rect_it.set_to_block (blkptr);
}