Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fpchop.h
Go to the documentation of this file.
1 /**********************************************************************
2  * File: fpchop.h (Formerly fp_chop.h)
3  * Description: Code to chop fixed pitch text into character cells.
4  * Author: Ray Smith
5  * Created: Thu Sep 16 11:14:15 BST 1993
6  *
7  * (C) Copyright 1993, 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 #ifndef FPCHOP_H
21 #define FPCHOP_H
22 
23 #include "params.h"
24 #include "blobbox.h"
25 #include "notdll.h"
26 #include "notdll.h"
27 
29 {
30  public:
31  C_OUTLINE_FRAG() { //empty constructor
32  steps = NULL;
33  stepcount = 0;
34  }
36  if (steps != NULL)
37  delete [] steps;
38  }
39  //start coord
40  C_OUTLINE_FRAG(ICOORD start_pt,
41  ICOORD end_pt, //end coord
42  C_OUTLINE *outline, //source of steps
43  inT16 start_index,
44  inT16 end_index);
45  //other end
46  C_OUTLINE_FRAG(C_OUTLINE_FRAG *head, inT16 tail_y);
47  C_OUTLINE *close(); //copy to outline
48  C_OUTLINE_FRAG & operator= ( //assign
49  const C_OUTLINE_FRAG & src);
50 
51  ICOORD start; //start coord
52  ICOORD end; //end coord
53  DIR128 *steps; //step array
54  inT32 stepcount; //no of steps
55  C_OUTLINE_FRAG *other_end; //head if a tail
56  inT16 ycoord; //coord of cut pt
57 
58  private:
59 };
60 
62 
63 extern
65 "Max allowed bending of chop cells");
66 extern
68 "Max distance of chop pt from vertex");
69 ROW *fixed_pitch_words( //find lines
70  TO_ROW *row, //row to do
71  FCOORD rotation //for drawing
72  );
73 WERD *add_repeated_word( //move repeated word
74  WERD_IT *rep_it, //repeated words
75  inT16 &rep_left, //left edge of word
76  inT16 &prev_chop_coord, //previous word end
77  uinT8 &blanks, //no of blanks
78  float pitch, //char cell size
79  WERD_IT *word_it //list of words
80  );
81 void split_to_blob( //split the blob
82  BLOBNBOX *blob, //blob to split
83  inT16 chop_coord, //place to chop
84  float pitch_error, //allowed deviation
85  C_OUTLINE_LIST *left_coutlines, //for cblobs
86  C_OUTLINE_LIST *right_coutlines);
87 void fixed_chop_cblob( //split the blob
88  C_BLOB *blob, //blob to split
89  inT16 chop_coord, //place to chop
90  float pitch_error, //allowed deviation
91  C_OUTLINE_LIST *left_outlines, //left half of chop
92  C_OUTLINE_LIST *right_outlines //right half of chop
93  );
94 void fixed_split_coutline( //chop the outline
95  C_OUTLINE *srcline, //source outline
96  inT16 chop_coord, //place to chop
97  float pitch_error, //allowed deviation
98  C_OUTLINE_IT *left_it, //left half of chop
99  C_OUTLINE_IT *right_it //right half of chop
100  );
101 BOOL8 fixed_chop_coutline( //chop the outline
102  C_OUTLINE *srcline, //source outline
103  inT16 chop_coord, //place to chop
104  float pitch_error, //allowed deviation
105  C_OUTLINE_FRAG_LIST *left_frags, //left half of chop
106  C_OUTLINE_FRAG_LIST *right_frags //right half of chop
107  );
108 inT16 next_anti_left_seg( //chop the outline
109  C_OUTLINE *srcline, //source outline
110  inT16 tail_index, //of tailpos
111  inT16 startindex, //end of search
112  inT32 length, //of outline
113  inT16 chop_coord, //place to chop
114  float pitch_error, //allowed deviation
115  ICOORD *tail_pos //current position
116  );
117 inT16 next_anti_right_seg( //chop the outline
118  C_OUTLINE *srcline, //source outline
119  inT16 tail_index, //of tailpos
120  inT16 startindex, //end of search
121  inT32 length, //of outline
122  inT16 chop_coord, //place to chop
123  float pitch_error, //allowed deviation
124  ICOORD *tail_pos //current position
125  );
126 inT16 next_clock_left_seg( //chop the outline
127  C_OUTLINE *srcline, //source outline
128  inT16 tail_index, //of tailpos
129  inT16 startindex, //end of search
130  inT32 length, //of outline
131  inT16 chop_coord, //place to chop
132  float pitch_error, //allowed deviation
133  ICOORD *tail_pos //current position
134  );
135 inT16 next_clock_right_seg( //chop the outline
136  C_OUTLINE *srcline, //source outline
137  inT16 tail_index, //of tailpos
138  inT16 startindex, //end of search
139  inT32 length, //of outline
140  inT16 chop_coord, //place to chop
141  float pitch_error, //allowed deviation
142  ICOORD *tail_pos //current position
143  );
144 void save_chop_cfragment( //chop the outline
145  inT16 head_index, //head of fragment
146  ICOORD head_pos, //head of fragment
147  inT16 tail_index, //tail of fragment
148  ICOORD tail_pos, //tail of fragment
149  C_OUTLINE *srcline, //source of edgesteps
150  C_OUTLINE_FRAG_LIST *frags //fragment list
151  );
152 void add_frag_to_list( //ordered add
153  C_OUTLINE_FRAG *frag, //fragment to add
154  C_OUTLINE_FRAG_LIST *frags //fragment list
155  );
156 void close_chopped_cfragments( //chop the outline
157  C_OUTLINE_FRAG_LIST *frags, //list to clear
158  C_OUTLINE_LIST *children, //potential children
159  float pitch_error, //allowed shrinkage
160  C_OUTLINE_IT *dest_it //output list
161  );
162 C_OUTLINE *join_chopped_fragments( //join pieces
163  C_OUTLINE_FRAG *bottom, //bottom of cut
164  C_OUTLINE_FRAG *top //top of cut
165  );
166 void join_segments( //join pieces
167  C_OUTLINE_FRAG *bottom, //bottom of cut
168  C_OUTLINE_FRAG *top //top of cut
169  );
170 #endif