diff --git a/data/pref.xml b/data/pref.xml
index 5f7300bf6..efc59fe57 100644
--- a/data/pref.xml
+++ b/data/pref.xml
@@ -295,6 +295,10 @@
+
diff --git a/data/strings/en.ini b/data/strings/en.ini
index bb8b31f2e..130c5b7b3 100644
--- a/data/strings/en.ini
+++ b/data/strings/en.ini
@@ -1046,6 +1046,7 @@ overwrite_files_on_export_alert = Show warning when overwriting files on File >
overwrite_files_on_export_sprite_sheet_alert = Show warning when overwriting files on Export Sprite Sheet
gif_options_alert = Show GIF options when saving .gif files
jpeg_options_alert = Show JPEG options when saving .jpeg files
+svg_options_alert = Show SVG options when saving .svg files
advanced_mode_alert = Show alert when we enter to Advanced Mode
invalid_fg_bg_color_alert = Show alert when drawing with index out of palette bounds
run_script_alert = Show alert when we try to run a script
@@ -1234,6 +1235,10 @@ percentage = Percentage:
interpolation = Interpolation:
method = Method:
+[svg_options]
+title = SVG Options
+pixel_scale = Pixel Scale:
+
[tab_popup_menu]
close = &Close
diff --git a/data/widgets/options.xml b/data/widgets/options.xml
index f7ea41586..6e6acb97d 100644
--- a/data/widgets/options.xml
+++ b/data/widgets/options.xml
@@ -362,7 +362,9 @@
+ pref="jpeg.show_alert" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/file/svg_format.cpp b/src/app/file/svg_format.cpp
index d269e1868..e64b7765d 100644
--- a/src/app/file/svg_format.cpp
+++ b/src/app/file/svg_format.cpp
@@ -9,19 +9,32 @@
#include "config.h"
#endif
+#include "app/console.h"
+#include "app/context.h"
#include "app/doc.h"
#include "app/file/file.h"
#include "app/file/file_format.h"
#include "app/file/format_options.h"
+#include "app/pref/preferences.h"
#include "base/cfile.h"
#include "base/file_handle.h"
#include "doc/doc.h"
+#include "ui/window.h"
+
+#include "svg_options.xml.h"
namespace app {
using namespace base;
class SvgFormat : public FileFormat {
+ // Data for SVG files
+ class SvgOptions : public FormatOptions {
+ public:
+ SvgOptions() : pixelScale(1) { }
+ int pixelScale;
+ };
+
const char* onGetName() const override {
return "svg";
}
@@ -40,14 +53,17 @@ class SvgFormat : public FileFormat {
FILE_SUPPORT_RGB |
FILE_SUPPORT_RGBA |
FILE_SUPPORT_GRAY |
+ FILE_SUPPORT_GRAYA |
FILE_SUPPORT_INDEXED |
- FILE_SUPPORT_SEQUENCES;
+ FILE_SUPPORT_SEQUENCES |
+ FILE_SUPPORT_GET_FORMAT_OPTIONS;
}
bool onLoad(FileOp* fop) override;
#ifdef ENABLE_SAVE
bool onSave(FileOp* fop) override;
#endif
+ base::SharedPtr onGetFormatOptions(FileOp* fop) override;
};
FileFormat* CreateSvgFormat()
@@ -63,17 +79,20 @@ bool SvgFormat::onSave(FileOp* fop)
{
const Image* image = fop->sequenceImage();
int x, y, c, r, g, b, a, alpha;
+ const base::SharedPtr svg_options = fop->formatOptions();
+ const int pixelScaleValue = MID(0, svg_options->pixelScale, 10000);
FileHandle handle(open_file_with_exception_sync_on_close(fop->filename(), "wb"));
FILE* f = handle.get();
- auto printcol = [f](int x, int y, int r, int g, int b, int a) {
- fprintf(f, "\n");
};
fprintf(f, "\n");
fprintf(f, "