File: drawedg.cpp

package info (click to toggle)
tesseract 3.03.03-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 66,064 kB
  • ctags: 62,018
  • sloc: cpp: 146,866; sh: 11,353; xml: 1,355; java: 1,135; makefile: 975; perl: 108; python: 42
file content (82 lines) | stat: -rw-r--r-- 2,544 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**********************************************************************
 * File:        drawedg.c  (Formerly drawedge.c)
 * Description: Collection of functions to draw things to do with edge detection.
 * Author:                  Ray Smith
 * Created:                 Thu Jun 06 13:29:20 BST 1991
 *
 * (C) Copyright 1991, Hewlett-Packard Ltd.
 ** Licensed under the Apache License, Version 2.0 (the "License");
 ** you may not use this file except in compliance with the License.
 ** You may obtain a copy of the License at
 ** http://www.apache.org/licenses/LICENSE-2.0
 ** Unless required by applicable law or agreed to in writing, software
 ** distributed under the License is distributed on an "AS IS" BASIS,
 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 ** See the License for the specific language governing permissions and
 ** limitations under the License.
 *
 **********************************************************************/

#include          "drawedg.h"

// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif

#ifndef GRAPHICS_DISABLED

/** title of window */
#define IMAGE_WIN_NAME    "Edges"
#define IMAGE_XPOS      250
/** default position */
#define IMAGE_YPOS      0

#define EXTERN

/**
 * @name create_edges_window
 *
 * Create the edges window.
 * @param page_tr size of image
 */

ScrollView* create_edges_window(ICOORD page_tr) {
  ScrollView* image_win;              //image window

                                 //create the window
  image_win = new ScrollView (IMAGE_WIN_NAME, IMAGE_XPOS, IMAGE_YPOS, 0, 0, page_tr.x (),  page_tr.y ());
  return image_win;              //window
}


/**
 * @name draw_raw_edge
 *
 * Draw the raw steps to the given window in the given colour.
 * @param fd window to draw in
 * @param start start of loop
 * @param colour colour to draw in
 */

void draw_raw_edge(ScrollView* fd,
                   CRACKEDGE *start,
                   ScrollView::Color colour) {
  CRACKEDGE *edgept;             //current point

  fd->Pen(colour);
  edgept = start;
  fd->SetCursor(edgept->pos.x (), edgept->pos.y ());
  do {
    do
    edgept = edgept->next;
                                 //merge straight lines
    while (edgept != start && edgept->prev->stepx == edgept->stepx && edgept->prev->stepy == edgept->stepy);

                                 //draw lines
  fd->DrawTo(edgept->pos.x (), edgept->pos.y ());
  }
  while (edgept != start);
}

#endif  // GRAPHICS_DISABLED