Author: Diego Barrios Romero <[email protected]>
Date: Tue Mar 13 01:00:36 2012 +0100
Rendering options
---
synfig-core/src/tool/main.cpp | 128 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 128 insertions(+), 0 deletions(-)
diff --git a/synfig-core/src/tool/main.cpp b/synfig-core/src/tool/main.cpp
index 94ae383..78d0870 100644
--- a/synfig-core/src/tool/main.cpp
+++ b/synfig-core/src/tool/main.cpp
@@ -216,6 +216,131 @@ void extract_canvas_info(Job& job, string values)
};
}
+void extract_RendDesc(const po::variables_map& vm, RendDesc& desc)
+{
+ int w, h;
+ float span;
+ span = w = h = 0;
+
+ if (vm.count("width"))
+ w = vm["width"].as<int>();
+
+ if (vm.count("height"))
+ h = vm["height"].as<int>();
+
+ if (vm.count("antialias"))
+ {
+ int a;
+ a = vm["antialias"].as<int>();
+ desc.set_antialias(a);
+ VERBOSE_OUT(1) << strprintf(_("Antialiasing set to %d, "
+ "(%d
samples per pixel)"), a, a*a)
+ << endl;
+ }
+ if (vm.count("span"))
+ {
+ span = vm["antialias"].as<int>();
+ VERBOSE_OUT(1) << strprintf(_("Span set to %d units"), span)
+ << endl;
+ }
+ if (vm.count("fps"))
+ {
+ float fps;
+ fps = vm["antialias"].as<float>();
+ desc.set_frame_rate(fps);
+ VERBOSE_OUT(1) << strprintf(_("Frame rate set to %d frames per "
+
"second"), fps) << endl;
+ }
+ if (vm.count("dpi"))
+ {
+ float dpi, dots_per_meter;
+ dpi = vm["dpi"].as<float>();
+ dots_per_meter = dpi * 39.3700787402;
+ desc.set_x_res(dots_per_meter);
+ desc.set_y_res(dots_per_meter);
+ VERBOSE_OUT(1) << strprintf(_("Physical resolution set to %f "
+
"dpi"), dpi) << endl;
+ }
+ if (vm.count("dpi-x"))
+ {
+ float dpi, dots_per_meter;
+ dpi = vm["dpi-x"].as<float>();
+ dots_per_meter = dpi * 39.3700787402;
+ desc.set_x_res(dots_per_meter);
+ VERBOSE_OUT(1) << strprintf(_("Physical X resolution set to %f "
+
"dpi"), dpi) << endl;
+ }
+ if (vm.count("dpi-y"))
+ {
+ float dpi, dots_per_meter;
+ dpi = vm["dpi-y"].as<float>();
+ dots_per_meter = dpi * 39.3700787402;
+ desc.set_y_res(dots_per_meter);
+ VERBOSE_OUT(1) << strprintf(_("Physical Y resolution set to %f "
+
"dpi"), dpi) << endl;
+ }
+ if (vm.count("start-time"))
+ {
+ int seconds;
+ stringstream ss;
+ seconds = vm["start-time"].as<int>();
+ ss << seconds;
+ desc.set_time_start(Time(ss.str().c_str(),
desc.get_frame_rate()));
+ }
+ if (vm.count("begin-time"))
+ {
+ int seconds;
+ stringstream ss;
+ seconds = vm["begin-time"].as<int>();
+ ss << seconds;
+ desc.set_time_start(Time(ss.str().c_str(),
desc.get_frame_rate()));
+ }
+ if (vm.count("end-time"))
+ {
+ int seconds;
+ stringstream ss;
+ seconds = vm["end-time"].as<int>();
+ ss << seconds;
+ desc.set_time_end(Time(ss.str().c_str(),
desc.get_frame_rate()));
+ }
+ if (vm.count("time"))
+ {
+ int seconds;
+ stringstream ss;
+ seconds = vm["time"].as<int>();
+ ss << seconds;
+ desc.set_time(Time(ss.str().c_str(), desc.get_frame_rate()));
+
+ VERBOSE_OUT(1) << _("Rendering frame at ")
+ <<
desc.get_time_start().get_string(desc.get_frame_rate())
+ << endl;
+ }
+ if (vm.count("gamma"))
+ {
+ synfig::warning(_("Gamma argument is currently
ignored"));
+ //int gamma;
+ //gamma = vm["gamma"].as<int>();
+ //desc.set_gamma(Gamma(gamma));
+ }
+
+ if (w||h)
+ {
+ // scale properly
+ if (!w)
+ w = desc.get_w() * h / desc.get_h();
+ else if (!h)
+ h = desc.get_h() * w / desc.get_w();
+
+ desc.set_wh(w,h);
+ VERBOSE_OUT(1) << strprintf(_("Resolution set to %dx%d"), w, h)
+ << endl;
+ }
+
+ if(span)
+ desc.set_span(span);
+
+}
+
int main(int ac, char* av[])
{
setlocale(LC_ALL, "");
@@ -659,6 +784,9 @@ int main(int ac, char* av[])
// Setup Job list ----------------------------------------------
+ extract_RendDesc(vm,job_list.front().canvas->rend_desc());
+ job_list.front().desc = job_list.front().canvas->rend_desc();
+
VERBOSE_OUT(4) << _("Attempting to determine
target/outfile...") << endl;
// If the target type is not yet defined,
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl