21# include "config_auto.h"
30#define MINEDGELENGTH 8
39 C_OUTLINE_IT *outline_it) {
51 outline =
new C_OUTLINE(start, botleft, topright, looplength);
53 outline_it->add_after_then_move(outline);
75 constexpr ERRCODE ED_ILLEGAL_SUM(
"Illegal sum of chain codes");
83 if (edgept->
stepdir != lastchain) {
85 chaindiff = edgept->
stepdir - lastchain;
88 }
else if (chaindiff < -2) {
91 chainsum += chaindiff;
94 edgept = edgept->
next;
97 if ((chainsum != 4 && chainsum != -4) || edgept != start || length <
MINEDGELENGTH) {
98 if (edgept != start) {
103 ED_ILLEGAL_SUM.
error(
"check_path_legal",
TESSLOG,
"chainsum=%d", chainsum);
129 leftmost = edgept->
pos.
x();
132 edgept = edgept->
next;
133 if (edgept->
pos.
x() < botleft.
x()) {
136 }
else if (edgept->
pos.
x() > topright.
x()) {
139 if (edgept->
pos.
y() < botleft.
y()) {
142 }
else if (edgept->
pos.
y() > topright.
y()) {
144 leftmost = edgept->
pos.
x();
146 }
else if (edgept->
pos.
y() == topright.
y() && edgept->
pos.
x() < leftmost) {
148 leftmost = edgept->
pos.
x();
152 }
while (edgept != start);
void complete_edge(CRACKEDGE *start, C_OUTLINE_IT *outline_it)
int16_t loop_bounding_box(CRACKEDGE *&start, ICOORD &botleft, ICOORD &topright)
ScrollView::Color check_path_legal(CRACKEDGE *start)
static const int kMaxOutlineLength
void set_x(TDimension xin)
rewrite function
TDimension y() const
access_function
void set_y(TDimension yin)
rewrite function
TDimension x() const
access function
void error(const char *caller, TessErrorLogCode action, const char *format,...) const __attribute__((format(gnu_printf