mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
convert to CRLF line endings
This commit is contained in:
+23
-23
@@ -332,8 +332,8 @@ Image BleedEdgedImage::generate(const Options& opt) {
|
||||
}
|
||||
bool is_landscape = w > h;
|
||||
int dw = int(w * (horizontal_size > 0.0 ? horizontal_size : is_landscape ? 0.037 : 0.048));
|
||||
int dh = int(h * (vertical_size > 0.0 ? vertical_size : is_landscape ? 0.048 : 0.037));
|
||||
dw = min(w-1, max(0, dw));
|
||||
int dh = int(h * (vertical_size > 0.0 ? vertical_size : is_landscape ? 0.048 : 0.037));
|
||||
dw = min(w-1, max(0, dw));
|
||||
dh = min(h-1, max(0, dh));
|
||||
if (dw <= 0 && dh <= 0) {
|
||||
return base_img;
|
||||
@@ -680,32 +680,32 @@ bool ImageValueToImage::operator == (const GeneratedImage& that) const {
|
||||
// ----------------------------------------------------------------------------- : ImportedImage
|
||||
|
||||
ImportedImage::ImportedImage(Set* set, const String& filepath)
|
||||
{
|
||||
loadpath = filepath;
|
||||
{
|
||||
loadpath = filepath;
|
||||
|
||||
// has the set already been saved at least once?
|
||||
if (set->needSaveAs()) throw ScriptError(_ERROR_1_("can't import image without set", loadpath));
|
||||
|
||||
// does the file pointed to by filepath exist?
|
||||
if (!wxFileName(loadpath, wxPATH_UNIX).FileExists()) throw ScriptError(_ERROR_1_("import not found", loadpath));
|
||||
|
||||
if (!wxFileName(loadpath, wxPATH_UNIX).FileExists()) throw ScriptError(_ERROR_1_("import not found", loadpath));
|
||||
|
||||
// is the file an image?
|
||||
Image img;
|
||||
img.LoadFile(loadpath);
|
||||
if (!img.IsOk()) throw ScriptError(_ERROR_1_("import not image", loadpath));
|
||||
Image img;
|
||||
img.LoadFile(loadpath);
|
||||
if (!img.IsOk()) throw ScriptError(_ERROR_1_("import not image", loadpath));
|
||||
|
||||
// add the file to the set (or overwrite it if pre-existing), save set
|
||||
savename = normalize_internal_filename(loadpath);
|
||||
savename.Replace(":", "-");
|
||||
savename.Replace("/", "-");
|
||||
auto outStream = set->openOut(savename);
|
||||
auto outStream = set->openOut(savename);
|
||||
img.SaveFile(*outStream, wxBITMAP_TYPE_PNG);
|
||||
if (!outStream->IsOk()) throw ScriptError(_ERROR_1_("can't write image to set", loadpath));
|
||||
outStream->Close();
|
||||
set->save(false);
|
||||
}
|
||||
|
||||
Image ImportedImage::generate(const Options& opt) {
|
||||
Image ImportedImage::generate(const Options& opt) {
|
||||
auto imageInputStream = opt.local_package->openIn(savename);
|
||||
Image img(*imageInputStream, wxBITMAP_TYPE_PNG);
|
||||
|
||||
@@ -722,34 +722,34 @@ bool ImportedImage::operator == (const GeneratedImage& that) const {
|
||||
// ----------------------------------------------------------------------------- : DownloadedImage
|
||||
|
||||
DownloadedImage::DownloadedImage(Set* set, const String& url)
|
||||
{
|
||||
loadpath = url;
|
||||
{
|
||||
loadpath = url;
|
||||
|
||||
// has the set already been saved at least once?
|
||||
if (set->needSaveAs()) throw ScriptError(_ERROR_1_("can't download image without set", loadpath));
|
||||
|
||||
// can we download the data?
|
||||
|
||||
// can we download the data?
|
||||
WebRequestWindow wnd(loadpath);
|
||||
if (wnd.ShowModal() != wxID_OK) throw ScriptError(_ERROR_1_("can't download image", loadpath));
|
||||
|
||||
// is the data an image?
|
||||
const String& content_type = wnd.out.GetContentType();
|
||||
if (!content_type.StartsWith(_("image"))) throw ScriptError(_ERROR_1_("download not image", loadpath));
|
||||
if (wnd.ShowModal() != wxID_OK) throw ScriptError(_ERROR_1_("can't download image", loadpath));
|
||||
|
||||
// is the data an image?
|
||||
const String& content_type = wnd.out.GetContentType();
|
||||
if (!content_type.StartsWith(_("image"))) throw ScriptError(_ERROR_1_("download not image", loadpath));
|
||||
Image img(*wnd.out.GetStream());
|
||||
if (!img.IsOk()) throw ScriptError(_ERROR_("web request corrupted"));
|
||||
if (!img.IsOk()) throw ScriptError(_ERROR_("web request corrupted"));
|
||||
|
||||
// add the file to the set (or overwrite it if pre-existing), save set
|
||||
savename = normalize_internal_filename(loadpath);
|
||||
savename.Replace(":", "-");
|
||||
savename.Replace("/", "-");
|
||||
auto outStream = set->openOut(savename);
|
||||
auto outStream = set->openOut(savename);
|
||||
img.SaveFile(*outStream, wxBITMAP_TYPE_PNG);
|
||||
if (!outStream->IsOk()) throw ScriptError(_ERROR_1_("can't write image to set", loadpath));
|
||||
outStream->Close();
|
||||
set->save(false);
|
||||
}
|
||||
|
||||
Image DownloadedImage::generate(const Options& opt) {
|
||||
Image DownloadedImage::generate(const Options& opt) {
|
||||
auto imageInputStream = opt.local_package->openIn(savename);
|
||||
Image img(*imageInputStream, wxBITMAP_TYPE_PNG);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user