27 #define FLIP_COLOUR(pix) (1-(pix))
37 C_OUTLINE_IT* outline_it) {
54 block_tright = tright;
55 for (x = tright.
x() - bleft.
x(); x >= 0; x--)
62 for (y = tright.
y() - 1; y >= bleft.
y() - 1; y--) {
63 if (y >= block_bleft.
y() && y < block_tright.
y()) {
64 t_image->
get_line(bleft.
x(), y, tright.
x() - bleft.
x(), &bwline, 0);
68 x = tright.
x() - bleft.
x();
69 for (xindex = 0; xindex < x; xindex++)
70 bwline.
pixels[xindex] = margin;
73 margin, bwline.
pixels, ptrline, &free_cracks, outline_it);
97 ICOORDELT_LIST *segments;
106 if (!segments->empty ()) {
107 seg_it.set_to_list (segments);
108 seg_it.mark_cycle_pt ();
109 start = seg_it.data ()->x ();
110 xext = seg_it.data ()->y ();
111 for (xindex = left; xindex < right; xindex++) {
112 if (xindex >= start && !seg_it.cycled_list ()) {
113 xindex = start + xext - 1;
115 start = seg_it.data ()->x ();
116 xext = seg_it.data ()->y ();
119 pixels[xindex - left] = margin;
123 for (xindex = left; xindex < right; xindex++)
124 pixels[xindex - left] = margin;
130 start = line_it->
get_line (y, xext);
131 for (xindex = left; xindex < start; xindex++)
132 pixels[xindex - left] = margin;
133 for (xindex = start + xext; xindex < right; xindex++)
134 pixels[xindex - left] = margin;
159 for (y = block_box.
bottom (); y < block_box.
top (); y++) {
162 t_image->
get_line (x, y, xext, &bwline, 0);
164 for (xindex = 0; xindex < xext; xindex++)
166 t_image->
put_line (x, y, xext, &bwline, 0);
185 C_OUTLINE_IT* outline_it) {
186 CrackPos pos = {free_cracks, x, y };
194 prevcolour = uppercolour;
198 for (; pos.
x < xmax; pos.
x++, prevline++) {
200 if (*prevline !=
NULL) {
204 if (colour == prevcolour) {
205 if (colour == uppercolour) {
207 join_edges(current, *prevline, free_cracks, outline_it);
211 current =
h_edge(uppercolour - colour, *prevline, &pos);
215 if (colour == uppercolour)
216 *prevline =
v_edge(colour - prevcolour, *prevline, &pos);
219 join_edges(current, *prevline, free_cracks, outline_it);
220 current =
h_edge(uppercolour - colour,
NULL, &pos);
221 *prevline =
v_edge(colour - prevcolour, current, &pos);
223 newcurrent =
h_edge(uppercolour - colour, *prevline, &pos);
224 *prevline =
v_edge(colour - prevcolour, current, &pos);
225 current = newcurrent;
230 if (colour != prevcolour) {
231 *prevline = current =
v_edge(colour - prevcolour, current, &pos);
234 if (colour != uppercolour)
235 current =
h_edge(uppercolour - colour, current, &pos);
240 if (current !=
NULL) {
242 if (*prevline !=
NULL) {
243 join_edges(current, *prevline, free_cracks, outline_it);
249 }
else if (*prevline !=
NULL) {
291 && newpt->
pos.
y() == join->
pos.
y()) {
368 C_OUTLINE_IT* outline_it) {
376 if (edge1->
next == edge2) {
381 *free_cracks = edge1;
402 for (current = start; current !=
NULL; current = next) {
403 next = current->
next;
void free_crackedges(CRACKEDGE *start)
void make_margins(PDBLK *block, BLOCK_LINE_IT *line_it, uinT8 *pixels, uinT8 margin, inT16 left, inT16 right, inT16 y)
ICOORDELT_LIST * get_line(inT16 y)
inT16 x() const
access function
void line_edges(inT16 x, inT16 y, inT16 xext, uinT8 uppercolour, uinT8 *bwpos, CRACKEDGE **prevline, CRACKEDGE **free_cracks, C_OUTLINE_IT *outline_it)
inT16 y() const
access_function
inT16 get_line(inT16 y, inT16 &xext)
void put_line(inT32 x, inT32 y, inT32 width, IMAGELINE *linebuf, inT32 margins)
void set_y(inT16 yin)
rewrite function
POLY_BLOCK * poly_block() const
void complete_edge(CRACKEDGE *start, C_OUTLINE_IT *outline_it)
uinT8 * pixels
image pixels
void whiteout_block(IMAGE *t_image, PDBLK *block)
void set_x(inT16 xin)
rewrite function
LIST join(LIST list1, LIST list2)
void get_line(inT32 x, inT32 y, inT32 width, IMAGELINE *linebuf, inT32 margins)
void join_edges(CRACKEDGE *edge1, CRACKEDGE *edge2, CRACKEDGE **free_cracks, C_OUTLINE_IT *outline_it)
void block_edges(IMAGE *t_image, PDBLK *block, C_OUTLINE_IT *outline_it)
CRACKEDGE * h_edge(int sign, CRACKEDGE *join, CrackPos *pos)
void bounding_box(ICOORD &bottom_left, ICOORD &top_right) const
get box
CRACKEDGE * v_edge(int sign, CRACKEDGE *join, CrackPos *pos)