22 #include "allheaders.h"
34 #define BLOCK_LABEL_HEIGHT 150 //char height of block id
47 ICOORDELT_IT left_it = &leftside;
48 ICOORDELT_IT right_it = &rightside;
51 left_it.set_to_list (&leftside);
52 right_it.set_to_list (&rightside);
54 left_it.add_to_end (
new ICOORDELT (xmin, ymin));
55 left_it.add_to_end (
new ICOORDELT (xmin, ymax));
56 right_it.add_to_end (
new ICOORDELT (xmax, ymin));
57 right_it.add_to_end (
new ICOORDELT (xmax, ymax));
77 left_it.move_to_first ();
78 left_it.add_list_before (left);
80 right_it.move_to_first ();
81 right_it.add_list_before (right);
101 if (pt.
x () >= bleft.
x () && pt.
x () <= tright.
x ()
102 && pt.
y () >= bleft.
y () && pt.
y () <= tright.
y ())
120 for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ())
121 *(it.data ()) += vec;
125 for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ())
126 *(it.data ()) += vec;
135 rotated_box.
rotate(rerotation);
136 Pix* pix = pixCreate(rotated_box.
width(), rotated_box.
height(), 1);
140 ICOORDELT_LIST polygon;
143 image_block.
rotate(rerotation);
148 ICOORDELT_LIST* segments = lines->
get_line(y);
149 if (!segments->empty()) {
150 ICOORDELT_IT s_it(segments);
153 for (s_it.mark_cycle_pt(); !s_it.cycled_list(); s_it.forward()) {
154 int start = s_it.data()->x();
155 int xext = s_it.data()->y();
157 pixRasterop(pix, start - rotated_box.
left(),
159 xext, 1, PIX_SET,
NULL, 0, 0);
167 pixRasterop(pix, 0, 0, rotated_box.
width(), rotated_box.
height(),
168 PIX_SET,
NULL, 0, 0);
180 #ifndef GRAPHICS_DISABLED
198 startpt = *(it.data ());
205 ultoa (serial, temp_buff, 10);
207 window->
Text(startpt.
x (), startpt.
y (), temp_buff);
211 prevpt = *(it.data ());
214 window->
DrawTo(prevpt.
x (), it.data ()->y ());
215 window->
DrawTo(it.data ()->x (), it.data ()->y ());
217 while (!it.at_last ());
218 endpt = *(it.data ());
224 for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
226 window->
DrawTo(prevpt.
x (), it.data ()->y ());
227 window->
DrawTo(it.data ()->x (), it.data ()->y ());
228 prevpt = *(it.data ());
231 window->
DrawTo(endpt.
x(), endpt.
y());
243 #ifndef GRAPHICS_DISABLED
257 sv_show_sub_image (image, bleft.
x (), bleft.
y (), tright.
x () - bleft.
x (), tright.
y () - bleft.
y (), window, bleft.
x (), bleft.
y ());
293 ):left_it (&blkptr->leftside), right_it (&blkptr->rightside) {
312 left_it.set_to_list (&blkptr->
leftside);
313 right_it.set_to_list (&blkptr->
rightside);
326 left_it.move_to_first ();
327 right_it.move_to_first ();
328 left_it.mark_cycle_pt ();
329 right_it.mark_cycle_pt ();
330 ymin = left_it.data ()->y ();
331 ymax = left_it.data_relative (1)->y ();
332 if (right_it.data_relative (1)->y () < ymax)
334 ymax = right_it.data_relative (1)->y ();
345 if (!left_it.empty ()) {
346 if (left_it.data_relative (1)->y () == ymax)
348 if (right_it.data_relative (1)->y () == ymax)
351 if (left_it.at_last () || right_it.at_last ()) {
352 left_it.move_to_first ();
353 right_it.move_to_first ();
355 ymin = left_it.data ()->y ();
361 ymax = left_it.data_relative (1)->y ();
362 if (right_it.data_relative (1)->y () < ymax)
364 ymax = right_it.data_relative (1)->y ();
384 if (y < bleft.
y () || y >= tright.
y ()) {
392 if (y >= bleft.
y () && y < tright.
y ()) {
394 xext = tright.
x () - bleft.
x ();
401 if (y >= bleft.
y () && y < tright.
y ()) {
403 xext = tright.
x () - bleft.
x ();
BOOL8 contains(ICOORD pt)
is pt inside block
void move(const ICOORD vec)
reposition block
ICOORDELT_LIST * get_line(inT16 y)
inT16 x() const
access function
void show(IMAGE *image, ScrollView *window)
BLOCK_RECT_IT(PDBLK *blkptr)
void rotate(FCOORD rotation)
PolyBlockType isA() const
void sv_show_sub_image(IMAGE *source, inT32 xstart, inT32 ystart, inT32 xext, inT32 yext, ScrollView *window, inT32 xpos, inT32 ypos)
void start_block()
start iteration
inT16 y() const
access_function
void set_sides(ICOORDELT_LIST *left, ICOORDELT_LIST *right)
inT16 get_line(inT16 y, inT16 &xext)
PDBLK & operator=(const PDBLK &source)
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
void move(const ICOORD vec)
BOOL8 cycled_rects()
test end
void plot(ScrollView *window, inT32 serial, ScrollView::Color colour)
#define CLISTIZE(CLASSNAME)
#define BLOCK_LABEL_HEIGHT
const ERRCODE BADBLOCKLINE
static ICOORDELT * deep_copy(const ICOORDELT *src)
void rotate(const FCOORD &vec)
void bounding_box(ICOORD &bleft, ICOORD &tright)
Pix * render_mask(const FCOORD &rerotation)
const ERRCODE LOSTBLOCKLINE
void set_to_block(PDBLK *blkptr)
start (new) block
void bounding_box(ICOORD &bottom_left, ICOORD &top_right) const
get box
void plot(ScrollView *window, inT32 num)
ICOORDELT_LIST * points()
void forward()
next rectangle