wordrec/plotedges.cpp

Go to the documentation of this file.
00001 
00020 #ifdef __UNIX__
00021 #include <assert.h>
00022 #endif
00023 
00024 #include "plotedges.h"
00025 #include "render.h"
00026 #include "split.h"
00027 
00028 /*----------------------------------------------------------------------
00029               V a r i a b l e s
00030 ----------------------------------------------------------------------*/
00031 void *edge_window = NULL;
00032 
00033 /*----------------------------------------------------------------------
00034               F u n c t i o n s
00035 ----------------------------------------------------------------------*/
00036 /* ================== */
00040 void display_edgepts(LIST outlines) { 
00041   void *window;
00042   /* Set up window */
00043   if (edge_window == NULL) {
00044     edge_window = c_create_window ("Edges", 750, 150,
00045       400, 128, -400.0, 400.0, 0.0, 256.0);
00046   }
00047   else {
00048     c_clear_window(edge_window);
00049   }
00050   /* Render the outlines */
00051   window = edge_window;
00052   /* Reclaim old memory */
00053   iterate(outlines) {
00054     render_edgepts (window, (EDGEPT *) first (outlines), White);
00055   }
00056 }
00057 
00058 
00059 /* ================== */
00063 void draw_blob_edges(TBLOB *blob) {
00064   TESSLINE *ol;
00065   LIST edge_list = NIL;
00066 
00067   if (display_splits) {
00068     for (ol = blob->outlines; ol != NULL; ol = ol->next)
00069       push_on (edge_list, ol->loop);
00070     display_edgepts(edge_list);
00071     destroy(edge_list);
00072   }
00073 }
00074 
00075 
00076 /* ================== */
00080 void mark_outline(EDGEPT *edgept) {  /* Start of point list */
00081   void *window = edge_window;
00082   float x = edgept->pos.x;
00083   float y = edgept->pos.y;
00084 
00085   c_line_color_index(window, Red);
00086   c_move(window, x, y);
00087 
00088   x -= 4;
00089   y -= 12;
00090   c_draw(window, x, y);
00091 
00092   x -= 2;
00093   y += 4;
00094   c_draw(window, x, y);
00095 
00096   x -= 4;
00097   y += 2;
00098   c_draw(window, x, y);
00099 
00100   x += 10;
00101   y += 6;
00102   c_draw(window, x, y);
00103 
00104   c_make_current(window);
00105 }
00106 
00107 
00108 /* ================== */
00118 void mark_split(SPLIT *split) { 
00119   void *window = edge_window;
00120 
00121   c_line_color_index(window, Green);
00122   c_move (window, (float) split->point1->pos.x, (float) split->point1->pos.y);
00123   c_draw (window, (float) split->point2->pos.x, (float) split->point2->pos.y);
00124   c_make_current(window);
00125 }

Generated on Wed Feb 28 19:49:13 2007 for Tesseract by  doxygen 1.5.1