/*---------------------------------------------------------------------------- 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); }
/********************************************************************** * display_blob * * Macro to display blob in a window. **********************************************************************/ void display_blob(TBLOB *blob, C_COL color) { /* Size of drawable */ if (blob_window == NULL) { blob_window = c_create_window ("Blobs", 520, 10, 500, 256, -1000.0, 1000.0, 0.0, 256.0); } else { c_clear_window(blob_window); } render_blob(blob_window, blob, color); }
/********************************************************************** * 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); }
/********************************************************************** * display_edgepts * * Macro to display edge points in a window. **********************************************************************/ void display_edgepts(LIST outlines) { void *window; /* Set up window */ if (edge_window == NULL) { edge_window = c_create_window ("Edges", 750, 150, 400, 128, -400.0, 400.0, 0.0, 256.0); } else { c_clear_window(edge_window); } /* Render the outlines */ window = edge_window; /* Reclaim old memory */ iterate(outlines) { render_edgepts (window, (EDGEPT *) first_node (outlines), White); } }