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;