Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
makechop.cpp File Reference
#include "makechop.h"
#include "blobs.h"
#include "render.h"
#include "structures.h"

Go to the source code of this file.

Functions

void apply_seam (TBLOB *blob, TBLOB *other_blob, bool italic_blob, SEAM *seam)
void form_two_blobs (TBLOB *blob, TBLOB *other_blob, bool italic_blob, const TPOINT &location)
void make_double_split (TBLOB *blob, TBLOB *other_blob, bool italic_blob, SEAM *seam)
void make_single_split (TESSLINE *outlines, SPLIT *split)
void make_split_blobs (TBLOB *blob, TBLOB *other_blob, bool italic_blob, SEAM *seam)
void make_triple_split (TBLOB *blob, TBLOB *other_blob, bool italic_blob, SEAM *seam)
void undo_seam (TBLOB *blob, TBLOB *other_blob, SEAM *seam)
void undo_single_split (TBLOB *blob, SPLIT *split)

Function Documentation

void apply_seam ( TBLOB blob,
TBLOB other_blob,
bool  italic_blob,
SEAM seam 
)

Definition at line 52 of file makechop.cpp.

{
if (seam->split1 == NULL) {
divide_blobs(blob, other_blob, italic_blob, seam->location);
}
else if (seam->split2 == NULL) {
make_split_blobs(blob, other_blob, italic_blob, seam);
}
else if (seam->split3 == NULL) {
make_double_split(blob, other_blob, italic_blob, seam);
}
else {
make_triple_split(blob, other_blob, italic_blob, seam);
}
}
void form_two_blobs ( TBLOB blob,
TBLOB other_blob,
bool  italic_blob,
const TPOINT location 
)

Definition at line 74 of file makechop.cpp.

{
divide_blobs(blob, other_blob, italic_blob, location);
correct_blob_order(blob, other_blob);
}
void make_double_split ( TBLOB blob,
TBLOB other_blob,
bool  italic_blob,
SEAM seam 
)

Definition at line 93 of file makechop.cpp.

{
form_two_blobs(blob, other_blob, italic_blob, seam->location);
}
void make_single_split ( TESSLINE outlines,
SPLIT split 
)

Definition at line 107 of file makechop.cpp.

{
assert (outlines != NULL);
split_outline (split->point1, split->point2);
while (outlines->next != NULL)
outlines = outlines->next;
outlines->next = new TESSLINE;
outlines->next->loop = split->point1;
outlines->next->ComputeBoundingBox();
outlines = outlines->next;
outlines->next = new TESSLINE;
outlines->next->loop = split->point2;
outlines->next->ComputeBoundingBox();
outlines->next->next = NULL;
}
void make_split_blobs ( TBLOB blob,
TBLOB other_blob,
bool  italic_blob,
SEAM seam 
)

Definition at line 135 of file makechop.cpp.

{
form_two_blobs (blob, other_blob, italic_blob, seam->location);
}
void make_triple_split ( TBLOB blob,
TBLOB other_blob,
bool  italic_blob,
SEAM seam 
)

Definition at line 151 of file makechop.cpp.

{
form_two_blobs(blob, other_blob, italic_blob, seam->location);
}
void undo_seam ( TBLOB blob,
TBLOB other_blob,
SEAM seam 
)

Definition at line 168 of file makechop.cpp.

{
TESSLINE *outline;
if (!seam)
return; /* Append other blob outlines */
if (blob->outlines == NULL) {
blob->outlines = other_blob->outlines;
other_blob->outlines = NULL;
}
outline = blob->outlines;
while (outline->next)
outline = outline->next;
outline->next = other_blob->outlines;
other_blob->outlines = NULL;
delete other_blob;
if (seam->split1 == NULL) {
}
else if (seam->split2 == NULL) {
undo_single_split (blob, seam->split1);
}
else if (seam->split3 == NULL) {
undo_single_split (blob, seam->split1);
undo_single_split (blob, seam->split2);
}
else {
undo_single_split (blob, seam->split3);
undo_single_split (blob, seam->split2);
undo_single_split (blob, seam->split1);
}
}
void undo_single_split ( TBLOB blob,
SPLIT split 
)

Definition at line 211 of file makechop.cpp.

{
TESSLINE *outline1;
TESSLINE *outline2;
/* Modify edge points */
unsplit_outlines (split->point1, split->point2);
outline1 = new TESSLINE;
outline1->next = blob->outlines;
blob->outlines = outline1;
outline1->loop = split->point1;
outline2 = new TESSLINE;
outline2->next = blob->outlines;
blob->outlines = outline2;
outline2->loop = split->point2;
}