mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
add bleed edge option, get_card_export_settings function
This commit is contained in:
@@ -303,9 +303,12 @@ bool CardListBase::parseImage(Image& image, vector<CardP>& out) {
|
||||
for (IndexMap<FieldP, ValueP>::iterator it = card->data.begin(); it != card->data.end(); it++) {
|
||||
ImageValue* value = dynamic_cast<ImageValue*>(it->get());
|
||||
if (value && !value->filename.empty()) {
|
||||
wxRect rect = value->filename.getExternalRect();
|
||||
wxRect rect = wxRect(0,0,0,0);
|
||||
int degrees = 0;
|
||||
value->filename.getExternalRect(rect, degrees);
|
||||
if (rect.width > 0 && rect.height > 0) {
|
||||
Image& img = image.GetSubImage(rect);
|
||||
img = rotate_image(img, deg_to_rad(360-degrees));
|
||||
LocalFileName filename = set->newFileName((*it)->fieldP->name, settings.internal_image_extension ? _(".png") : _("")); // a new unique name in the package
|
||||
img.SaveFile(set->nameOut(filename), wxBITMAP_TYPE_PNG);
|
||||
value->filename = filename;
|
||||
@@ -319,8 +322,8 @@ bool CardListBase::parseImage(Image& image, vector<CardP>& out) {
|
||||
|
||||
bool CardListBase::parseText(String& text, vector<CardP>& out) {
|
||||
size_t j = out.size();
|
||||
if (size_t pos = text.find("<mse-data-start>") != wxString::npos) {
|
||||
text = text.substr(pos + 15, text.find("<mse-data-end>") - pos - 15);
|
||||
if (size_t pos = text.find("<mse-card-data>") != wxString::npos) {
|
||||
text = text.substr(pos + 14, text.find("</mse-card-data>") - pos - 14);
|
||||
}
|
||||
try {
|
||||
ScriptValueP& sv = json_to_mse(text, set.get());
|
||||
|
||||
@@ -71,13 +71,12 @@ void ImageSlice::centerSelectionVertically() {
|
||||
}
|
||||
}
|
||||
|
||||
Image ImageSlice::getSlice(double scale) const {
|
||||
wxSize scaled_target_size = target_size * scale;
|
||||
if (selection.width == scaled_target_size.GetWidth() && selection.height == scaled_target_size.GetHeight() && selection.x == 0 && selection.y == 0) {
|
||||
Image ImageSlice::getSlice() const {
|
||||
if (selection.width == target_size.GetWidth() && selection.height == target_size.GetHeight() && selection.x == 0 && selection.y == 0) {
|
||||
// exactly the right size
|
||||
return source.GetSubImage(selection);
|
||||
}
|
||||
Image target(scaled_target_size.GetWidth(), scaled_target_size.GetHeight(), false);
|
||||
Image target(target_size.GetWidth(), target_size.GetHeight(), false);
|
||||
if (sharpen && sharpen_amount > 0 && sharpen_amount <= 100) {
|
||||
sharp_resample_and_clip(source, target, selection, sharpen_amount);
|
||||
} else {
|
||||
@@ -104,7 +103,6 @@ ImageSliceWindow::ImageSliceWindow(Window* parent, const Image& source, const St
|
||||
// init slice
|
||||
pair<String, String> settings_entry = { filename, cardname };
|
||||
if (previously_used_settings_value.find(settings_entry) != previously_used_settings_value.end()) {
|
||||
//slice.allow_outside = true; this currrently crashes
|
||||
slice.aspect_fixed = false;
|
||||
slice.sharpen = true;
|
||||
slice.sharpen_amount = previously_used_settings_value[settings_entry].second;
|
||||
@@ -242,8 +240,8 @@ void ImageSliceWindow::onOk(wxCommandEvent&) {
|
||||
EndModal(wxID_OK);
|
||||
}
|
||||
|
||||
Image ImageSliceWindow::getImage(double scale) const {
|
||||
Image img = slice.getSlice(scale);
|
||||
Image ImageSliceWindow::getImage() const {
|
||||
Image img = slice.getSlice();
|
||||
previously_used_settings_path[slice.card_name] = slice.source_path;
|
||||
previously_used_settings_value[{ slice.source_path, slice.card_name }] = { slice.selection, slice.sharpen_amount };
|
||||
return img;
|
||||
@@ -484,11 +482,12 @@ void ImageSlicePreview::draw(DC& dc) {
|
||||
assert(image.GetWidth() == slice.target_size.GetWidth() && image.GetHeight() == slice.target_size.GetHeight());
|
||||
mask.setAlpha(image);
|
||||
if (image.HasAlpha()) {
|
||||
// create bitmap
|
||||
bitmap = Bitmap(image.GetWidth(), image.GetHeight());
|
||||
// create bitmap
|
||||
int width = image.GetWidth(), height = image.GetHeight();
|
||||
bitmap = Bitmap(width, height);
|
||||
wxMemoryDC mdc; mdc.SelectObject(bitmap);
|
||||
// draw checker pattern behind image
|
||||
RealRect rect = (RealRect) GetClientSize();
|
||||
RealRect rect = RealRect(0, 0, width, height);
|
||||
RotatedDC rdc(mdc, 0, rect, 1, QUALITY_LOW);
|
||||
draw_checker(rdc, rect);
|
||||
rdc.DrawImage(image, RealPoint(0,0));
|
||||
@@ -587,7 +586,6 @@ ImageSliceSelector::ImageSliceSelector(Window* parent, int id, ImageSlice& slice
|
||||
, slice(slice)
|
||||
, mouse_down(false)
|
||||
{
|
||||
|
||||
float target_ratio = ((float) slice.source.GetWidth()) / ((float) slice.source.GetHeight());
|
||||
if (target_ratio > 1.0) {
|
||||
SetMinSize(wxSize(500, 500 / target_ratio));
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
wxSize target_size; ///< Size of the target image
|
||||
wxRect selection; ///< Area to slice from source
|
||||
Color background; ///< Color for areas outside the source image
|
||||
bool allow_outside; ///< Allow the slice to extend outside the source image?
|
||||
bool allow_outside; ///< Allow the slice to extend outside the source image? TODO: This currently crashes
|
||||
bool aspect_fixed; ///< Aspect ratio lock?
|
||||
|
||||
// Filters
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
void centerSelectionHorizontally();
|
||||
void centerSelectionVertically();
|
||||
/// Get the sliced image
|
||||
Image getSlice(double scale = 1.0) const;
|
||||
Image getSlice() const;
|
||||
|
||||
// Zoom factor
|
||||
inline double zoomX() const { return target_size.GetWidth() / (double)selection.width; }
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
ImageSliceWindow(Window* parent, const Image& source, const String& filename, const String& cardname, const wxSize& target_size, const AlphaMask& target_mask);
|
||||
|
||||
/// Return the sliced image
|
||||
Image getImage(double scale) const;
|
||||
Image getImage() const;
|
||||
|
||||
// --------------------------------------------------- : Previously Used Settings
|
||||
|
||||
|
||||
@@ -52,27 +52,25 @@ public:
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
wxCheckBox* high_quality, *borders, *draw_editing, *spellcheck_enabled, *non_normal_export, *notes_export;
|
||||
wxCheckBox* high_quality, *borders, *draw_editing, *spellcheck_enabled;
|
||||
|
||||
wxComboBox* zoom;
|
||||
int zoom_int;
|
||||
|
||||
wxChoice* export_zoom;
|
||||
|
||||
void onSelectColumns(wxCommandEvent&);
|
||||
void onZoomChange(wxCommandEvent&);
|
||||
void updateZoom();
|
||||
};
|
||||
|
||||
class InternalPreferencesPage : public PreferencesPage {
|
||||
class TransfersPreferencesPage : public PreferencesPage {
|
||||
public:
|
||||
InternalPreferencesPage(Window* parent);
|
||||
TransfersPreferencesPage(Window* parent);
|
||||
void store() override;
|
||||
|
||||
private:
|
||||
wxCheckBox* internal_image_extension;
|
||||
wxCheckBox* non_normal_export, *bleed_export, *notes_export, *internal_image_extension;
|
||||
|
||||
wxChoice* internal_scale;
|
||||
wxChoice* export_scale, *import_scale;
|
||||
};
|
||||
|
||||
// Preferences page for directories of programs
|
||||
@@ -116,7 +114,7 @@ PreferencesWindow::PreferencesWindow(Window* parent)
|
||||
wxNotebook* nb = new wxNotebook(this, ID_NOTEBOOK);
|
||||
nb->AddPage(new GlobalPreferencesPage (nb), _TITLE_("global"));
|
||||
nb->AddPage(new DisplayPreferencesPage(nb), _TITLE_("display"));
|
||||
nb->AddPage(new InternalPreferencesPage(nb), _TITLE_("internal"));
|
||||
nb->AddPage(new TransfersPreferencesPage(nb), _TITLE_("transfers"));
|
||||
nb->AddPage(new DirsPreferencesPage (nb), _TITLE_("directories"));
|
||||
nb->AddPage(new UpdatePreferencesPage (nb), _TITLE_("updates"));
|
||||
|
||||
@@ -216,34 +214,18 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent)
|
||||
borders = new wxCheckBox(this, wxID_ANY, _BUTTON_("show lines"));
|
||||
draw_editing = new wxCheckBox(this, wxID_ANY, _BUTTON_("show editing hints"));
|
||||
spellcheck_enabled = new wxCheckBox(this, wxID_ANY, _BUTTON_("spellcheck enabled"));
|
||||
non_normal_export = new wxCheckBox(this, wxID_ANY, _BUTTON_("rotation export"));
|
||||
notes_export = new wxCheckBox(this, wxID_ANY, _BUTTON_("notes export"));
|
||||
zoom = new wxComboBox(this, ID_ZOOM);
|
||||
export_zoom = new wxChoice (this, ID_EXPORT_ZOOM);
|
||||
|
||||
//wxButton* columns = new wxButton(this, ID_SELECT_COLUMNS, _BUTTON_("select"));
|
||||
// set values
|
||||
high_quality-> SetValue( settings.default_stylesheet_settings.card_anti_alias());
|
||||
borders-> SetValue( settings.default_stylesheet_settings.card_borders());
|
||||
draw_editing-> SetValue( settings.default_stylesheet_settings.card_draw_editing());
|
||||
spellcheck_enabled->SetValue( settings.default_stylesheet_settings.card_spellcheck_enabled());
|
||||
non_normal_export-> SetValue(!settings.default_stylesheet_settings.card_normal_export());
|
||||
notes_export-> SetValue( settings.default_stylesheet_settings.card_notes_export());
|
||||
zoom_int = static_cast<int>(settings.default_stylesheet_settings.card_zoom() * 100);
|
||||
zoom->SetValue(String::Format(_("%d%%"),zoom_int));
|
||||
for (int i : Settings::export_zoom_choices) {
|
||||
zoom->Append(String::Format(_("%d%%"), i));
|
||||
}
|
||||
|
||||
export_zoom->Append(_LABEL_("export around 300"));
|
||||
export_zoom->Append(_LABEL_("export force 300"));
|
||||
export_zoom->Append(_LABEL_("export force 150"));
|
||||
for (int i : Settings::export_zoom_choices) {
|
||||
export_zoom->Append(String::Format(_("%d%%"), i));
|
||||
}
|
||||
int default_export_zoom = settings.default_stylesheet_settings.export_zoom_selection();
|
||||
if (default_export_zoom < 0 || default_export_zoom > export_zoom->GetCount() - 1) default_export_zoom = 0;
|
||||
export_zoom->SetSelection(default_export_zoom);
|
||||
zoom_int = static_cast<int>( settings.default_stylesheet_settings.card_zoom() * 100);
|
||||
zoom->SetValue(String::Format(_("%d%%"),zoom_int));
|
||||
for (int i : Settings::scale_choices) {
|
||||
zoom->Append(String::Format(_("%d%%"), i));
|
||||
}
|
||||
|
||||
// init sizer
|
||||
wxSizer* s = new wxBoxSizer(wxVERTICAL);
|
||||
@@ -257,19 +239,8 @@ DisplayPreferencesPage::DisplayPreferencesPage(Window* parent)
|
||||
s3->AddSpacer(2);
|
||||
s3->Add(zoom);
|
||||
s3->Add(new wxStaticText(this, wxID_ANY, _LABEL_("percent of normal")),1, wxALL & ~wxRIGHT, 4);
|
||||
wxSizer* s4 = new wxBoxSizer(wxHORIZONTAL);
|
||||
s4->Add(new wxStaticText(this, wxID_ANY, _LABEL_("export")), 0, wxALL & ~wxLEFT, 4);
|
||||
s4->AddSpacer(2);
|
||||
s4->Add(export_zoom);
|
||||
//s4->Add(new wxStaticText(this, wxID_ANY, _LABEL_("percent of normal")), 1, wxALL & ~wxRIGHT, 4);
|
||||
|
||||
s2->Add(s3, 0, wxEXPAND | wxALL, 4);
|
||||
s2->Add(s4, 0, wxEXPAND | wxALL, 4);
|
||||
s2->Add(non_normal_export, 0, wxEXPAND | wxALL, 4);
|
||||
s2->Add(notes_export, 0, wxEXPAND | wxALL, 4);
|
||||
|
||||
s->Add(s2, 0, wxEXPAND | wxALL, 8);
|
||||
|
||||
s->SetSizeHints(this);
|
||||
SetSizer(s);
|
||||
}
|
||||
@@ -279,12 +250,9 @@ void DisplayPreferencesPage::store() {
|
||||
settings.default_stylesheet_settings.card_borders = borders->GetValue();
|
||||
settings.default_stylesheet_settings.card_draw_editing = draw_editing->GetValue();
|
||||
settings.default_stylesheet_settings.card_spellcheck_enabled = spellcheck_enabled->GetValue();
|
||||
settings.default_stylesheet_settings.card_normal_export = !non_normal_export->GetValue();
|
||||
settings.default_stylesheet_settings.card_notes_export = notes_export->GetValue();
|
||||
|
||||
updateZoom();
|
||||
settings.default_stylesheet_settings.card_zoom = zoom_int / 100.0;
|
||||
settings.default_stylesheet_settings.export_zoom_selection = export_zoom->GetSelection();
|
||||
}
|
||||
|
||||
void DisplayPreferencesPage::onSelectColumns(wxCommandEvent&) {
|
||||
@@ -292,7 +260,7 @@ void DisplayPreferencesPage::onSelectColumns(wxCommandEvent&) {
|
||||
}
|
||||
|
||||
void DisplayPreferencesPage::onZoomChange(wxCommandEvent&) {
|
||||
updateZoom();
|
||||
updateZoom();
|
||||
}
|
||||
|
||||
void DisplayPreferencesPage::updateZoom() {
|
||||
@@ -312,41 +280,78 @@ END_EVENT_TABLE ()
|
||||
|
||||
// ----------------------------------------------------------------------------- : Preferences page : internal
|
||||
|
||||
InternalPreferencesPage::InternalPreferencesPage(Window* parent) : PreferencesPage(parent) {
|
||||
TransfersPreferencesPage::TransfersPreferencesPage(Window* parent) : PreferencesPage(parent) {
|
||||
// init controls
|
||||
non_normal_export = new wxCheckBox(this, wxID_ANY, _BUTTON_("rotation export"));
|
||||
bleed_export = new wxCheckBox(this, wxID_ANY, _BUTTON_("bleed export"));
|
||||
notes_export = new wxCheckBox(this, wxID_ANY, _BUTTON_("notes export"));
|
||||
export_scale = new wxChoice (this, ID_EXPORT_ZOOM);
|
||||
|
||||
internal_image_extension = new wxCheckBox(this, wxID_ANY, _BUTTON_("internal image extension"));
|
||||
internal_scale = new wxChoice(this, ID_INTERNAL_SCALE);
|
||||
import_scale = new wxChoice (this, ID_IMPORT_ZOOM);
|
||||
|
||||
// set values
|
||||
non_normal_export-> SetValue(!settings.default_stylesheet_settings.card_normal_export());
|
||||
bleed_export-> SetValue( settings.default_stylesheet_settings.card_bleed_export());
|
||||
notes_export-> SetValue( settings.default_stylesheet_settings.card_notes_export());
|
||||
export_scale->Append(_LABEL_("export around 300"));
|
||||
export_scale->Append(_LABEL_("export force 300"));
|
||||
export_scale->Append(_LABEL_("export force 150"));
|
||||
for (int i : Settings::scale_choices) {
|
||||
export_scale->Append(String::Format(_("%d%%"), i));
|
||||
}
|
||||
int default_export_scale = settings.default_stylesheet_settings.export_scale_selection();
|
||||
if (default_export_scale < 0 || default_export_scale > export_scale->GetCount() - 1) default_export_scale = 0;
|
||||
export_scale->SetSelection(default_export_scale);
|
||||
|
||||
internal_image_extension->SetValue(settings.internal_image_extension);
|
||||
|
||||
internal_scale->Append(_LABEL_("use export scale"));
|
||||
internal_scale->Append(_LABEL_("export around 300"));
|
||||
internal_scale->Append(_LABEL_("export force 300"));
|
||||
internal_scale->Append(_LABEL_("export force 150"));
|
||||
for (int i : Settings::export_zoom_choices) {
|
||||
internal_scale->Append(String::Format(_("%d%%"), i));
|
||||
import_scale->Append(_LABEL_("use export scale"));
|
||||
import_scale->Append(_LABEL_("export around 300"));
|
||||
import_scale->Append(_LABEL_("export force 300"));
|
||||
import_scale->Append(_LABEL_("export force 150"));
|
||||
for (int i : Settings::scale_choices) {
|
||||
import_scale->Append(String::Format(_("%d%%"), i));
|
||||
}
|
||||
int default_internal_scale = settings.internal_scale_selection;
|
||||
if (default_internal_scale < 0 || default_internal_scale > internal_scale->GetCount() - 1) default_internal_scale = 0;
|
||||
internal_scale->SetSelection(default_internal_scale);
|
||||
|
||||
wxSizer* s = new wxBoxSizer(wxVERTICAL);
|
||||
wxSizer* s2 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("storage"));
|
||||
wxSizer* s3 = new wxBoxSizer(wxHORIZONTAL);
|
||||
s3->Add(new wxStaticText(this, wxID_ANY, _LABEL_("scale")), 0, wxALL & ~wxLEFT, 4);
|
||||
s3->AddSpacer(2);
|
||||
s3->Add(internal_scale);
|
||||
//s3->Add(new wxStaticText(this, wxID_ANY, _LABEL_("percent of normal")), 1, wxALL & ~wxRIGHT, 4);
|
||||
s2->Add(s3);
|
||||
s2->Add(new wxStaticText(this, wxID_ANY, _LABEL_("internal scale desc")), 0, wxALL & ~wxLEFT, 4);
|
||||
s2->Add(internal_image_extension, 0, wxEXPAND | wxALL, 4);
|
||||
s->Add(s2, 0, wxEXPAND | wxALL, 8);
|
||||
int default_import_scale = settings.import_scale_selection;
|
||||
if (default_import_scale < 0 || default_import_scale > import_scale->GetCount() - 1) default_import_scale = 0;
|
||||
import_scale->SetSelection(default_import_scale);
|
||||
|
||||
// init sizers
|
||||
wxSizer* s = new wxBoxSizer(wxVERTICAL);
|
||||
wxSizer* s2 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("export"));
|
||||
s2->Add(new wxStaticText(this, wxID_ANY, _LABEL_("export desc")), 0, wxALL & ~wxLEFT, 4);
|
||||
wxSizer* s3 = new wxBoxSizer(wxHORIZONTAL);
|
||||
s3->Add(new wxStaticText(this, wxID_ANY, _LABEL_("scale")), 0, wxALL & ~wxLEFT, 4);
|
||||
s3->AddSpacer(2);
|
||||
s3->Add(export_scale);
|
||||
s2->Add(s3, 0, wxEXPAND | wxALL, 4);
|
||||
s2->Add(non_normal_export, 0, wxEXPAND | wxALL, 4);
|
||||
s2->Add(bleed_export, 0, wxEXPAND | wxALL, 4);
|
||||
s2->Add(notes_export, 0, wxEXPAND | wxALL, 4);
|
||||
wxSizer* s5 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("import"));
|
||||
s5->Add(new wxStaticText(this, wxID_ANY, _LABEL_("import desc")), 0, wxALL & ~wxLEFT, 4);
|
||||
wxSizer* s6 = new wxBoxSizer(wxHORIZONTAL);
|
||||
s6->Add(new wxStaticText(this, wxID_ANY, _LABEL_("scale")), 0, wxALL & ~wxLEFT, 4);
|
||||
s6->AddSpacer(2);
|
||||
s6->Add(import_scale);
|
||||
s5->Add(s6, 0, wxEXPAND | wxALL & ~wxBottom, 4);
|
||||
s5->Add(new wxStaticText(this, wxID_ANY, _LABEL_("internal scale desc")), 0, wxALL & ~wxTOP, 4);
|
||||
s5->Add(internal_image_extension, 0, wxEXPAND | wxALL, 4);
|
||||
s->Add(s2, 0, wxEXPAND | wxALL, 8);
|
||||
s->Add(s5, 0, wxEXPAND | wxALL, 8);
|
||||
export_scale->SetFocus();
|
||||
s->SetSizeHints(this);
|
||||
SetSizer(s);
|
||||
}
|
||||
|
||||
void InternalPreferencesPage::store() {
|
||||
settings.internal_image_extension = internal_image_extension->GetValue();
|
||||
settings.internal_scale_selection = internal_scale->GetSelection();
|
||||
void TransfersPreferencesPage::store() {
|
||||
settings.default_stylesheet_settings.card_normal_export = !non_normal_export->GetValue();
|
||||
settings.default_stylesheet_settings.card_bleed_export = bleed_export->GetValue();
|
||||
settings.default_stylesheet_settings.card_notes_export = notes_export->GetValue();
|
||||
settings.default_stylesheet_settings.export_scale_selection = export_scale->GetSelection();
|
||||
|
||||
settings.internal_image_extension = internal_image_extension->GetValue();
|
||||
settings.import_scale_selection = import_scale->GetSelection();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Preferences page : directories
|
||||
|
||||
+12
-19
@@ -50,31 +50,24 @@ bool ImageValueEditor::onLeftDClick(const RealPoint&, wxMouseEvent&) {
|
||||
|
||||
void ImageValueEditor::sliceImage(const Image& image, const String& filename, const String& cardname) {
|
||||
if (!image.Ok()) return;
|
||||
// determine import scale based on the user's settings.
|
||||
double import_scale = 1.0;
|
||||
StyleSheetP stylesheet = editor().getCard()->stylesheet;
|
||||
if (!stylesheet) stylesheet = editor().getSet()->stylesheet;
|
||||
if (stylesheet) import_scale = settings.importScaleSettingsFor(*stylesheet);
|
||||
RealSize target_size = RealSize(style().getSize() * import_scale);
|
||||
target_size = RealSize((int)target_size.width, (int)target_size.height);
|
||||
// mask
|
||||
GeneratedImage::Options options((int)style().width, (int)style().height, &parent.getStylePackage(), &parent.getLocalPackage());
|
||||
GeneratedImage::Options options((int)target_size.width, (int)target_size.height, &parent.getStylePackage(), &parent.getLocalPackage());
|
||||
AlphaMask mask;
|
||||
style().mask.getNoCache(options,mask);
|
||||
// slice
|
||||
ImageSliceWindow s(wxGetTopLevelParent(&editor()), image, filename, cardname, style().getSize(), mask);
|
||||
style().mask.getNoCache(options, mask);
|
||||
// slice
|
||||
ImageSliceWindow s(wxGetTopLevelParent(&editor()), image, filename, cardname, target_size, mask);
|
||||
// clicked ok?
|
||||
if (s.ShowModal() == wxID_OK) {
|
||||
// store the image into the set
|
||||
LocalFileName new_image_file = getLocalPackage().newFileName(field().name, settings.internal_image_extension ? _(".png") : _("")); // a new unique name in the package
|
||||
|
||||
// Specify a desired size based on the stylesheet and a scale multiplier defined within the user's settings.
|
||||
// Storing at a greater than 100% resolution allows for better exports >100%, but may change how images look when filters (sharpen) are applied.
|
||||
// It also disrupts some of the patterns in use for doing popout planeswalkers since you have to do the math at both scales.
|
||||
// Additionally, this bloats the set file size as even under-resolution images are upscaled to the new minimum size.
|
||||
double internal_scale = 1.0;
|
||||
try {
|
||||
// surrounding this in try catch to be safe for now. maybe this is overkill
|
||||
StyleSheetP stylesheet = editor().getCard()->stylesheet;
|
||||
if (!stylesheet) stylesheet = editor().getSet()->stylesheet;
|
||||
internal_scale = settings.internalScaleSettingsFor(*stylesheet);
|
||||
} catch (...) {
|
||||
queue_message(MESSAGE_ERROR, _("Could not find stylesheet to determine export zoom.\nfilename: " + filename + _("\ncardname: " + cardname)));
|
||||
}
|
||||
Image img = s.getImage(internal_scale);
|
||||
Image img = s.getImage();
|
||||
img.SaveFile(getLocalPackage().nameOut(new_image_file), wxBITMAP_TYPE_PNG); // always use PNG images, see #69. Disk space is cheap anyway.
|
||||
addAction(value_action(valueP(), new_image_file));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user