1 /* === S Y N F I G ========================================================= */
2 /*! \file tool/main.cpp
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 ** Copyright (c) 2007 Chris Moore
11 ** This package is free software; you can redistribute it and/or
12 ** modify it under the terms of the GNU General Public License as
13 ** published by the Free Software Foundation; either version 2 of
14 ** the License, or (at your option) any later version.
16 ** This package is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ** General Public License for more details.
22 /* ========================================================================= */
24 /* === H E A D E R S ======================================================= */
34 #include <ETL/stringf>
39 #include <synfig/loadcanvas.h>
40 #include <synfig/savecanvas.h>
41 #include <synfig/target_scanline.h>
42 #include <synfig/module.h>
43 #include <synfig/importer.h>
44 #include <synfig/layer.h>
45 #include <synfig/canvas.h>
46 #include <synfig/target.h>
47 #include <synfig/time.h>
48 #include <synfig/string.h>
49 #include <synfig/paramdesc.h>
50 #include <synfig/main.h>
51 #include <synfig/guid.h>
56 using namespace synfig;
58 /* === M A C R O S ========================================================= */
61 #define _(x) gettext(x)
66 SYNFIGTOOL_FILENOTFOUND = 1,
69 SYNFIGTOOL_UNKNOWNARGUMENT = 4,
70 SYNFIGTOOL_UNKNOWNERROR = 5,
71 SYNFIGTOOL_INVALIDTARGET = 6,
72 SYNFIGTOOL_RENDERFAILURE = 7,
74 SYNFIGTOOL_BADVERSION = 9,
75 SYNFIGTOOL_MISSINGARGUMENT =10
79 #define VERSION "unknown"
80 #define PACKAGE "synfig-tool"
83 #ifdef DEFAULT_QUALITY
84 #undef DEFAULT_QUALITY
87 #define DEFAULT_QUALITY 2
88 #define VERBOSE_OUT(x) if(verbosity>=(x))std::cerr
90 /* === G L O B A L S ======================================================= */
95 bool print_benchmarks=false;
97 /* === M E T H O D S ======================================================= */
99 class Progress : public synfig::ProgressCallback
105 Progress(const char *name):program(name) { }
108 task(const String &task)
110 VERBOSE_OUT(1)<<program<<": "<<task<<std::endl;
115 error(const String &task)
117 std::cerr<<program<<": "<<_("error")<<": "<<task<<std::endl;
122 warning(const String &task)
124 std::cerr<<program<<": "<<_("warning")<<": "<<task<<std::endl;
129 amount_complete(int /*current*/, int /*total*/)
135 class RenderProgress : public synfig::ProgressCallback
140 int clk_scanline; // The scanline at which the clock was reset
146 RenderProgress():clk_scanline(0), last_time(0) { }
149 task(const String &thetask)
156 error(const String &task)
158 std::cout<<_("error")<<": "<<task<<std::endl;
163 warning(const String &task)
165 std::cout<<_("warning")<<": "<<task<<std::endl;
170 amount_complete(int scanline, int h)
172 if(be_quiet)return true;
175 const float time(clk()*(float)(h-scanline)/(float)(scanline-clk_scanline));
176 const float delta(time-last_time);
178 int weeks=0,days=0,hours=0,minutes=0,seconds=0;
190 //cerr<<"reset"<<endl;
192 clk_scanline=scanline;
198 clk_scanline=scanline;
202 minutes++,seconds-=60;
210 cerr<<taskname<<": "<<_("Line")<<" "<<scanline<<_(" of ")<<h<<" -- ";
211 //cerr<<time/(h-clk_scanline)<<" ";
213 if(delta>=-time/(h-clk_scanline) )
216 if(delta>=0 && clk()>4.0 && scanline>clk_scanline+200)
218 //cerr<<"reset"<<endl;
220 clk_scanline=scanline;
237 cerr<<taskname<<": "<<_("DONE")<<" "<<endl;;
250 Canvas::Handle canvas;
251 Target::Handle target;
257 typedef list<String> arg_list_t;
258 typedef list<Job> job_list_t;
262 cout<<"GUID Test"<<endl;
265 cout<<synfig::GUID().get_string()<<' '<<synfig::GUID().get_string()<<endl;
269 void signal_test_func()
271 cout<<"**SIGNAL CALLED**"<<endl;
276 sigc::signal<void> sig;
277 sigc::connection conn;
278 cout<<"Signal Test"<<endl;
279 conn=sig.connect(sigc::ptr_fun(signal_test_func));
280 cout<<"Next line should exclaim signal called."<<endl;
283 cout<<"Next line should NOT exclaim signal called."<<endl;
288 /* === P R O C E D U R E S ================================================= */
290 void display_help(int amount)
295 Argument(const char *flag,const char *arg, string description)
297 const char spaces[]=" ";
299 cerr<<strprintf(" %s %s %s",flag, arg, spaces+strlen(arg)+strlen(flag)+1)+description<<endl;
301 cerr<<strprintf(" %s %s",flag,spaces+strlen(flag))+description<<endl;
305 cerr<<_("syntax: ")<<progname<<" [DEFAULT OPTIONS] ([SIF FILE] [SPECIFIC OPTIONS])..."<<endl;
309 Argument("-t","<output type>",_("Specify output target (Default:unknown)"));
310 Argument("-w","<pixel width>",_("Set the image width (Use zero for file default)"));
311 Argument("-h","<pixel height>",_("Set the image height (Use zero for file default)"));
312 Argument("-s","<image dist>",_("Set the diagonal size of image window (Span)"));
313 Argument("-a","<1...30>",_("Set antialias amount for parametric renderer."));
314 Argument("-Q","<0...10>",strprintf(_("Specify image quality for accelerated renderer (default=%d)"),DEFAULT_QUALITY).c_str());
315 Argument("-g","<amount>",_("Gamma (default=2.2)"));
316 Argument("-v",NULL,_("Verbose Output (add more for more verbosity)"));
317 Argument("-q",NULL,_("Quiet mode (No progress/time-remaining display)"));
318 Argument("-c","<canvas id>",_("Render the canvas with the given id instead of the root."));
319 Argument("-o","<output file>",_("Specify output filename"));
320 Argument("-T","<# of threads>",_("Enable multithreaded renderer using specified # of threads"));
322 Argument("-b",NULL,_("Print Benchmarks"));
324 Argument("--fps","<framerate>",_("Set the frame rate"));
325 Argument("--time","<time>",_("Render a single frame at <seconds>"));
326 Argument("--begin-time","<time>",_("Set the starting time"));
327 Argument("--end-time","<time>",_("Set the ending time"));
328 Argument("--dpi","<res>",_("Set the dots-per-inch"));
329 Argument("--append","<filename>",_("Append layers in <filename> to composition"));
331 Argument("--layer-info","<layer>",_("Print out layer's description, parameter info, etc."));
332 Argument("--layers",NULL,_("Print out the list of available layers"));
333 Argument("--targets",NULL,_("Print out the list of available targets"));
334 Argument("--importers",NULL,_("Print out the list of available importers"));
335 Argument("--valuenodes",NULL,_("Print out the list of available ValueNodes"));
336 Argument("--modules",NULL,_("Print out the list of loaded modules"));
337 Argument("--version",NULL,_("Print out version information"));
338 Argument("--info",NULL,_("Print out misc build information"));
339 Argument("--license",NULL,_("Print out license information"));
342 Argument("--guid-test",NULL,_("Test GUID generation"));
343 Argument("--signal-test",NULL,_("Test signal implementation"));
348 Argument("--help",NULL,_("Print out usage and syntax info"));
352 int process_global_flags(arg_list_t &arg_list)
354 arg_list_t::iterator iter, next;
356 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
359 return SYNFIGTOOL_OK;
361 if(*iter == "--signal-test")
364 return SYNFIGTOOL_HELP;
367 if(*iter == "--guid-test")
370 return SYNFIGTOOL_HELP;
374 if(*iter == "--help")
378 return SYNFIGTOOL_HELP;
381 if(*iter == "--info")
383 cout<<PACKAGE"-"VERSION<<endl;
384 cout<<"Compiled on "__DATE__ " at "__TIME__;
386 cout<<" with GCC "<<__VERSION__;
389 cout<<" with Microsoft Visual C++ "<<(_MSC_VER>>8)<<'.'<<(_MSC_VER&255);
391 #ifdef __TCPLUSPLUS__
392 cout<<" with Borland Turbo C++ "<<(__TCPLUSPLUS__>>8)<<'.'<<((__TCPLUSPLUS__&255)>>4)<<'.'<<(__TCPLUSPLUS__&15);
395 cout<<endl<<SYNFIG_COPYRIGHT<<endl;
397 return SYNFIGTOOL_HELP;
400 if(*iter == "--layers")
403 synfig::Main synfig_main(dirname(progname),&p);
404 synfig::Layer::Book::iterator iter=synfig::Layer::book().begin();
405 for(;iter!=synfig::Layer::book().end();iter++)
406 cout<<iter->first<<endl;
408 return SYNFIGTOOL_HELP;
411 if(*iter == "--layer-info")
414 synfig::Main synfig_main(dirname(progname),&p);
416 Layer::Handle layer=synfig::Layer::create(*iter);
417 cout<<"Layer Name: "<<layer->get_name()<<endl;
418 cout<<"Localized Layer Name: "<<layer->get_local_name()<<endl;
419 cout<<"Version: "<<layer->get_version()<<endl;
420 Layer::Vocab vocab=layer->get_param_vocab();
421 for(;!vocab.empty();vocab.pop_front())
423 cout<<"param - "<<vocab.front().get_name();
424 if(!vocab.front().get_critical())
425 cout<<" (not critical)";
426 cout<<endl<<"\tLocalized Name: "<<vocab.front().get_local_name()<<endl;
427 if(!vocab.front().get_description().empty())
428 cout<<"\tDescription: "<<vocab.front().get_description()<<endl;
429 if(!vocab.front().get_hint().empty())
430 cout<<"\tHint: "<<vocab.front().get_hint()<<endl;
433 return SYNFIGTOOL_HELP;
436 if(*iter == "--modules")
439 synfig::Main synfig_main(dirname(progname),&p);
440 synfig::Module::Book::iterator iter=synfig::Module::book().begin();
441 for(;iter!=synfig::Module::book().end();iter++)
442 cout<<iter->first<<endl;
443 return SYNFIGTOOL_HELP;
446 if(*iter == "--targets")
449 synfig::Main synfig_main(dirname(progname),&p);
450 synfig::Target::Book::iterator iter=synfig::Target::book().begin();
451 for(;iter!=synfig::Target::book().end();iter++)
452 cout<<iter->first<<endl;
454 return SYNFIGTOOL_HELP;
457 if(*iter == "--valuenodes")
460 synfig::Main synfig_main(dirname(progname),&p);
461 synfig::LinkableValueNode::Book::iterator iter=synfig::LinkableValueNode::book().begin();
462 for(;iter!=synfig::LinkableValueNode::book().end();iter++)
463 cout<<iter->first<<endl;
465 return SYNFIGTOOL_HELP;
468 if(*iter == "--importers")
471 synfig::Main synfig_main(dirname(progname),&p);
472 synfig::Importer::Book::iterator iter=synfig::Importer::book().begin();
473 for(;iter!=synfig::Importer::book().end();iter++)
474 cout<<iter->first<<endl;
476 return SYNFIGTOOL_HELP;
479 if(*iter == "--version")
481 cerr<<PACKAGE<<" "<<VERSION<<endl;
483 arg_list.erase(iter);
485 return SYNFIGTOOL_HELP;
488 if(*iter == "--license")
490 cerr<<PACKAGE<<" "<<VERSION<<endl;
491 cout<<SYNFIG_COPYRIGHT<<endl<<endl;
493 ** This package is free software; you can redistribute it and/or\n\
494 ** modify it under the terms of the GNU General Public License as\n\
495 ** published by the Free Software Foundation; either version 2 of\n\
496 ** the License, or (at your option) any later version.\n\
498 ** " << endl << endl;
499 arg_list.erase(iter);
501 return SYNFIGTOOL_HELP;
508 arg_list.erase(iter);
517 arg_list.erase(iter);
523 print_benchmarks=true;
525 arg_list.erase(iter);
531 return SYNFIGTOOL_OK;
534 int extract_arg_cluster(arg_list_t &arg_list,arg_list_t &cluster)
536 arg_list_t::iterator iter, next;
538 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
540 if(*iter->begin() != '-')
542 //cerr<<*iter->begin()<<"-----------"<<endl;
543 return SYNFIGTOOL_OK;
557 *iter=="--start-time" ||
558 *iter=="--begin-time" ||
559 *iter=="--end-time" ||
560 *iter=="--start-frame" ||
561 *iter=="--end-frame" ||
570 cluster.push_back(*iter);
571 arg_list.erase(iter);
573 if (iter==arg_list.end()) {
574 error("The `%s' flag requires a value. Use --help for a list of options.", cluster.back().c_str());
575 return SYNFIGTOOL_MISSINGARGUMENT;
579 cluster.push_back(*iter);
580 arg_list.erase(iter);
583 return SYNFIGTOOL_OK;
586 int extract_RendDesc(arg_list_t &arg_list,RendDesc &desc)
588 arg_list_t::iterator iter, next;
591 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
595 arg_list.erase(iter);
597 w=atoi(iter->c_str());
598 arg_list.erase(iter);
602 arg_list.erase(iter);
604 h=atoi(iter->c_str());
605 arg_list.erase(iter);
610 arg_list.erase(iter);
612 a=atoi(iter->c_str());
613 desc.set_antialias(a);
614 VERBOSE_OUT(1)<<strprintf(_("Antialiasing set to %d, (%d samples per pixel)"),a,a*a)<<endl;
615 arg_list.erase(iter);
619 arg_list.erase(iter);
621 span=atof(iter->c_str());
622 VERBOSE_OUT(1)<<strprintf(_("Span set to %d units"),span)<<endl;
623 arg_list.erase(iter);
625 else if(*iter=="--fps")
627 arg_list.erase(iter);
629 float fps=atof(iter->c_str());
630 desc.set_frame_rate(fps);
631 arg_list.erase(iter);
632 VERBOSE_OUT(1)<<strprintf(_("Frame rate set to %d frames per second"),fps)<<endl;
634 else if(*iter=="--dpi")
636 arg_list.erase(iter);
638 float dpi=atof(iter->c_str());
639 float dots_per_meter=dpi*39.3700787402;
640 desc.set_x_res(dots_per_meter).set_y_res(dots_per_meter);
641 arg_list.erase(iter);
642 VERBOSE_OUT(1)<<strprintf(_("Physical resolution set to %f dpi"),dpi)<<endl;
644 else if(*iter=="--dpi-x")
646 arg_list.erase(iter);
648 float dpi=atof(iter->c_str());
649 float dots_per_meter=dpi*39.3700787402;
650 desc.set_x_res(dots_per_meter);
651 arg_list.erase(iter);
652 VERBOSE_OUT(1)<<strprintf(_("Physical X resolution set to %f dpi"),dpi)<<endl;
654 else if(*iter=="--dpi-y")
656 arg_list.erase(iter);
658 float dpi=atof(iter->c_str());
659 float dots_per_meter=dpi*39.3700787402;
660 desc.set_y_res(dots_per_meter);
661 arg_list.erase(iter);
662 VERBOSE_OUT(1)<<strprintf(_("Physical Y resolution set to %f dpi"),dpi)<<endl;
664 else if(*iter=="--start-time" || *iter=="--begin-time")
666 arg_list.erase(iter);
668 desc.set_time_start(Time(*iter,desc.get_frame_rate()));
669 arg_list.erase(iter);
671 else if(*iter=="--end-time")
673 arg_list.erase(iter);
675 desc.set_time_end(Time(*iter,desc.get_frame_rate()));
676 arg_list.erase(iter);
678 else if(*iter=="--time")
680 arg_list.erase(iter);
682 desc.set_time(Time(*iter,desc.get_frame_rate()));
683 VERBOSE_OUT(1)<<_("Rendering frame at ")<<desc.get_time_start().get_string(desc.get_frame_rate())<<endl;
684 arg_list.erase(iter);
688 synfig::warning("Gamma argument is currently ignored");
689 arg_list.erase(iter);
691 //desc.set_gamma(Gamma(atof(iter->c_str())));
692 arg_list.erase(iter);
698 VERBOSE_OUT(1)<<strprintf(_("Resolution set to %dx%d"),w,h)<<endl;
704 VERBOSE_OUT(1)<<strprintf(_("Width set to %d pixels"),w)<<endl;
709 VERBOSE_OUT(1)<<strprintf(_("Height set to %d pixels"),h)<<endl;
715 return SYNFIGTOOL_OK;
718 int extract_quality(arg_list_t &arg_list,int &quality)
720 arg_list_t::iterator iter, next;
721 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
725 arg_list.erase(iter);
727 quality=atoi(iter->c_str());
728 VERBOSE_OUT(1)<<strprintf(_("Quality set to %d"),quality)<<endl;
729 arg_list.erase(iter);
733 return SYNFIGTOOL_OK;
736 int extract_threads(arg_list_t &arg_list,int &threads)
738 arg_list_t::iterator iter, next;
739 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
743 arg_list.erase(iter);
745 threads=atoi(iter->c_str());
746 VERBOSE_OUT(1)<<strprintf(_("Threads set to %d"),threads)<<endl;
747 arg_list.erase(iter);
751 return SYNFIGTOOL_OK;
754 int extract_target(arg_list_t &arg_list,string &type)
756 arg_list_t::iterator iter, next;
759 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
763 arg_list.erase(iter);
766 arg_list.erase(iter);
770 return SYNFIGTOOL_OK;
773 int extract_append(arg_list_t &arg_list,string &filename)
775 arg_list_t::iterator iter, next;
778 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
780 if(*iter=="--append")
782 arg_list.erase(iter);
785 arg_list.erase(iter);
789 return SYNFIGTOOL_OK;
792 int extract_outfile(arg_list_t &arg_list,string &outfile)
794 arg_list_t::iterator iter, next;
795 int ret=SYNFIGTOOL_FILENOTFOUND;
798 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
802 arg_list.erase(iter);
805 arg_list.erase(iter);
813 int extract_canvasid(arg_list_t &arg_list,string &canvasid)
815 arg_list_t::iterator iter, next;
818 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
822 arg_list.erase(iter);
825 arg_list.erase(iter);
829 return SYNFIGTOOL_OK;
832 /* === M E T H O D S ======================================================= */
834 /* === E N T R Y P O I N T ================================================= */
836 int main(int argc, char *argv[])
842 setlocale(LC_ALL, "");
843 bindtextdomain("synfig", LOCALEDIR);
844 textdomain("synfig");
849 if(!SYNFIG_CHECK_VERSION())
851 cerr<<_("FATAL: Synfig Version Mismatch")<<endl;
852 return SYNFIGTOOL_BADVERSION;
857 return SYNFIGTOOL_BLANK;
861 arg_list.push_back(argv[i]);
863 if((i=process_global_flags(arg_list)))
866 VERBOSE_OUT(1)<<_("verbosity set to ")<<verbosity<<endl;
867 synfig::Main synfig_main(dirname(progname),&p);
870 arg_list_t defaults, imageargs;
873 // Grab the defaults before the first file
874 if ((ret = extract_arg_cluster(arg_list,defaults)) != SYNFIGTOOL_OK)
877 while(arg_list.size())
880 job_list.push_front(Job());
884 job_list.front().filename=arg_list.front();
885 arg_list.pop_front();
887 if ((ret = extract_arg_cluster(arg_list,imageargs)) != SYNFIGTOOL_OK)
890 // Open the composition
892 job_list.front().root=open_canvas(job_list.front().filename);
894 if(!job_list.front().root)
896 cerr<<_("Unable to open ")<<job_list.front().filename<<"."<<endl;
897 cerr<<_("Throwing out job...")<<endl;
898 job_list.pop_front();
902 job_list.front().root->set_time(0);
905 extract_canvasid(imageargs,canvasid);
906 if(!canvasid.empty())
910 job_list.front().canvas=job_list.front().root->find_canvas(canvasid);
912 catch(Exception::IDNotFound)
914 cerr<<_("Unable to find canvas with ID \"")<<canvasid<<_("\" in ")<<job_list.front().filename<<"."<<endl;
915 cerr<<_("Throwing out job...")<<endl;
916 job_list.pop_front();
920 catch(Exception::BadLinkName)
922 cerr<<_("Invalid canvas name \"")<<canvasid<<_("\" in ")<<job_list.front().filename<<"."<<endl;
923 cerr<<_("Throwing out job...")<<endl;
924 job_list.pop_front();
930 job_list.front().canvas=job_list.front().root;
932 extract_RendDesc(imageargs,job_list.front().canvas->rend_desc());
933 extract_target(imageargs,target_name);
934 extract_threads(imageargs,threads);
935 job_list.front().quality=DEFAULT_QUALITY;
936 extract_quality(imageargs,job_list.front().quality);
937 VERBOSE_OUT(2)<<_("Quality set to ")<<job_list.front().quality<<endl;
938 job_list.front().desc=job_list.front().canvas->rend_desc();
939 extract_outfile(imageargs,job_list.front().outfilename);
943 string composite_file;
944 extract_append(imageargs,composite_file);
945 if(!composite_file.empty())
947 Canvas::Handle composite(open_canvas(composite_file));
950 Canvas::reverse_iterator iter;
951 for(iter=composite->rbegin();iter!=composite->rend();++iter)
953 Layer::Handle layer(*iter);
955 job_list.front().canvas->push_front(layer->clone());
957 VERBOSE_OUT(2)<<_("Appended contents of ")<<composite_file<<endl;
961 VERBOSE_OUT(4)<<_("Attempting to determine target/outfile...")<<endl;
963 // If the target type is not yet defined,
964 // try to figure it out from the outfile.
965 if(target_name.empty() && !job_list.front().outfilename.empty())
967 VERBOSE_OUT(3)<<_("Target name undefined, attempting to figure it out")<<endl;
968 string ext = filename_extension(job_list.front().outfilename);
969 if (ext.length()) ext = ext.substr(1);
970 if(Target::ext_book().count(ext))
971 target_name=Target::ext_book()[ext];
976 // If the target type is STILL not yet defined, then
977 // set it to a some sort of default
978 if(target_name.empty())
980 VERBOSE_OUT(2)<<_("Defaulting to PNG target...")<<endl;
984 // If no output filename was provided, then
985 // create a output filename based on the
986 // given input filename. (ie: change the extension)
987 if(job_list.front().outfilename.empty())
989 job_list.front().outfilename = filename_sans_extension(job_list.front().filename) + '.';
990 if(Target::book().count(target_name))
991 job_list.front().outfilename+=Target::book()[target_name].second;
993 job_list.front().outfilename+=target_name;
996 VERBOSE_OUT(4)<<"target_name="<<target_name<<endl;
997 VERBOSE_OUT(4)<<"outfile_name="<<job_list.front().outfilename<<endl;
999 VERBOSE_OUT(4)<<_("Creating the target...")<<endl;
1000 job_list.front().target=synfig::Target::create(target_name,job_list.front().outfilename);
1002 if(target_name=="sif")
1004 job_list.front().sifout=true;
1008 if(!job_list.front().target)
1010 cerr<<_("Unknown target for ")<<job_list.front().filename<<": "<<target_name<<endl;
1011 cerr<<_("Throwing out job...")<<endl;
1012 job_list.pop_front();
1015 job_list.front().sifout=false;
1018 // Set the Canvas on the Target
1019 if(job_list.front().target)
1021 VERBOSE_OUT(4)<<_("Setting the canvas on the target...")<<endl;
1022 job_list.front().target->set_canvas(job_list.front().canvas);
1023 VERBOSE_OUT(4)<<_("Setting the quality of the target...")<<endl;
1024 job_list.front().target->set_quality(job_list.front().quality);
1027 // Set the threads for the target
1028 if(job_list.front().target && Target_Scanline::Handle::cast_dynamic(job_list.front().target))
1030 Target_Scanline::Handle::cast_dynamic(job_list.front().target)->set_threads(threads);
1033 if(imageargs.size())
1035 cerr<<_("Unidentified arguments for ")<<job_list.front().filename<<": ";
1036 for(;imageargs.size();imageargs.pop_front())
1037 cerr<<' '<<imageargs.front();
1039 cerr<<_("Throwing out job...")<<endl;
1040 job_list.pop_front();
1044 //getline(cin,bleh);
1050 cerr<<_("Unidentified arguments:");
1051 for(;arg_list.size();arg_list.pop_front())
1052 cerr<<' '<<arg_list.front();
1054 return SYNFIGTOOL_UNKNOWNARGUMENT;
1057 if(!job_list.size())
1059 cerr<<_("Nothing to do!")<<endl;
1060 return SYNFIGTOOL_BORED;
1063 for(;job_list.size();job_list.pop_front())
1065 VERBOSE_OUT(3)<<job_list.front().filename<<" -- "<<endl<<'\t'<<
1066 strprintf("w:%d, h:%d, a:%d, pxaspect:%f, imaspect:%f, span:%f",
1067 job_list.front().desc.get_w(),
1068 job_list.front().desc.get_h(),
1069 job_list.front().desc.get_antialias(),
1070 job_list.front().desc.get_pixel_aspect(),
1071 job_list.front().desc.get_image_aspect(),
1072 job_list.front().desc.get_span()
1074 strprintf("tl:[%f,%f], br:[%f,%f], focus:[%f,%f]",
1075 job_list.front().desc.get_tl()[0],job_list.front().desc.get_tl()[1],
1076 job_list.front().desc.get_br()[0],job_list.front().desc.get_br()[1],
1077 job_list.front().desc.get_focus()[0],job_list.front().desc.get_focus()[1]
1081 p.task(job_list.front().filename+" ==> "+job_list.front().outfilename);
1082 if(!job_list.front().sifout)
1084 VERBOSE_OUT(1)<<_("Rendering...")<<endl;
1087 // Call the render member of the target
1088 if(!job_list.front().target->render(&p))
1090 cerr<<"Render Failure."<<endl;
1091 return SYNFIGTOOL_RENDERFAILURE;
1093 if(print_benchmarks)
1095 cout<<job_list.front().filename+": Rendered in "<<timer()<<" seconds."<<endl;
1100 if(!save_canvas(job_list.front().outfilename,job_list.front().canvas))
1102 cerr<<"Render Failure."<<endl;
1103 return SYNFIGTOOL_RENDERFAILURE;
1110 VERBOSE_OUT(1)<<_("Done.")<<endl;
1112 return SYNFIGTOOL_OK;