tesseract  4.0.0-1-g2a2b
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  *
6  * (C) Copyright 1993, Hewlett-Packard Ltd.
7  ** Licensed under the Apache License, Version 2.0 (the "License");
8  ** you may not use this file except in compliance with the License.
9  ** You may obtain a copy of the License at
10  ** http://www.apache.org/licenses/LICENSE-2.0
11  ** Unless required by applicable law or agreed to in writing, software
12  ** distributed under the License is distributed on an "AS IS" BASIS,
13  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  ** See the License for the specific language governing permissions and
15  ** limitations under the License.
16  *
17  **********************************************************************/
18 
19 #ifndef FPCHOP_H
20 #define FPCHOP_H
21 
22 #include "params.h"
23 #include "blobbox.h"
24 
26 {
27  public:
28  C_OUTLINE_FRAG() { //empty constructor
29  steps = nullptr;
30  stepcount = 0;
31  }
33  delete [] steps;
34  }
35  //start coord
36  C_OUTLINE_FRAG(ICOORD start_pt,
37  ICOORD end_pt, //end coord
38  C_OUTLINE *outline, //source of steps
39  int16_t start_index,
40  int16_t end_index);
41  //other end
42  C_OUTLINE_FRAG(C_OUTLINE_FRAG *head, int16_t tail_y);
43  C_OUTLINE *close(); //copy to outline
44  C_OUTLINE_FRAG & operator= ( //assign
45  const C_OUTLINE_FRAG & src);
46 
47  ICOORD start; //start coord
48  ICOORD end; //end coord
49  DIR128 *steps; //step array
50  int32_t stepcount; //no of steps
51  C_OUTLINE_FRAG *other_end; //head if a tail
52  int16_t ycoord; //coord of cut pt
53 
54  private:
55  // Copy constructor (currently unused, therefore private).
56  C_OUTLINE_FRAG(const C_OUTLINE_FRAG& other);
57 };
58 
60 
61 extern
63 "Max allowed bending of chop cells");
64 extern
66 "Max distance of chop pt from vertex");
67 ROW *fixed_pitch_words( //find lines
68  TO_ROW *row, //row to do
69  FCOORD rotation //for drawing
70  );
71 WERD *add_repeated_word( //move repeated word
72  WERD_IT *rep_it, //repeated words
73  int16_t &rep_left, //left edge of word
74  int16_t &prev_chop_coord, //previous word end
75  uint8_t &blanks, //no of blanks
76  float pitch, //char cell size
77  WERD_IT *word_it //list of words
78  );
79 void split_to_blob( //split the blob
80  BLOBNBOX *blob, //blob to split
81  int16_t chop_coord, //place to chop
82  float pitch_error, //allowed deviation
83  C_OUTLINE_LIST *left_coutlines, //for cblobs
84  C_OUTLINE_LIST *right_coutlines);
85 void fixed_chop_cblob( //split the blob
86  C_BLOB *blob, //blob to split
87  int16_t chop_coord, //place to chop
88  float pitch_error, //allowed deviation
89  C_OUTLINE_LIST *left_outlines, //left half of chop
90  C_OUTLINE_LIST *right_outlines //right half of chop
91  );
92 void fixed_split_coutline( //chop the outline
93  C_OUTLINE *srcline, //source outline
94  int16_t chop_coord, //place to chop
95  float pitch_error, //allowed deviation
96  C_OUTLINE_IT *left_it, //left half of chop
97  C_OUTLINE_IT *right_it //right half of chop
98  );
99 bool fixed_chop_coutline( //chop the outline
100  C_OUTLINE* srcline, //source outline
101  int16_t chop_coord, //place to chop
102  float pitch_error, //allowed deviation
103  C_OUTLINE_FRAG_LIST* left_frags, //left half of chop
104  C_OUTLINE_FRAG_LIST* right_frags //right half of chop
105 );
106 void save_chop_cfragment( //chop the outline
107  int16_t head_index, //head of fragment
108  ICOORD head_pos, //head of fragment
109  int16_t tail_index, //tail of fragment
110  ICOORD tail_pos, //tail of fragment
111  C_OUTLINE *srcline, //source of edgesteps
112  C_OUTLINE_FRAG_LIST *frags //fragment list
113  );
114 void add_frag_to_list( //ordered add
115  C_OUTLINE_FRAG *frag, //fragment to add
116  C_OUTLINE_FRAG_LIST *frags //fragment list
117  );
118 void close_chopped_cfragments( //chop the outline
119  C_OUTLINE_FRAG_LIST *frags, //list to clear
120  C_OUTLINE_LIST *children, //potential children
121  float pitch_error, //allowed shrinkage
122  C_OUTLINE_IT *dest_it //output list
123  );
124 C_OUTLINE *join_chopped_fragments( //join pieces
125  C_OUTLINE_FRAG *bottom, //bottom of cut
126  C_OUTLINE_FRAG *top //top of cut
127  );
128 void join_segments( //join pieces
129  C_OUTLINE_FRAG *bottom, //bottom of cut
130  C_OUTLINE_FRAG *top //top of cut
131  );
132 #endif
C_OUTLINE_FRAG * other_end
Definition: fpchop.h:51
#define INT_VAR_H(name, val, comment)
Definition: params.h:264
#define ELISTIZEH(CLASSNAME)
Definition: elst.h:948
int16_t ycoord
Definition: fpchop.h:52
double textord_fp_chop_snap
Definition: fpchop.cpp:37
ICOORD end
Definition: fpchop.h:48
ICOORD start
Definition: fpchop.h:47
void join_segments(C_OUTLINE_FRAG *bottom, C_OUTLINE_FRAG *top)
Definition: fpchop.cpp:732
#define double_VAR_H(name, val, comment)
Definition: params.h:273
void fixed_chop_cblob(C_BLOB *blob, int16_t chop_coord, float pitch_error, C_OUTLINE_LIST *left_outlines, C_OUTLINE_LIST *right_outlines)
Definition: fpchop.cpp:269
~C_OUTLINE_FRAG()
Definition: fpchop.h:32
WERD * add_repeated_word(WERD_IT *rep_it, int16_t &rep_left, int16_t &prev_chop_coord, uint8_t &blanks, float pitch, WERD_IT *word_it)
Definition: fpchop.cpp:203
void save_chop_cfragment(int16_t head_index, ICOORD head_pos, int16_t tail_index, ICOORD tail_pos, C_OUTLINE *srcline, C_OUTLINE_FRAG_LIST *frags)
Definition: fpchop.cpp:514
void fixed_split_coutline(C_OUTLINE *srcline, int16_t chop_coord, float pitch_error, C_OUTLINE_IT *left_it, C_OUTLINE_IT *right_it)
Definition: fpchop.cpp:315
void close_chopped_cfragments(C_OUTLINE_FRAG_LIST *frags, C_OUTLINE_LIST *children, float pitch_error, C_OUTLINE_IT *dest_it)
Definition: fpchop.cpp:634
C_OUTLINE_FRAG & operator=(const C_OUTLINE_FRAG &src)
Definition: fpchop.cpp:804
int textord_fp_chop_error
Definition: fpchop.cpp:35
integer coordinate
Definition: points.h:32
Definition: mod128.h:29
bool fixed_chop_coutline(C_OUTLINE *srcline, int16_t chop_coord, float pitch_error, C_OUTLINE_FRAG_LIST *left_frags, C_OUTLINE_FRAG_LIST *right_frags)
Definition: fpchop.cpp:397
ROW * fixed_pitch_words(TO_ROW *row, FCOORD rotation)
Definition: fpchop.cpp:47
void add_frag_to_list(C_OUTLINE_FRAG *frag, C_OUTLINE_FRAG_LIST *frags)
Definition: fpchop.cpp:605
Definition: werd.h:59
C_OUTLINE * join_chopped_fragments(C_OUTLINE_FRAG *bottom, C_OUTLINE_FRAG *top)
Definition: fpchop.cpp:695
Definition: ocrrow.h:36
int32_t stepcount
Definition: fpchop.h:50
void split_to_blob(BLOBNBOX *blob, int16_t chop_coord, float pitch_error, C_OUTLINE_LIST *left_coutlines, C_OUTLINE_LIST *right_coutlines)
Definition: fpchop.cpp:239
Definition: points.h:189
C_OUTLINE * close()
Definition: fpchop.cpp:770
DIR128 * steps
Definition: fpchop.h:49
C_OUTLINE_FRAG()
Definition: fpchop.h:28