tesseract  4.0.0-1-g2a2b
drawedg.cpp
Go to the documentation of this file.
1 /**********************************************************************
2  * File: drawedg.cpp (Formerly drawedge.c)
3  * Description: Collection of functions to draw things to do with edge
4  * detection.
5  * Author: Ray Smith
6  * Created: Thu Jun 06 13:29:20 BST 1991
7  *
8  * (C) Copyright 1991, Hewlett-Packard Ltd.
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 "drawedg.h"
22 
23 // Include automatically generated configuration file if running autoconf.
24 #ifdef HAVE_CONFIG_H
25 #include "config_auto.h"
26 #endif
27 
28 #ifndef GRAPHICS_DISABLED
29 
31 #define IMAGE_WIN_NAME "Edges"
32 #define IMAGE_XPOS 250
33 
34 #define IMAGE_YPOS 0
35 
44  ScrollView* image_win; //image window
45 
46  //create the window
47  image_win = new ScrollView (IMAGE_WIN_NAME, IMAGE_XPOS, IMAGE_YPOS, 0, 0, page_tr.x (), page_tr.y ());
48  return image_win; //window
49 }
50 
51 
62  CRACKEDGE *start,
63  ScrollView::Color colour) {
64  CRACKEDGE *edgept; //current point
65 
66  fd->Pen(colour);
67  edgept = start;
68  fd->SetCursor(edgept->pos.x (), edgept->pos.y ());
69  do {
70  do
71  edgept = edgept->next;
72  //merge straight lines
73  while (edgept != start && edgept->prev->stepx == edgept->stepx && edgept->prev->stepy == edgept->stepy);
74 
75  //draw lines
76  fd->DrawTo(edgept->pos.x (), edgept->pos.y ());
77  }
78  while (edgept != start);
79 }
80 
81 #endif // GRAPHICS_DISABLED
void draw_raw_edge(ScrollView *fd, CRACKEDGE *start, ScrollView::Color colour)
Definition: drawedg.cpp:61
void DrawTo(int x, int y)
Definition: scrollview.cpp:527
CRACKEDGE * prev
Definition: crakedge.h:34
int8_t stepx
Definition: crakedge.h:31
#define IMAGE_WIN_NAME
Definition: drawedg.cpp:31
int16_t y() const
access_function
Definition: points.h:57
void SetCursor(int x, int y)
Definition: scrollview.cpp:521
integer coordinate
Definition: points.h:32
int16_t x() const
access function
Definition: points.h:53
ICOORD pos
Definition: crakedge.h:30
#define IMAGE_XPOS
Definition: drawedg.cpp:32
CRACKEDGE * next
Definition: crakedge.h:35
int8_t stepy
Definition: crakedge.h:32
ScrollView * create_edges_window(ICOORD page_tr)
Definition: drawedg.cpp:43
#define IMAGE_YPOS
Definition: drawedg.cpp:34
void Pen(Color color)
Definition: scrollview.cpp:722