tesseract  4.0.0-beta.1-59-g2cc4
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 
36 #define EXTERN
37 
46  ScrollView* image_win; //image window
47 
48  //create the window
49  image_win = new ScrollView (IMAGE_WIN_NAME, IMAGE_XPOS, IMAGE_YPOS, 0, 0, page_tr.x (), page_tr.y ());
50  return image_win; //window
51 }
52 
53 
64  CRACKEDGE *start,
65  ScrollView::Color colour) {
66  CRACKEDGE *edgept; //current point
67 
68  fd->Pen(colour);
69  edgept = start;
70  fd->SetCursor(edgept->pos.x (), edgept->pos.y ());
71  do {
72  do
73  edgept = edgept->next;
74  //merge straight lines
75  while (edgept != start && edgept->prev->stepx == edgept->stepx && edgept->prev->stepy == edgept->stepy);
76 
77  //draw lines
78  fd->DrawTo(edgept->pos.x (), edgept->pos.y ());
79  }
80  while (edgept != start);
81 }
82 
83 #endif // GRAPHICS_DISABLED
void DrawTo(int x, int y)
Definition: scrollview.cpp:530
int16_t y() const
access_function
Definition: points.h:56
#define IMAGE_WIN_NAME
Definition: drawedg.cpp:31
ICOORD pos
Definition: crakedge.h:30
#define IMAGE_XPOS
Definition: drawedg.cpp:32
ScrollView * image_win
Definition: pgedit.cpp:107
int16_t x() const
access function
Definition: points.h:52
#define IMAGE_YPOS
Definition: drawedg.cpp:34
ScrollView * create_edges_window(ICOORD page_tr)
Definition: drawedg.cpp:45
void Pen(Color color)
Definition: scrollview.cpp:725
CRACKEDGE * prev
Definition: crakedge.h:34
integer coordinate
Definition: points.h:30
CRACKEDGE * next
Definition: crakedge.h:35
void SetCursor(int x, int y)
Definition: scrollview.cpp:524
void draw_raw_edge(ScrollView *fd, CRACKEDGE *start, ScrollView::Color colour)
Definition: drawedg.cpp:63
int8_t stepy
Definition: crakedge.h:32
int8_t stepx
Definition: crakedge.h:31