tesseract  4.00.00dev
plotedges.cpp
Go to the documentation of this file.
1 /* -*-C-*-
2  ********************************************************************************
3  *
4  * File: plotedges.c (Formerly plotedges.c)
5  * Description: Graphics routines for "Edges" and "Outlines" windows
6  * Author: Mark Seaman, OCR Technology
7  * Created: Fri Jul 28 13:14:48 1989
8  * Modified: Tue Jul 9 17:22:22 1991 (Mark Seaman) marks@hpgrlt
9  * Language: C
10  * Package: N/A
11  * Status: Experimental (Do Not Distribute)
12  *
13  * (c) Copyright 1989, Hewlett-Packard Company.
14  ** Licensed under the Apache License, Version 2.0 (the "License");
15  ** you may not use this file except in compliance with the License.
16  ** You may obtain a copy of the License at
17  ** http://www.apache.org/licenses/LICENSE-2.0
18  ** Unless required by applicable law or agreed to in writing, software
19  ** distributed under the License is distributed on an "AS IS" BASIS,
20  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  ** See the License for the specific language governing permissions and
22  ** limitations under the License.
23  *
24  *********************************************************************************/
25 #ifdef __UNIX__
26 #include <assert.h>
27 #endif
28 
29 #include "plotedges.h"
30 #include "render.h"
31 #include "split.h"
32 
33 // Include automatically generated configuration file if running autoconf.
34 #ifdef HAVE_CONFIG_H
35 #include "config_auto.h"
36 #endif
37 
38 #ifndef GRAPHICS_DISABLED
39 
40 /*----------------------------------------------------------------------
41  V a r i a b l e s
42 ----------------------------------------------------------------------*/
44 
45 /*----------------------------------------------------------------------
46  F u n c t i o n s
47 ----------------------------------------------------------------------*/
48 /**********************************************************************
49  * display_edgepts
50  *
51  * Macro to display edge points in a window.
52  **********************************************************************/
53 void display_edgepts(LIST outlines) {
54  void *window;
55  /* Set up window */
56  if (edge_window == NULL) {
57  edge_window = c_create_window ("Edges", 750, 150,
58  400, 128, -400.0, 400.0, 0.0, 256.0);
59  }
60  else {
61  c_clear_window(edge_window);
62  }
63  /* Render the outlines */
64  window = edge_window;
65  /* Reclaim old memory */
66  iterate(outlines) {
67  render_edgepts (window, (EDGEPT *) first_node (outlines), White);
68  }
69 }
70 
71 
72 /**********************************************************************
73  * draw_blob_edges
74  *
75  * Display the edges of this blob in the edges window.
76  **********************************************************************/
77 void draw_blob_edges(TBLOB *blob) {
78  TESSLINE *ol;
79  LIST edge_list = NIL_LIST;
80 
82  for (ol = blob->outlines; ol != NULL; ol = ol->next)
83  push_on (edge_list, ol->loop);
84  display_edgepts(edge_list);
85  destroy(edge_list);
86  }
87 }
88 
89 
90 /**********************************************************************
91  * mark_outline
92  *
93  * Make a mark on the edges window at a particular location.
94  **********************************************************************/
95 void mark_outline(EDGEPT *edgept) { /* Start of point list */
96  void *window = edge_window;
97  float x = edgept->pos.x;
98  float y = edgept->pos.y;
99 
100  c_line_color_index(window, Red);
101  c_move(window, x, y);
102 
103  x -= 4;
104  y -= 12;
105  c_draw(window, x, y);
106 
107  x -= 2;
108  y += 4;
109  c_draw(window, x, y);
110 
111  x -= 4;
112  y += 2;
113  c_draw(window, x, y);
114 
115  x += 10;
116  y += 6;
117  c_draw(window, x, y);
118 
119  c_make_current(window);
120 }
121 
122 #endif // GRAPHICS_DISABLED
void display_edgepts(LIST outlines)
Definition: plotedges.cpp:53
TESSLINE * next
Definition: blobs.h:258
void mark_outline(EDGEPT *edgept)
Definition: plotedges.cpp:95
TPOINT pos
Definition: blobs.h:163
Definition: callcpp.h:34
void render_edgepts(void *window, EDGEPT *edgept, C_COL color)
Definition: render.cpp:98
LIST destroy(LIST list)
Definition: oldlist.cpp:182
bool wordrec_display_splits
Definition: split.cpp:49
void draw_blob_edges(TBLOB *blob)
Definition: plotedges.cpp:77
ScrollView * c_create_window(const char *name, inT16 xpos, inT16 ypos, inT16 xsize, inT16 ysize, double xmin, double xmax, double ymin, double ymax)
Definition: callcpp.cpp:55
TESSLINE * outlines
Definition: blobs.h:377
#define NIL_LIST
Definition: oldlist.h:126
void c_move(void *win, double x, double y)
Definition: callcpp.cpp:79
void c_clear_window(void *win)
Definition: callcpp.cpp:104
Definition: callcpp.h:35
void c_draw(void *win, double x, double y)
Definition: callcpp.cpp:88
EDGEPT * loop
Definition: blobs.h:257
inT16 x
Definition: blobs.h:71
Definition: blobs.h:76
#define first_node(l)
Definition: oldlist.h:139
void c_line_color_index(void *win, C_COL index)
Definition: callcpp.cpp:70
inT16 y
Definition: blobs.h:72
Definition: blobs.h:261
void c_make_current(void *win)
Definition: callcpp.cpp:97
#define push_on(list, thing)
Definition: oldlist.h:200
#define iterate(l)
Definition: oldlist.h:159
ScrollView * edge_window
Definition: plotedges.cpp:43