00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef SEAM_H
00026 #define SEAM_H
00027
00028
00029
00030
00031 #include "split.h"
00032 #include "tessarray.h"
00033
00034
00035
00036
00037 typedef float PRIORITY;
00038
00039 typedef struct seam_record
00040 {
00041 PRIORITY priority;
00042 inT8 widthp;
00043 inT8 widthn;
00044 inT16 location;
00045 SPLIT *split1;
00046 SPLIT *split2;
00047 SPLIT *split3;
00048 } SEAM;
00049
00050 typedef ARRAY SEAMS;
00051
00052 extern SEAM *newseam();
00053
00054
00055
00056
00063 #define clone_seam(dest,source) \
00064 if (source) { \
00065 (dest) = newseam (); \
00066 (dest)->location = (source)->location; \
00067 (dest)->widthp = (source)->widthp; \
00068 (dest)->widthn = (source)->widthn; \
00069 (dest)->priority = (source)->priority; \
00070 clone_split ((dest)->split1, (source)->split1); \
00071 clone_split ((dest)->split2, (source)->split2); \
00072 clone_split ((dest)->split3, (source)->split3); \
00073 } \
00074 else { \
00075 (dest) = (SEAM*) NULL; \
00076 } \
00077
00078
00086 #define exact_point(p1,p2) \
00087 (! ((p1->pos.x - p2->pos.x) || (p1->pos.y - p2->pos.y)))
00088
00089
00090
00091
00092 bool point_in_split(SPLIT *split, EDGEPT *point1, EDGEPT *point2);
00093
00094 bool point_in_seam(SEAM *seam, SPLIT *split);
00095
00096 SEAMS add_seam(SEAMS seam_list, SEAM *seam);
00097
00098 void combine_seams(SEAM *dest_seam, SEAM *source_seam);
00099
00100 void delete_seam(void *arg);
00101
00102 void free_seam_list(SEAMS seam_list);
00103
00104 bool test_insert_seam(SEAMS seam_list,
00105 int index,
00106 TBLOB *left_blob,
00107 TBLOB *first_blob);
00108
00109 SEAMS insert_seam(SEAMS seam_list,
00110 int index,
00111 SEAM *seam,
00112 TBLOB *left_blob,
00113 TBLOB *first_blob);
00114
00115 int account_splits_right(SEAM *seam, TBLOB *blob);
00116
00117 int account_splits_left(SEAM *seam, TBLOB *blob, TBLOB *end_blob);
00118
00119 bool find_split_in_blob(SPLIT *split, TBLOB *blob);
00120
00121 SEAM *join_two_seams(SEAM *seam1, SEAM *seam2);
00122
00123 SEAM *new_seam(PRIORITY priority,
00124 int x_location,
00125 SPLIT *split1,
00126 SPLIT *split2,
00127 SPLIT *split3);
00128
00129 SEAMS new_seam_list();
00130
00131 void print_seam(const char *label, SEAM *seam);
00132
00133 void print_seams(const char *label, SEAMS seams);
00134
00135 int shared_split_points(SEAM *seam1, SEAM *seam2);
00136 #endif