mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
add bleed edge option, get_card_export_settings function
This commit is contained in:
+1
-1
@@ -31,7 +31,7 @@ const Radians rad360 = 2.0*M_PI;
|
||||
|
||||
/// Are two floating point numbers equal up to a small epsilon?
|
||||
inline bool almost_equal(double x, double y) {
|
||||
return fabs(x-y) < 1e-10;
|
||||
return fabs(x-y) < 1e-5;
|
||||
}
|
||||
inline bool is_rad0(double x) {
|
||||
return almost_equal(x,0) || almost_equal(x,rad360);
|
||||
|
||||
+23
-17
@@ -54,42 +54,48 @@ public:
|
||||
inline String const& toStringForKey() const { return fn; }
|
||||
|
||||
/// Retreive a rect from a filename
|
||||
inline static wxRect getExternalRect(const String& filename) {
|
||||
inline static void getExternalRect(const String& filename, wxRect& rect_out, int& degrees_out) {
|
||||
size_t first = filename.find(_("---"));
|
||||
if (first == String::npos) return wxRect();
|
||||
if (first == String::npos) return;
|
||||
size_t last = filename.find(_("---"), first+3);
|
||||
if (last == String::npos) return wxRect();
|
||||
if (last == String::npos) return;
|
||||
String string = filename.substr(first + 3, last - (first + 3));
|
||||
if (string.empty()) return wxRect();
|
||||
if (string.empty()) return;
|
||||
|
||||
size_t divider = string.find(_("-"));
|
||||
if (divider == String::npos) return wxRect();
|
||||
if (divider == 0) return wxRect();
|
||||
if (divider == String::npos) return;
|
||||
if (divider == 0) return;
|
||||
int x;
|
||||
if(!string.substr(0, divider).ToInt(&x)) return wxRect();
|
||||
if(!string.substr(0, divider).ToInt(&x)) return;
|
||||
string = string.substr(divider + 1);
|
||||
|
||||
divider = string.find(_("-"));
|
||||
if (divider == String::npos) return wxRect();
|
||||
if (divider == 0) return wxRect();
|
||||
if (divider == String::npos) return;
|
||||
if (divider == 0) return;
|
||||
int y;
|
||||
if(!string.substr(0, divider).ToInt(&y)) return wxRect();
|
||||
if(!string.substr(0, divider).ToInt(&y)) return;
|
||||
string = string.substr(divider + 1);
|
||||
|
||||
divider = string.find(_("-"));
|
||||
if (divider == String::npos) return wxRect();
|
||||
if (divider == 0) return wxRect();
|
||||
if (divider == String::npos) return;
|
||||
if (divider == 0) return;
|
||||
int width;
|
||||
if(!string.substr(0, divider).ToInt(&width)) return wxRect();
|
||||
if(!string.substr(0, divider).ToInt(&width)) return;
|
||||
string = string.substr(divider + 1);
|
||||
|
||||
divider = string.find(_("-"));
|
||||
if (divider == String::npos) return;
|
||||
if (divider == 0) return;
|
||||
int height;
|
||||
if(!string.ToInt(&height)) return wxRect();
|
||||
if(!string.substr(0, divider).ToInt(&height)) return;
|
||||
string = string.substr(divider + 1);
|
||||
|
||||
return wxRect(x, y, width, height);
|
||||
if(!string.ToInt(°rees_out)) return;
|
||||
|
||||
rect_out = wxRect(x, y, width, height);
|
||||
}
|
||||
inline wxRect getExternalRect() {
|
||||
return getExternalRect(fn);
|
||||
inline void getExternalRect(wxRect& rect_out, int& degrees_out) {
|
||||
getExternalRect(fn, rect_out, degrees_out);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -75,7 +75,7 @@ RealSize Rotation::trSizeToBB(const RealSize& size) const {
|
||||
}
|
||||
|
||||
RealRect Rotation::trRectToBB(const RealRect& r) const {
|
||||
const bool special_case_optimization = false;
|
||||
const bool special_case_optimization = true;
|
||||
double x = r.x * zoomX, y = r.y * zoomY;
|
||||
double w = r.width * zoomX, h = r.height * zoomY;
|
||||
if (special_case_optimization && is_rad0(angle)) {
|
||||
|
||||
@@ -310,7 +310,7 @@ enum ControlID {
|
||||
ID_SHARPEN,
|
||||
ID_SHARPEN_AMOUNT,
|
||||
// Internal window
|
||||
ID_INTERNAL_SCALE,
|
||||
ID_IMPORT_ZOOM,
|
||||
// Updates window
|
||||
ID_PACKAGE_LIST,
|
||||
ID_KEEP,
|
||||
|
||||
Reference in New Issue
Block a user