21 #include "allheaders.h" 30 #define BLOCK_LABEL_HEIGHT 150 //char height of block id 43 ICOORDELT_IT left_it = &leftside;
44 ICOORDELT_IT right_it = &rightside;
47 left_it.set_to_list (&leftside);
48 right_it.set_to_list (&rightside);
50 left_it.add_to_end (
new ICOORDELT (xmin, ymin));
51 left_it.add_to_end (
new ICOORDELT (xmin, ymax));
52 right_it.add_to_end (
new ICOORDELT (xmax, ymin));
53 right_it.add_to_end (
new ICOORDELT (xmax, ymax));
73 left_it.move_to_first ();
74 left_it.add_list_before (left);
76 right_it.move_to_first ();
77 right_it.add_list_before (right);
96 if (pt.
x () >= bleft.
x () && pt.
x () <= tright.
x ()
97 && pt.
y () >= bleft.
y () && pt.
y () <= tright.
y ())
115 for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ())
116 *(it.data ()) += vec;
120 for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ())
121 *(it.data ()) += vec;
130 rotated_box.
rotate(rerotation);
131 Pix* pix = pixCreate(rotated_box.
width(), rotated_box.
height(), 1);
135 ICOORDELT_LIST polygon;
138 image_block.
rotate(rerotation);
143 ICOORDELT_LIST* segments = lines->
get_line(y);
144 if (!segments->empty()) {
145 ICOORDELT_IT s_it(segments);
148 for (s_it.mark_cycle_pt(); !s_it.cycled_list(); s_it.forward()) {
149 int start = s_it.data()->x();
150 int xext = s_it.data()->y();
152 pixRasterop(pix, start - rotated_box.
left(),
154 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) 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());
262 ):left_it (&blkptr->leftside), right_it (&blkptr->rightside) {
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 ()) {
361 if (y >= bleft.
y () && y < tright.
y ()) {
363 xext = tright.
x () - bleft.
x ();
370 if (y >= bleft.
y () && y < tright.
y ()) {
372 xext = tright.
x () - bleft.
x ();
const ERRCODE LOSTBLOCKLINE
void DrawTo(int x, int y)
void rotate(const FCOORD &vec)
static ICOORDELT * deep_copy(const ICOORDELT *src)
void rotate(FCOORD rotation)
void start_block()
start iteration
void SetCursor(int x, int y)
ICOORDELT_LIST * points()
#define BLOCK_LABEL_HEIGHT
BOOL8 contains(ICOORD pt)
is pt inside block
PDBLK & operator=(const PDBLK &source)
PolyBlockType isA() const
void TextAttributes(const char *font, int pixel_size, bool bold, bool italic, bool underlined)
inT16 get_line(inT16 y, inT16 &xext)
void bounding_box(ICOORD &bleft, ICOORD &tright)
void move(const ICOORD vec)
reposition block
void set_sides(ICOORDELT_LIST *left, ICOORDELT_LIST *right)
void Text(int x, int y, const char *mystring)
ICOORDELT_LIST * get_line(inT16 y)
void move(const ICOORD vec)
Pix * render_mask(const FCOORD &rerotation, TBOX *mask_box)
inT16 x() const
access function
void plot(ScrollView *window, inT32 serial, ScrollView::Color colour)
void forward()
next rectangle
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
BOOL8 cycled_rects()
test end
const ERRCODE BADBLOCKLINE
BLOCK_RECT_IT(PDBLK *blkptr)
#define CLISTIZE(CLASSNAME)
void plot(ScrollView *window, inT32 num)
void bounding_box(ICOORD &bottom_left, ICOORD &top_right) const
get box
void set_to_block(PDBLK *blkptr)
start (new) block
inT16 y() const
access_function