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