All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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 "drawedg.h"
21 
22 // Include automatically generated configuration file if running autoconf.
23 #ifdef HAVE_CONFIG_H
24 #include "config_auto.h"
25 #endif
26 
27 #ifndef GRAPHICS_DISABLED
28 
30 #define IMAGE_WIN_NAME "Edges"
31 #define IMAGE_XPOS 250
32 
33 #define IMAGE_YPOS 0
34 
35 #define EXTERN
36 
45  ScrollView* image_win; //image window
46 
47  //create the window
48  image_win = new ScrollView (IMAGE_WIN_NAME, IMAGE_XPOS, IMAGE_YPOS, 0, 0, page_tr.x (), page_tr.y ());
49  return image_win; //window
50 }
51 
52 
63  CRACKEDGE *start,
64  ScrollView::Color colour) {
65  CRACKEDGE *edgept; //current point
66 
67  fd->Pen(colour);
68  edgept = start;
69  fd->SetCursor(edgept->pos.x (), edgept->pos.y ());
70  do {
71  do
72  edgept = edgept->next;
73  //merge straight lines
74  while (edgept != start && edgept->prev->stepx == edgept->stepx && edgept->prev->stepy == edgept->stepy);
75 
76  //draw lines
77  fd->DrawTo(edgept->pos.x (), edgept->pos.y ());
78  }
79  while (edgept != start);
80 }
81 
82 #endif // GRAPHICS_DISABLED
void Pen(Color color)
Definition: scrollview.cpp:726
ICOORD pos
Definition: crakedge.h:30
void DrawTo(int x, int y)
Definition: scrollview.cpp:531
#define IMAGE_WIN_NAME
Definition: drawedg.cpp:30
void draw_raw_edge(ScrollView *fd, CRACKEDGE *start, ScrollView::Color colour)
Definition: drawedg.cpp:62
ScrollView * create_edges_window(ICOORD page_tr)
Definition: drawedg.cpp:44
CRACKEDGE * prev
Definition: crakedge.h:34
ScrollView * image_win
Definition: pgedit.cpp:107
inT16 y() const
access_function
Definition: points.h:56
void SetCursor(int x, int y)
Definition: scrollview.cpp:525
inT8 stepx
Definition: crakedge.h:31
integer coordinate
Definition: points.h:30
#define IMAGE_YPOS
Definition: drawedg.cpp:33
inT16 x() const
access function
Definition: points.h:52
#define IMAGE_XPOS
Definition: drawedg.cpp:31
CRACKEDGE * next
Definition: crakedge.h:35
inT8 stepy
Definition: crakedge.h:32