22 #include "allheaders.h" 28 #include "config_auto.h" 31 #define BLOCK_LABEL_HEIGHT 150 //char height of block id 44 ICOORDELT_IT left_it = &leftside;
45 ICOORDELT_IT right_it = &rightside;
48 left_it.set_to_list (&leftside);
49 right_it.set_to_list (&rightside);
51 left_it.add_to_end (
new ICOORDELT (xmin, ymin));
52 left_it.add_to_end (
new ICOORDELT (xmin, ymax));
53 right_it.add_to_end (
new ICOORDELT (xmax, ymin));
54 right_it.add_to_end (
new ICOORDELT (xmax, ymax));
74 left_it.move_to_first ();
75 left_it.add_list_before (left);
77 right_it.move_to_first ();
78 right_it.add_list_before (right);
97 if (pt.
x () >= bleft.
x () && pt.
x () <= tright.
x ()
98 && pt.
y () >= bleft.
y () && pt.
y () <= tright.
y ())
116 for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ())
117 *(it.data ()) += vec;
121 for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ())
122 *(it.data ()) += vec;
131 rotated_box.
rotate(rerotation);
132 Pix* pix = pixCreate(rotated_box.
width(), rotated_box.
height(), 1);
136 ICOORDELT_LIST polygon;
139 image_block.
rotate(rerotation);
144 const std::unique_ptr< ICOORDELT_LIST> segments(lines->
get_line(y));
145 if (!segments->empty()) {
146 ICOORDELT_IT s_it(segments.get());
149 for (s_it.mark_cycle_pt(); !s_it.cycled_list(); s_it.forward()) {
150 int start = s_it.data()->x();
151 int xext = s_it.data()->y();
153 pixRasterop(pix, start - rotated_box.
left(),
155 xext, 1, PIX_SET, NULL, 0, 0);
162 pixRasterop(pix, 0, 0, rotated_box.
width(), rotated_box.
height(),
163 PIX_SET, NULL, 0, 0);
165 if (mask_box != NULL) *mask_box = rotated_box;
176 #ifndef GRAPHICS_DISABLED 194 startpt = *(it.data ());
198 #if defined(__UNIX__) || defined(MINGW) 199 sprintf(temp_buff,
"%" PRId32, serial);
201 ultoa (serial, temp_buff, 10);
203 window->
Text(startpt.
x (), startpt.
y (), temp_buff);
207 prevpt = *(it.data ());
210 window->
DrawTo(prevpt.
x (), it.data ()->y ());
211 window->
DrawTo(it.data ()->x (), it.data ()->y ());
213 while (!it.at_last ());
214 endpt = *(it.data ());
220 for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
222 window->
DrawTo(prevpt.
x (), it.data ()->y ());
223 window->
DrawTo(it.data ()->x (), it.data ()->y ());
224 prevpt = *(it.data ());
227 window->
DrawTo(endpt.
x(), endpt.
y());
281 left_it.set_to_list (&blkptr->
leftside);
282 right_it.set_to_list (&blkptr->
rightside);
295 left_it.move_to_first ();
296 right_it.move_to_first ();
297 left_it.mark_cycle_pt ();
298 right_it.mark_cycle_pt ();
299 ymin = left_it.data ()->y ();
300 ymax = left_it.data_relative (1)->y ();
301 if (right_it.data_relative (1)->y () < ymax)
303 ymax = right_it.data_relative (1)->y ();
314 if (!left_it.empty ()) {
315 if (left_it.data_relative (1)->y () == ymax)
317 if (right_it.data_relative (1)->y () == ymax)
320 if (left_it.at_last () || right_it.at_last ()) {
321 left_it.move_to_first ();
322 right_it.move_to_first ();
324 ymin = left_it.data ()->y ();
330 ymax = left_it.data_relative (1)->y ();
331 if (right_it.data_relative (1)->y () < ymax)
333 ymax = right_it.data_relative (1)->y ();
353 if (y < bleft.
y () || y >= tright.
y ()) {
359 rect_it.bounding_box (bleft, tright);
361 if (y >= bleft.
y () && y < tright.
y ()) {
363 xext = tright.
x () - bleft.
x ();
366 for (rect_it.start_block (); !rect_it.cycled_rects (); rect_it.forward ()) {
368 rect_it.bounding_box (bleft, tright);
370 if (y >= bleft.
y () && y < tright.
y ()) {
372 xext = tright.
x () - bleft.
x ();
PDBLK & operator=(const PDBLK &source)
ICOORDELT_LIST * points()
void move(const ICOORD vec)
reposition block
void bounding_box(ICOORD &bottom_left, ICOORD &top_right) const
get box
void rotate(FCOORD rotation)
void plot(ScrollView *window, inT32 num)
inT16 x() const
access function
void set_sides(ICOORDELT_LIST *left, ICOORDELT_LIST *right)
const ERRCODE BADBLOCKLINE
Pix * render_mask(const FCOORD &rerotation, TBOX *mask_box)
void bounding_box(ICOORD &bleft, ICOORD &tright)
void SetCursor(int x, int y)
void set_to_block(PDBLK *blkptr)
start (new) block
ICOORDELT_LIST * get_line(inT16 y)
BLOCK_RECT_IT(PDBLK *blkptr)
inT16 y() const
access_function
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
const ERRCODE LOSTBLOCKLINE
BOOL8 cycled_rects()
test end
void plot(ScrollView *window, inT32 serial, ScrollView::Color colour)
void Text(int x, int y, const char *mystring)
PolyBlockType isA() const
static ICOORDELT * deep_copy(const ICOORDELT *src)
#define BLOCK_LABEL_HEIGHT
void forward()
next rectangle
void move(const ICOORD vec)
inT16 get_line(inT16 y, inT16 &xext)
void rotate(const FCOORD &vec)
#define CLISTIZE(CLASSNAME)
void start_block()
start iteration
BOOL8 contains(ICOORD pt)
is pt inside block
void DrawTo(int x, int y)
void TextAttributes(const char *font, int pixel_size, bool bold, bool italic, bool underlined)