tesseract  4.00.00dev
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:531
inT16 x() const
access function
Definition: points.h:52
ICOORD pos
Definition: crakedge.h:30
ScrollView * image_win
Definition: pgedit.cpp:107
inT8 stepx
Definition: crakedge.h:31
CRACKEDGE * prev
Definition: crakedge.h:34
void Pen(Color color)
Definition: scrollview.cpp:726
ScrollView * create_edges_window(ICOORD page_tr)
Definition: drawedg.cpp:45
#define IMAGE_WIN_NAME
Definition: drawedg.cpp:31
#define IMAGE_YPOS
Definition: drawedg.cpp:34
CRACKEDGE * next
Definition: crakedge.h:35
void SetCursor(int x, int y)
Definition: scrollview.cpp:525
inT16 y() const
access_function
Definition: points.h:56
#define IMAGE_XPOS
Definition: drawedg.cpp:32
void draw_raw_edge(ScrollView *fd, CRACKEDGE *start, ScrollView::Color colour)
Definition: drawedg.cpp:63
integer coordinate
Definition: points.h:30
inT8 stepy
Definition: crakedge.h:32