/src/tesseract/src/textord/fpchop.h
Line | Count | Source |
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 "blobbox.h" |
23 | | #include "params.h" |
24 | | |
25 | | namespace tesseract { |
26 | | |
27 | | class C_OUTLINE_FRAG : public ELIST<C_OUTLINE_FRAG>::LINK { |
28 | | public: |
29 | 0 | C_OUTLINE_FRAG() { // empty constructor |
30 | 0 | steps = nullptr; |
31 | 0 | stepcount = 0; |
32 | 0 | } |
33 | 206k | ~C_OUTLINE_FRAG() { |
34 | 206k | delete[] steps; |
35 | 206k | } |
36 | | // start coord |
37 | | C_OUTLINE_FRAG(ICOORD start_pt, |
38 | | ICOORD end_pt, // end coord |
39 | | C_OUTLINE *outline, // source of steps |
40 | | int16_t start_index, 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) = delete; |
57 | | }; |
58 | | |
59 | | ELISTIZEH(C_OUTLINE_FRAG) |
60 | | |
61 | | extern INT_VAR_H(textord_fp_chop_error); |
62 | | |
63 | | ROW *fixed_pitch_words( // find lines |
64 | | TO_ROW *row, // row to do |
65 | | FCOORD rotation // for drawing |
66 | | ); |
67 | | |
68 | | void split_to_blob( // split the blob |
69 | | BLOBNBOX *blob, // blob to split |
70 | | int16_t chop_coord, // place to chop |
71 | | float pitch_error, // allowed deviation |
72 | | C_OUTLINE_LIST *left_coutlines, // for cblobs |
73 | | C_OUTLINE_LIST *right_coutlines); |
74 | | |
75 | | } // namespace tesseract |
76 | | |
77 | | #endif |