mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 13:37:00 -04:00
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:
@@ -88,7 +88,7 @@ bool is_mse1_symbol(const Image& img) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (delta > 5000) return false; // not black & white enough
|
if (delta > 5000) return false; // not black & white enough
|
||||||
// TODO : more checks
|
// TODO : more checks?
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,7 +350,9 @@ void straighten(SymbolPart& part) {
|
|||||||
/// Remove unneeded points between straight lines
|
/// Remove unneeded points between straight lines
|
||||||
void merge_lines(SymbolPart& part) {
|
void merge_lines(SymbolPart& part) {
|
||||||
for (int i = 0 ; (size_t)i < part.points.size() ; ++i) {
|
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 ab = (a-b).normalized();
|
||||||
Vector2D bc = (b-c).normalized();
|
Vector2D bc = (b-c).normalized();
|
||||||
double angle_len = fabs( atan2(ab.x,ab.y) - atan2(bc.x,bc.y)) * (a-c).lengthSqr();
|
double angle_len = fabs( atan2(ab.x,ab.y) - atan2(bc.x,bc.y)) * (a-c).lengthSqr();
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ void SymbolWindow::onFileOpen(wxCommandEvent& ev) {
|
|||||||
Reader reader(new_shared1<wxFileInputStream>(name), name);
|
Reader reader(new_shared1<wxFileInputStream>(name), name);
|
||||||
reader.handle_greedy(symbol);
|
reader.handle_greedy(symbol);
|
||||||
} else {
|
} else {
|
||||||
|
wxBusyCursor busy;
|
||||||
Image image(name);
|
Image image(name);
|
||||||
if (!image.Ok()) return;
|
if (!image.Ok()) return;
|
||||||
symbol = import_symbol(image);
|
symbol = import_symbol(image);
|
||||||
|
|||||||
Reference in New Issue
Block a user