21# include "config_auto.h"
26#include <allheaders.h>
34#define BLOCK_LABEL_HEIGHT 150
58 left_it.add_to_end(
new ICOORDELT(xmin, ymin));
59 left_it.add_to_end(
new ICOORDELT(xmin, ymax));
60 right_it.add_to_end(
new ICOORDELT(xmax, ymin));
61 right_it.add_to_end(
new ICOORDELT(xmax, ymax));
80 left_it.move_to_first();
81 left_it.add_list_before(left);
83 right_it.move_to_first();
84 right_it.add_list_before(right);
103 if (pt.
x() >= bleft.
x() && pt.
x() <= tright.
x() && pt.
y() >= bleft.
y() &&
104 pt.
y() <= tright.
y()) {
122 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
128 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
139 rotated_box.
rotate(rerotation);
144 ICOORDELT_LIST polygon;
147 image_block.
rotate(rerotation);
152 const std::unique_ptr< ICOORDELT_LIST> segments(lines->get_line(
y));
153 if (!segments->empty()) {
154 ICOORDELT_IT s_it(segments.get());
157 for (s_it.mark_cycle_pt(); !s_it.cycled_list(); s_it.forward()) {
158 int start = s_it.data()->x();
159 int xext = s_it.data()->y();
161 pixRasterop(pix, start - rotated_box.
left(),
162 rotated_box.
height() - 1 - (
y - rotated_box.
bottom()), xext, 1, PIX_SET,
170 pixRasterop(pix, 0, 0, rotated_box.
width(), rotated_box.
height(), PIX_SET,
nullptr, 0, 0);
172 if (mask_box !=
nullptr) {
173 *mask_box = rotated_box;
184#ifndef GRAPHICS_DISABLED
202 startpt = *(it.data());
206# if !defined(_WIN32) || defined(__MINGW32__)
207 snprintf(temp_buff,
sizeof(temp_buff),
"%" PRId32, serial);
209 _ultoa(serial, temp_buff, 10);
211 window->
Text(startpt.
x(), startpt.
y(), temp_buff);
215 prevpt = *(it.data());
218 window->
DrawTo(prevpt.
x(), it.data()->y());
219 window->
DrawTo(it.data()->x(), it.data()->y());
220 }
while (!it.at_last());
221 endpt = *(it.data());
227 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
229 window->
DrawTo(prevpt.
x(), it.data()->y());
230 window->
DrawTo(it.data()->x(), it.data()->y());
231 prevpt = *(it.data());
234 window->
DrawTo(endpt.
x(), endpt.
y());
271 : left_it(&blkptr->leftside), right_it(&blkptr->rightside) {
289 left_it.set_to_list(&blkptr->
leftside);
290 right_it.set_to_list(&blkptr->
rightside);
303 left_it.move_to_first();
304 right_it.move_to_first();
305 left_it.mark_cycle_pt();
306 right_it.mark_cycle_pt();
307 ymin = left_it.data()->y();
308 ymax = left_it.data_relative(1)->y();
309 if (right_it.data_relative(1)->y() < ymax) {
311 ymax = right_it.data_relative(1)->y();
322 if (!left_it.empty()) {
323 if (left_it.data_relative(1)->y() == ymax) {
326 if (right_it.data_relative(1)->y() == ymax) {
330 if (left_it.at_last() || right_it.at_last()) {
331 left_it.move_to_first();
332 right_it.move_to_first();
334 ymin = left_it.data()->y();
339 ymax = left_it.data_relative(1)->y();
340 if (right_it.data_relative(1)->y() < ymax) {
342 ymax = right_it.data_relative(1)->y();
362 if (
y < bleft.
y() ||
y >= tright.
y()) {
370 if (
y >= bleft.
y() &&
y < tright.
y()) {
372 xext = tright.
x() - bleft.
x();
379 if (
y >= bleft.
y() &&
y < tright.
y()) {
381 xext = tright.
x() - bleft.
x();
#define BLOCK_LABEL_HEIGHT
constexpr ERRCODE BADBLOCKLINE("Y coordinate in block out of bounds")
constexpr ERRCODE LOSTBLOCKLINE("Can't find rectangle for line")
bool contains(ICOORD pt)
is pt inside block
PDBLK & operator=(const PDBLK &source)
Image render_mask(const FCOORD &rerotation, TBOX *mask_box)
ICOORDELT_LIST rightside
right side vertices
int index_
Serial number of this block.
void move(const ICOORD vec)
reposition block
void plot(ScrollView *window, int32_t serial, ScrollView::Color colour)
POLY_BLOCK * hand_poly
weird as well
ICOORDELT_LIST leftside
left side vertices
void set_sides(ICOORDELT_LIST *left, ICOORDELT_LIST *right)
void bounding_box(ICOORD &bottom_left, ICOORD &top_right) const
get box
void forward()
next rectangle
void start_block()
start iteration
bool cycled_rects() const
test end
void set_to_block(PDBLK *blkptr)
start (new) block
BLOCK_RECT_IT(PDBLK *blkptr)
void bounding_box(ICOORD &bleft, ICOORD &tright)
TDimension get_line(TDimension y, TDimension &xext)
TDimension y() const
access_function
TDimension x() const
access function
static ICOORDELT * deep_copy(const ICOORDELT *src)
ICOORDELT_LIST * points()
PolyBlockType isA() const
void rotate(FCOORD rotation)
void plot(ScrollView *window, int32_t num)
TDimension height() const
void move(const ICOORD vec)
void rotate(const FCOORD &vec)
TDimension bottom() const
void error(const char *caller, TessErrorLogCode action, const char *format,...) const __attribute__((format(gnu_printf
void TextAttributes(const char *font, int pixel_size, bool bold, bool italic, bool underlined)
void Text(int x, int y, const char *mystring)
void SetCursor(int x, int y)
void DrawTo(int x, int y)