23 #include "allheaders.h" 27 #include "config_auto.h" 30 #define BLOCK_LABEL_HEIGHT 150 //char height of block id 43 int16_t ymin, int16_t xmax,
44 int16_t ymax): box (
ICOORD (xmin, ymin),
ICOORD (xmax, ymax)) {
46 ICOORDELT_IT left_it = &leftside;
47 ICOORDELT_IT right_it = &rightside;
50 left_it.set_to_list (&leftside);
51 right_it.set_to_list (&rightside);
53 left_it.add_to_end (
new ICOORDELT (xmin, ymin));
54 left_it.add_to_end (
new ICOORDELT (xmin, ymax));
55 right_it.add_to_end (
new ICOORDELT (xmax, ymin));
56 right_it.add_to_end (
new ICOORDELT (xmax, ymax));
76 left_it.move_to_first();
77 left_it.add_list_before(left);
79 right_it.move_to_first();
80 right_it.add_list_before(right);
99 if (pt.
x() >= bleft.
x() && pt.
x() <= tright.
x()
100 && pt.
y() >= bleft.
y() && pt.
y() <= tright.
y())
118 for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ())
119 *(it.data ()) += vec;
123 for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ())
124 *(it.data ()) += vec;
133 rotated_box.
rotate(rerotation);
134 Pix* pix = pixCreate(rotated_box.
width(), rotated_box.
height(), 1);
138 ICOORDELT_LIST polygon;
141 image_block.
rotate(rerotation);
146 const std::unique_ptr< ICOORDELT_LIST> segments(
148 if (!segments->empty()) {
149 ICOORDELT_IT s_it(segments.get());
152 for (s_it.mark_cycle_pt(); !s_it.cycled_list(); s_it.forward()) {
153 int start = s_it.data()->x();
154 int xext = s_it.data()->y();
156 pixRasterop(pix, start - rotated_box.
left(),
158 xext, 1, PIX_SET,
nullptr, 0, 0);
165 pixRasterop(pix, 0, 0, rotated_box.
width(), rotated_box.
height(),
166 PIX_SET,
nullptr, 0, 0);
168 if (mask_box !=
nullptr) *mask_box = rotated_box;
179 #ifndef GRAPHICS_DISABLED 197 startpt = *(it.data ());
201 #if !defined(_WIN32) || defined(__MINGW32__) 202 snprintf(temp_buff,
sizeof(temp_buff),
"%" PRId32, serial);
204 ultoa (serial, temp_buff, 10);
206 window->
Text(startpt.
x (), startpt.
y (), temp_buff);
210 prevpt = *(it.data ());
213 window->
DrawTo(prevpt.
x (), it.data ()->y ());
214 window->
DrawTo(it.data ()->x (), it.data ()->y ());
216 while (!it.at_last ());
217 endpt = *(it.data ());
223 for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
225 window->
DrawTo(prevpt.
x (), it.data ()->y ());
226 window->
DrawTo(it.data ()->x (), it.data ()->y ());
227 prevpt = *(it.data ());
230 window->
DrawTo(endpt.
x(), endpt.
y());
265 ):left_it (&blkptr->leftside), right_it (&blkptr->rightside) {
284 left_it.set_to_list (&blkptr->
leftside);
285 right_it.set_to_list (&blkptr->
rightside);
298 left_it.move_to_first ();
299 right_it.move_to_first ();
300 left_it.mark_cycle_pt ();
301 right_it.mark_cycle_pt ();
302 ymin = left_it.data ()->y ();
303 ymax = left_it.data_relative (1)->y ();
304 if (right_it.data_relative (1)->y () < ymax)
306 ymax = right_it.data_relative (1)->y ();
317 if (!left_it.empty ()) {
318 if (left_it.data_relative (1)->y () == ymax)
320 if (right_it.data_relative (1)->y () == ymax)
323 if (left_it.at_last () || right_it.at_last ()) {
324 left_it.move_to_first ();
325 right_it.move_to_first ();
327 ymin = left_it.data ()->y ();
333 ymax = left_it.data_relative (1)->y ();
334 if (right_it.data_relative (1)->y () < ymax)
336 ymax = right_it.data_relative (1)->y ();
356 if (y < bleft.
y () || y >= tright.
y ()) {
364 if (y >= bleft.
y () && y < tright.
y ()) {
366 xext = tright.
x () - bleft.
x ();
373 if (y >= bleft.
y () && y < tright.
y ()) {
375 xext = tright.
x () - bleft.
x ();
PDBLK & operator=(const PDBLK &source)
void DrawTo(int x, int y)
void TextAttributes(const char *font, int pixel_size, bool bold, bool italic, bool underlined)
void rotate(const FCOORD &vec)
int16_t y() const
access_function
void forward()
next rectangle
void rotate(FCOORD rotation)
const ERRCODE LOSTBLOCKLINE
bool cycled_rects()
test end
void set_sides(ICOORDELT_LIST *left, ICOORDELT_LIST *right)
void SetCursor(int x, int y)
void move(const ICOORD vec)
void plot(ScrollView *window, int32_t serial, ScrollView::Color colour)
int16_t get_line(int16_t y, int16_t &xext)
static ICOORDELT * deep_copy(const ICOORDELT *src)
PolyBlockType isA() const
int16_t x() const
access function
ICOORDELT_LIST * get_line(int16_t y)
void Text(int x, int y, const char *mystring)
BLOCK_RECT_IT(PDBLK *blkptr)
Pix * render_mask(const FCOORD &rerotation, TBOX *mask_box)
void bounding_box(ICOORD &bleft, ICOORD &tright)
const ERRCODE BADBLOCKLINE
void set_to_block(PDBLK *blkptr)
start (new) block
void bounding_box(ICOORD &bottom_left, ICOORD &top_right) const
get box
#define BLOCK_LABEL_HEIGHT
bool contains(ICOORD pt)
is pt inside block
ICOORDELT_LIST * points()
CLISTIZE(BLOCK_RES) ELISTIZE(ROW_RES) ELISTIZE(WERD_RES) static const double kStopperAmbiguityThresholdGain
void start_block()
start iteration
void move(const ICOORD vec)
reposition block
void plot(ScrollView *window, int32_t num)
void error(const char *caller, TessErrorLogCode action, const char *format,...) const