00001
00019 #ifndef FPCHOP_H
00020 #define FPCHOP_H
00021
00022 #include "varable.h"
00023 #include "blobbox.h"
00024 #include "notdll.h"
00025 #include "notdll.h"
00026
00031 class OUTLINE_FRAG:public ELIST_LINK
00032 {
00033 public:
00034 OUTLINE_FRAG() {
00035 }
00036
00037 OUTLINE_FRAG(POLYPT_IT *head_it, POLYPT_IT *tail_it);
00038
00039 OUTLINE_FRAG(OUTLINE_FRAG *head, float tail_y);
00040
00041 POLYPT_LIST polypts;
00042 OUTLINE_FRAG *other_end;
00043 float ycoord;
00044
00045 private:
00046 };
00047
00052 class C_OUTLINE_FRAG:public ELIST_LINK
00053 {
00054 public:
00055 C_OUTLINE_FRAG() {
00056 steps = NULL;
00057 stepcount = 0;
00058 }
00059 ~C_OUTLINE_FRAG () {
00060 if (steps != NULL)
00061 delete [] steps;
00062 }
00063
00064 C_OUTLINE_FRAG(ICOORD start_pt,
00065 ICOORD end_pt,
00066 C_OUTLINE *outline,
00067 INT16 start_index,
00068 INT16 end_index);
00069
00070 C_OUTLINE_FRAG(C_OUTLINE_FRAG *head, INT16 tail_y);
00071 C_OUTLINE *close();
00072 C_OUTLINE_FRAG & operator= (
00073 const C_OUTLINE_FRAG & src);
00074
00075 ICOORD start;
00076 ICOORD end;
00077 DIR128 *steps;
00078 INT32 stepcount;
00079 C_OUTLINE_FRAG *other_end;
00080 INT16 ycoord;
00081
00082 private:
00083 };
00084
00085 ELISTIZEH (OUTLINE_FRAG) ELISTIZEH (C_OUTLINE_FRAG)
00088 extern INT_VAR_H (textord_fp_chop_error, 2,
00089 "Max allowed bending of chop cells");
00090 extern double_VAR_H (textord_fp_chop_snap, 0.5,
00091 "Max distance of chop pt from vertex");
00094 ROW *fixed_pitch_words(
00095 TO_ROW *row,
00096 FCOORD rotation
00097 );
00098 WERD *add_repeated_word(
00099 WERD_IT *rep_it,
00100 INT16 &rep_left,
00101 INT16 &prev_chop_coord,
00102 UINT8 &blanks,
00103 float pitch,
00104 WERD_IT *word_it
00105 );
00106 void split_to_blob(
00107 BLOBNBOX *blob,
00108 INT16 chop_coord,
00109 float pitch_error,
00110 OUTLINE_LIST *left_outlines,
00111 C_OUTLINE_LIST *left_coutlines,
00112 OUTLINE_LIST *right_outlines,
00113 C_OUTLINE_LIST *right_coutlines);
00114 void fixed_chop_blob(
00115 PBLOB *blob,
00116 INT16 chop_coord,
00117 float pitch_error,
00118 OUTLINE_LIST *left_outlines,
00119 OUTLINE_LIST *right_outlines
00120 );
00121 void fixed_split_outline(
00122 OUTLINE *srcline,
00123 INT16 chop_coord,
00124 float pitch_error,
00125 OUTLINE_IT *left_it,
00126 OUTLINE_IT *right_it
00127 );
00128 BOOL8 fixed_chop_outline(
00129 OUTLINE *srcline,
00130 INT16 chop_coord,
00131 float pitch_error,
00132 OUTLINE_FRAG_LIST *left_frags,
00133 OUTLINE_FRAG_LIST *right_frags
00134 );
00135 void save_chop_fragment(
00136 POLYPT_IT *head_it,
00137 POLYPT_IT *tail_it,
00138 OUTLINE_FRAG_LIST *frags
00139 );
00140 void add_frag_to_list(
00141 OUTLINE_FRAG *frag,
00142 OUTLINE_FRAG_LIST *frags
00143 );
00144 void insert_chop_pt(
00145 POLYPT_IT *it,
00146 INT16 chop_coord
00147 );
00148 FCOORD find_chop_coords(
00149 POLYPT_IT *it,
00150 INT16 chop_coord
00151 );
00152 void insert_extra_pt(
00153 POLYPT_IT *it
00154 );
00155 void close_chopped_fragments(
00156 OUTLINE_FRAG_LIST *frags,
00157 OUTLINE_LIST *children,
00158 OUTLINE_IT *dest_it
00159 );
00160 void join_chopped_fragments(
00161 OUTLINE_FRAG *bottom,
00162 OUTLINE_FRAG *top
00163 );
00164 void fixed_chop_cblob(
00165 C_BLOB *blob,
00166 INT16 chop_coord,
00167 float pitch_error,
00168 C_OUTLINE_LIST *left_outlines,
00169 C_OUTLINE_LIST *right_outlines
00170 );
00171 void fixed_split_coutline(
00172 C_OUTLINE *srcline,
00173 INT16 chop_coord,
00174 float pitch_error,
00175 C_OUTLINE_IT *left_it,
00176 C_OUTLINE_IT *right_it
00177 );
00178 BOOL8 fixed_chop_coutline(
00179 C_OUTLINE *srcline,
00180 INT16 chop_coord,
00181 float pitch_error,
00182 C_OUTLINE_FRAG_LIST *left_frags,
00183 C_OUTLINE_FRAG_LIST *right_frags
00184 );
00185 INT16 next_anti_left_seg(
00186 C_OUTLINE *srcline,
00187 INT16 tail_index,
00188 INT16 startindex,
00189 INT32 length,
00190 INT16 chop_coord,
00191 float pitch_error,
00192 ICOORD *tail_pos
00193 );
00194 INT16 next_anti_right_seg(
00195 C_OUTLINE *srcline,
00196 INT16 tail_index,
00197 INT16 startindex,
00198 INT32 length,
00199 INT16 chop_coord,
00200 float pitch_error,
00201 ICOORD *tail_pos
00202 );
00203 INT16 next_clock_left_seg(
00204 C_OUTLINE *srcline,
00205 INT16 tail_index,
00206 INT16 startindex,
00207 INT32 length,
00208 INT16 chop_coord,
00209 float pitch_error,
00210 ICOORD *tail_pos
00211 );
00212 INT16 next_clock_right_seg(
00213 C_OUTLINE *srcline,
00214 INT16 tail_index,
00215 INT16 startindex,
00216 INT32 length,
00217 INT16 chop_coord,
00218 float pitch_error,
00219 ICOORD *tail_pos
00220 );
00221 void save_chop_cfragment(
00222 INT16 head_index,
00223 ICOORD head_pos,
00224 INT16 tail_index,
00225 ICOORD tail_pos,
00226 C_OUTLINE *srcline,
00227 C_OUTLINE_FRAG_LIST *frags
00228 );
00229 void add_frag_to_list(
00230 C_OUTLINE_FRAG *frag,
00231 C_OUTLINE_FRAG_LIST *frags
00232 );
00233 void close_chopped_cfragments(
00234 C_OUTLINE_FRAG_LIST *frags,
00235 C_OUTLINE_LIST *children,
00236 float pitch_error,
00237 C_OUTLINE_IT *dest_it
00238 );
00239 C_OUTLINE *join_chopped_fragments(
00240 C_OUTLINE_FRAG *bottom,
00241 C_OUTLINE_FRAG *top
00242 );
00243 void join_segments(
00244 C_OUTLINE_FRAG *bottom,
00245 C_OUTLINE_FRAG *top
00246 );
00247 #endif