some fixes to image import

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@204 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-02-13 18:17:45 +00:00
parent 914f1186f2
commit f855b6a690
2 changed files with 5 additions and 2 deletions
+4 -2
View File
@@ -88,7 +88,7 @@ bool is_mse1_symbol(const Image& img) {
}
}
if (delta > 5000) return false; // not black & white enough
// TODO : more checks
// TODO : more checks?
return true;
}
@@ -350,7 +350,9 @@ void straighten(SymbolPart& part) {
/// Remove unneeded points between straight lines
void merge_lines(SymbolPart& part) {
for (int i = 0 ; (size_t)i < part.points.size() ; ++i) {
Vector2D a = part.getPoint(i-1)->pos, b = part.getPoint(i)->pos, c = part.getPoint(i+1)->pos;
ControlPoint& cur = *part.getPoint(i);
if (cur.segment_before != cur.segment_after) continue;
Vector2D a = part.getPoint(i-1)->pos, b = cur.pos, c = part.getPoint(i+1)->pos;
Vector2D ab = (a-b).normalized();
Vector2D bc = (b-c).normalized();
double angle_len = fabs( atan2(ab.x,ab.y) - atan2(bc.x,bc.y)) * (a-c).lengthSqr();
+1
View File
@@ -153,6 +153,7 @@ void SymbolWindow::onFileOpen(wxCommandEvent& ev) {
Reader reader(new_shared1<wxFileInputStream>(name), name);
reader.handle_greedy(symbol);
} else {
wxBusyCursor busy;
Image image(name);
if (!image.Ok()) return;
symbol = import_symbol(image);