/*---------------------------------------------------------------------------- Public Code -----------------------------------------------------------------------------*/ void DisplayProtoList(const char* ch, LIST protolist) { void* window = c_create_window("Char samples", 50, 200, 520, 520, -130.0, 130.0, -130.0, 130.0); LIST proto = protolist; iterate(proto) { PROTOTYPE* prototype = reinterpret_cast<PROTOTYPE *>(first_node(proto)); if (prototype->Significant) c_line_color_index(window, Green); else if (prototype->NumSamples == 0) c_line_color_index(window, Blue); else if (prototype->Merged) c_line_color_index(window, Magenta); else c_line_color_index(window, Red); float x = CenterX(prototype->Mean); float y = CenterY(prototype->Mean); double angle = OrientationOf(prototype->Mean) * 2 * M_PI; float dx = static_cast<float>(LengthOf(prototype->Mean) * cos(angle) / 2); float dy = static_cast<float>(LengthOf(prototype->Mean) * sin(angle) / 2); c_move(window, (x - dx) * 256, (y - dy) * 256); c_draw(window, (x + dx) * 256, (y + dy) * 256); if (prototype->Significant) tprintf("Green proto at (%g,%g)+(%g,%g) %d samples\n", x, y, dx, dy, prototype->NumSamples); else if (prototype->NumSamples > 0 && !prototype->Merged) tprintf("Red proto at (%g,%g)+(%g,%g) %d samples\n", x, y, dx, dy, prototype->NumSamples); } c_make_current(window); }
/********************************************************************** * mark_outline * * Make a mark on the edges window at a particular location. **********************************************************************/ void mark_outline(EDGEPT *edgept) { /* Start of point list */ void *window = edge_window; float x = edgept->pos.x; float y = edgept->pos.y; c_line_color_index(window, Red); c_move(window, x, y); x -= 4; y -= 12; c_draw(window, x, y); x -= 2; y += 4; c_draw(window, x, y); x -= 4; y += 2; c_draw(window, x, y); x += 10; y += 6; c_draw(window, x, y); c_make_current(window); }
/********************************************************************** * mark_split * * Set up the marks list to be displayed in subsequent updates and draw * the marks in the current window. The marks are stored in the second * sublist. The first sublist is left unmodified. **********************************************************************/ void mark_split(SPLIT *split) { void *window = edge_window; c_line_color_index(window, Green); c_move (window, (float) split->point1->pos.x, (float) split->point1->pos.y); c_draw (window, (float) split->point2->pos.x, (float) split->point2->pos.y); c_make_current(window); }
/********************************************************************** * display_segmentation * * Display all the words on the page into a window. **********************************************************************/ void display_segmentation(TBLOB *chunks, SEARCH_STATE segmentation) { /* If no window create it */ if (segm_window == NULL) { segm_window = c_create_window ("Segmentation", 5, 10, 500, 256, -1000.0, 1000.0, 0.0, 256.0); } else { c_clear_window(segm_window); } render_segmentation(segm_window, chunks, segmentation); /* Put data in the window */ c_make_current(segm_window); }