tesseract  5.0.0-alpha-619-ge9db
BLOCK_LINE_IT Class Reference

rectangle iterator More...

#include <pdblock.h>

Public Member Functions

 BLOCK_LINE_IT (PDBLK *blkptr)
 
void set_to_block (PDBLK *blkptr)
 
int16_t get_line (int16_t y, int16_t &xext)
 

Detailed Description

rectangle iterator

Definition at line 143 of file pdblock.h.

Constructor & Destructor Documentation

◆ BLOCK_LINE_IT()

BLOCK_LINE_IT::BLOCK_LINE_IT ( PDBLK blkptr)
inline

constructor

Parameters
blkptrfrom block

Definition at line 148 of file pdblock.h.

150  :rect_it (blkptr) {
151  block = blkptr; //remember block

Member Function Documentation

◆ get_line()

int16_t BLOCK_LINE_IT::get_line ( int16_t  y,
int16_t &  xext 
)

get a line

Parameters
yline to get
xextoutput extent

Definition at line 335 of file pdblock.cpp.

350  {
351  ICOORD bleft; //bounding box
352  ICOORD tright; //of block & rect
353 
354  //get block box
355  block->bounding_box (bleft, tright);
356  if (y < bleft.y () || y >= tright.y ()) {
357  // block->print(stderr,false);
358  BADBLOCKLINE.error ("BLOCK_LINE_IT::get_line", ABORT, "Y=%d", y);
359  }
360 
361  //get rectangle box
362  rect_it.bounding_box (bleft, tright);
363  //inside rectangle
364  if (y >= bleft.y () && y < tright.y ()) {
365  //width of line
366  xext = tright.x () - bleft.x ();
367  return bleft.x (); //start of line
368  }
369  for (rect_it.start_block (); !rect_it.cycled_rects (); rect_it.forward ()) {

◆ set_to_block()

void BLOCK_LINE_IT::set_to_block ( PDBLK blkptr)
inline

start (new) block

Parameters
blkptrblock to start

Definition at line 155 of file pdblock.h.

156  {
157  block = blkptr; //remember block
158  //set iterator
159  rect_it.set_to_block (blkptr);

The documentation for this class was generated from the following files:
BLOCK_RECT_IT::bounding_box
void bounding_box(ICOORD &bleft, ICOORD &tright)
Definition: pdblock.h:126
PDBLK::bounding_box
void bounding_box(ICOORD &bottom_left, ICOORD &top_right) const
get box
Definition: pdblock.h:58
ICOORD
integer coordinate
Definition: points.h:30
BLOCK_RECT_IT::cycled_rects
bool cycled_rects()
test end
Definition: pdblock.h:119
BADBLOCKLINE
constexpr ERRCODE BADBLOCKLINE("Y coordinate in block out of bounds")
ICOORD::x
int16_t x() const
access function
Definition: points.h:51
ERRCODE::error
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:33
BLOCK_RECT_IT::forward
void forward()
next rectangle
Definition: pdblock.cpp:305
ABORT
Definition: errcode.h:43
BLOCK_RECT_IT::set_to_block
void set_to_block(PDBLK *blkptr)
start (new) block
Definition: pdblock.cpp:271
BLOCK_RECT_IT::start_block
void start_block()
start iteration
Definition: pdblock.cpp:287
ICOORD::y
int16_t y() const
access_function
Definition: points.h:55