Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
drawedg.cpp
Go to the documentation of this file.
1 /**********************************************************************
2  * File: drawedg.c (Formerly drawedge.c)
3  * Description: Collection of functions to draw things to do with edge detection.
4  * Author: Ray Smith
5  * Created: Thu Jun 06 13:29:20 BST 1991
6  *
7  * (C) Copyright 1991, Hewlett-Packard Ltd.
8  ** Licensed under the Apache License, Version 2.0 (the "License");
9  ** you may not use this file except in compliance with the License.
10  ** You may obtain a copy of the License at
11  ** http://www.apache.org/licenses/LICENSE-2.0
12  ** Unless required by applicable law or agreed to in writing, software
13  ** distributed under the License is distributed on an "AS IS" BASIS,
14  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  ** See the License for the specific language governing permissions and
16  ** limitations under the License.
17  *
18  **********************************************************************/
19 
20 #include "mfcpch.h"
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