1 /* === S Y N F I G ========================================================= */
5 ** $Id: main.cpp,v 1.9 2005/01/23 04:41:10 darco Exp $
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
10 ** This package is free software; you can redistribute it and/or
11 ** modify it under the terms of the GNU General Public License as
12 ** published by the Free Software Foundation; either version 2 of
13 ** the License, or (at your option) any later version.
15 ** This package is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ** General Public License for more details.
21 /* ========================================================================= */
23 /* === H E A D E R S ======================================================= */
33 #include <ETL/stringf>
38 #include <synfig/loadcanvas.h>
39 #include <synfig/savecanvas.h>
40 #include <synfig/target_scanline.h>
41 #include <synfig/module.h>
42 #include <synfig/importer.h>
43 #include <synfig/layer.h>
44 #include <synfig/canvas.h>
45 #include <synfig/target.h>
46 #include <synfig/time.h>
47 #include <synfig/string.h>
48 #include <synfig/paramdesc.h>
49 #include <synfig/main.h>
50 #include <synfig/guid.h>
55 using namespace synfig;
57 /* === M A C R O S ========================================================= */
62 SYNFIGTOOL_FILENOTFOUND =1,
65 SYNFIGTOOL_UNKNOWNARGUMENT =4,
66 SYNFIGTOOL_UNKNOWNERROR =5,
67 SYNFIGTOOL_INVALIDTARGET =6,
68 SYNFIGTOOL_RENDERFAILURE =7,
70 SYNFIGTOOL_BADVERSION =9
74 #define VERSION "unknown"
75 #define PACKAGE "synfig-tool"
78 #ifdef DEFAULT_QUALITY
79 #undef DEFAULT_QUALITY
82 #define DEFAULT_QUALITY 2
83 #define VERBOSE_OUT(x) if(verbosity>=(x))std::cerr
85 /* === G L O B A L S ======================================================= */
90 bool print_benchmarks=false;
92 /* === M E T H O D S ======================================================= */
94 class Progress : public synfig::ProgressCallback
100 Progress(const char *name):program(name) { }
103 task(const String &task)
105 VERBOSE_OUT(1)<<program<<": "<<task<<std::endl;
110 error(const String &task)
112 std::cerr<<program<<": "<<_("error")<<": "<<task<<std::endl;
117 warning(const String &task)
119 std::cerr<<program<<": "<<_("warning")<<": "<<task<<std::endl;
124 amount_complete(int current, int total)
130 class RenderProgress : public synfig::ProgressCallback
135 int clk_scanline; // The scanline at which the clock was reset
141 RenderProgress():clk_scanline(0) { }
144 task(const String &thetask)
151 error(const String &task)
153 std::cout<<_("error")<<": "<<task<<std::endl;
158 warning(const String &task)
160 std::cout<<_("warning")<<": "<<task<<std::endl;
165 amount_complete(int scanline, int h)
167 if(be_quiet)return true;
170 const float time(clk()*(float)(h-scanline)/(float)(scanline-clk_scanline));
171 const float delta(time-last_time);
173 int weeks=0,days=0,hours=0,minutes=0,seconds=0;
185 //cerr<<"reset"<<endl;
187 clk_scanline=scanline;
193 clk_scanline=scanline;
197 minutes++,seconds-=60;
205 cerr<<taskname<<": "<<_("Line")<<" "<<scanline<<_(" of ")<<h<<" -- ";
206 //cerr<<time/(h-clk_scanline)<<" ";
208 if(delta>=-time/(h-clk_scanline) )
211 if(delta>=0 && clk()>4.0 && scanline>clk_scanline+200)
213 //cerr<<"reset"<<endl;
215 clk_scanline=scanline;
232 cerr<<taskname<<": "<<_("DONE")<<" "<<endl;;
245 Canvas::Handle canvas;
246 Target::Handle target;
252 typedef list<String> arg_list_t;
253 typedef list<Job> job_list_t;
257 cout<<"GUID Test"<<endl;
260 cout<<synfig::GUID().get_string()<<' '<<synfig::GUID().get_string()<<endl;
264 void signal_test_func()
266 cout<<"**SIGNAL CALLED**"<<endl;
271 sigc::signal<void> sig;
272 sigc::connection conn;
273 cout<<"Signal Test"<<endl;
274 conn=sig.connect(sigc::ptr_fun(signal_test_func));
275 cout<<"Next line should exclaim signal called."<<endl;
278 cout<<"Next line should NOT exclaim signal called."<<endl;
283 /* === P R O C E D U R E S ================================================= */
285 void display_help(int amount)
290 Argument(const char *flag,const char *arg, string description)
292 const char spaces[]=" ";
294 cerr<<strprintf(" %s %s %s",flag, arg, spaces+strlen(arg)+strlen(flag)+1)+description<<endl;
296 cerr<<strprintf(" %s %s",flag,spaces+strlen(flag))+description<<endl;
300 cerr<<_("syntax: ")<<progname<<" [DEFAULT OPTIONS] ([SIF FILE] [SPECIFIC OPTIONS])..."<<endl;
304 Argument("-t","<output type>",_("Specify output target (Default:unknown)"));
305 Argument("-w","<pixel width>",_("Set the image width (Use zero for file default)"));
306 Argument("-h","<pixel height>",_("Set the image height (Use zero for file default)"));
307 Argument("-s","<image dist>",_("Set the diagonal size of image window (Span)"));
308 Argument("-a","<1...30>",_("Set antialias amount for parametric renderer."));
309 Argument("-Q","<0...10>",strprintf(_("Specify image quality for accelerated renderer (default=%d)"),DEFAULT_QUALITY).c_str());
310 Argument("-g","<amount>",_("Gamma (default=2.2)"));
311 Argument("-v",NULL,_("Verbose Output (add more for more verbosity)"));
312 Argument("-q",NULL,_("Quiet mode (No progress/time-remaining display)"));
313 Argument("-c","<canvas id>",_("Render the canvas with the given id instead of the root."));
314 Argument("-o","<output file>",_("Specify output filename"));
315 Argument("-T","<# of threads>",_("Enable multithreaded renderer using specified # of threads"));
317 Argument("-b",NULL,_("Print Benchmarks"));
319 Argument("--fps","<framerate>",_("Set the frame rate"));
320 Argument("--time","<time>",_("Render a single frame at <seconds>"));
321 Argument("--begin-time","<time>",_("Set the starting time"));
322 Argument("--end-time","<time>",_("Set the ending time"));
323 Argument("--dpi","<res>",_("Set the dots-per-inch"));
324 Argument("--append","<filename>",_("Append layers in <filename> to composition"));
326 Argument("--layer-info","<layer>",_("Print out layer's description, parameter info, etc."));
327 Argument("--layers",NULL,_("Print out the list of available layers"));
328 Argument("--targets",NULL,_("Print out the list of available targets"));
329 Argument("--importers",NULL,_("Print out the list of available importers"));
330 Argument("--valuenodes",NULL,_("Print out the list of available ValueNodes"));
331 Argument("--modules",NULL,_("Print out the list of loaded modules"));
332 Argument("--version",NULL,_("Print out version information"));
333 Argument("--info",NULL,_("Print out misc build information"));
334 Argument("--license",NULL,_("Print out license information"));
337 Argument("--guid-test",NULL,_("Test GUID generation"));
338 Argument("--signal-test",NULL,_("Test signal implementation"));
343 Argument("--help",NULL,_("Print out usage and syntax info"));
347 int process_global_flags(arg_list_t &arg_list)
349 arg_list_t::iterator iter, next;
351 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
354 return SYNFIGTOOL_OK;
356 if(*iter == "--signal-test")
359 return SYNFIGTOOL_HELP;
362 if(*iter == "--guid-test")
365 return SYNFIGTOOL_HELP;
369 if(*iter == "--help")
373 return SYNFIGTOOL_HELP;
376 if(*iter == "--info")
378 cout<<PACKAGE"-"VERSION<<endl;
379 cout<<"Compiled on "__DATE__ " at "__TIME__;
381 cout<<" with GCC "<<__VERSION__;
384 cout<<" with Microsoft Visual C++ "<<(_MSC_VER>>8)<<'.'<<(_MSC_VER&255);
386 #ifdef __TCPLUSPLUS__
387 cout<<" with Borland Turbo C++ "<<(__TCPLUSPLUS__>>8)<<'.'<<((__TCPLUSPLUS__&255)>>4)<<'.'<<(__TCPLUSPLUS__&15);
390 cout<<endl<<SYNFIG_COPYRIGHT<<endl;
392 return SYNFIGTOOL_HELP;
395 if(*iter == "--layers")
398 synfig::Main synfig_main(dirname(progname),&p);
399 synfig::Layer::Book::iterator iter=synfig::Layer::book().begin();
400 for(;iter!=synfig::Layer::book().end();iter++)
401 cout<<iter->first<<endl;
403 return SYNFIGTOOL_HELP;
406 if(*iter == "--layer-info")
409 synfig::Main synfig_main(dirname(progname),&p);
411 Layer::Handle layer=synfig::Layer::create(*iter);
412 cout<<"Layer Name: "<<layer->get_name()<<endl;
413 cout<<"Localized Layer Name: "<<layer->get_local_name()<<endl;
414 cout<<"Version: "<<layer->get_version()<<endl;
415 Layer::Vocab vocab=layer->get_param_vocab();
416 for(;!vocab.empty();vocab.pop_front())
418 cout<<"param - "<<vocab.front().get_name();
419 if(!vocab.front().get_critical())
420 cout<<" (not critical)";
421 cout<<endl<<"\tLocalized Name: "<<vocab.front().get_local_name()<<endl;
422 if(!vocab.front().get_description().empty())
423 cout<<"\tDescription: "<<vocab.front().get_description()<<endl;
424 if(!vocab.front().get_hint().empty())
425 cout<<"\tHint: "<<vocab.front().get_hint()<<endl;
428 return SYNFIGTOOL_HELP;
431 if(*iter == "--modules")
434 synfig::Main synfig_main(dirname(progname),&p);
435 synfig::Module::Book::iterator iter=synfig::Module::book().begin();
436 for(;iter!=synfig::Module::book().end();iter++)
437 cout<<iter->first<<endl;
438 return SYNFIGTOOL_HELP;
441 if(*iter == "--targets")
444 synfig::Main synfig_main(dirname(progname),&p);
445 synfig::Target::Book::iterator iter=synfig::Target::book().begin();
446 for(;iter!=synfig::Target::book().end();iter++)
447 cout<<iter->first<<endl;
449 return SYNFIGTOOL_HELP;
452 if(*iter == "--valuenodes")
455 synfig::Main synfig_main(dirname(progname),&p);
456 synfig::LinkableValueNode::Book::iterator iter=synfig::LinkableValueNode::book().begin();
457 for(;iter!=synfig::LinkableValueNode::book().end();iter++)
458 cout<<iter->first<<endl;
460 return SYNFIGTOOL_HELP;
463 if(*iter == "--importers")
466 synfig::Main synfig_main(dirname(progname),&p);
467 synfig::Importer::Book::iterator iter=synfig::Importer::book().begin();
468 for(;iter!=synfig::Importer::book().end();iter++)
469 cout<<iter->first<<endl;
471 return SYNFIGTOOL_HELP;
474 if(*iter == "--version")
476 cerr<<PACKAGE<<" "<<VERSION<<endl;
478 arg_list.erase(iter);
480 return SYNFIGTOOL_HELP;
483 if(*iter == "--license")
485 cerr<<PACKAGE<<" "<<VERSION<<endl;
486 cout<<SYNFIG_COPYRIGHT<<endl<<endl;
488 ** This package is free software; you can redistribute it and/or\n\
489 ** modify it under the terms of the GNU General Public License as\n\
490 ** published by the Free Software Foundation; either version 2 of\n\
491 ** the License, or (at your option) any later version.\n\
493 ** " << endl << endl;
494 arg_list.erase(iter);
496 return SYNFIGTOOL_HELP;
503 arg_list.erase(iter);
512 arg_list.erase(iter);
518 print_benchmarks=true;
520 arg_list.erase(iter);
526 return SYNFIGTOOL_OK;
529 int extract_arg_cluster(arg_list_t &arg_list,arg_list_t &cluster)
531 arg_list_t::iterator iter, next;
533 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
535 if(*iter->begin() != '-')
537 //cerr<<*iter->begin()<<"-----------"<<endl;
538 return SYNFIGTOOL_OK;
552 *iter=="--start-time" ||
553 *iter=="--begin-time" ||
554 *iter=="--end-time" ||
555 *iter=="--start-frame" ||
556 *iter=="--end-frame" ||
565 cluster.push_back(*iter);
566 arg_list.erase(iter);
570 cluster.push_back(*iter);
571 arg_list.erase(iter);
574 return SYNFIGTOOL_OK;
577 int extract_RendDesc(arg_list_t &arg_list,RendDesc &desc)
579 arg_list_t::iterator iter, next;
582 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
586 arg_list.erase(iter);
588 w=atoi(iter->c_str());
589 arg_list.erase(iter);
593 arg_list.erase(iter);
595 h=atoi(iter->c_str());
596 arg_list.erase(iter);
601 arg_list.erase(iter);
603 a=atoi(iter->c_str());
604 desc.set_antialias(a);
605 VERBOSE_OUT(1)<<strprintf(_("Antialiasing set to %d, (%d samples per pixel)"),a,a*a)<<endl;
606 arg_list.erase(iter);
610 arg_list.erase(iter);
612 span=atof(iter->c_str());
613 VERBOSE_OUT(1)<<strprintf(_("Span set to %d units"),span)<<endl;
614 arg_list.erase(iter);
618 arg_list.erase(iter);
620 float fps=atof(iter->c_str());
621 desc.set_frame_rate(fps);
622 arg_list.erase(iter);
623 VERBOSE_OUT(1)<<strprintf(_("Frame rate set to %d frames per second"),fps)<<endl;
627 arg_list.erase(iter);
629 float dpi=atof(iter->c_str());
630 float dots_per_meter=dpi*39.3700787402;
631 desc.set_x_res(dots_per_meter).set_y_res(dots_per_meter);
632 arg_list.erase(iter);
633 VERBOSE_OUT(1)<<strprintf(_("Physical resolution set to %f dpi"),dpi)<<endl;
637 arg_list.erase(iter);
639 float dpi=atof(iter->c_str());
640 float dots_per_meter=dpi*39.3700787402;
641 desc.set_x_res(dots_per_meter);
642 arg_list.erase(iter);
643 VERBOSE_OUT(1)<<strprintf(_("Physical X resolution set to %f dpi"),dpi)<<endl;
647 arg_list.erase(iter);
649 float dpi=atof(iter->c_str());
650 float dots_per_meter=dpi*39.3700787402;
651 desc.set_y_res(dots_per_meter);
652 arg_list.erase(iter);
653 VERBOSE_OUT(1)<<strprintf(_("Physical Y resolution set to %f dpi"),dpi)<<endl;
655 if(*iter=="--start-time" || *iter=="--begin-time")
657 arg_list.erase(iter);
659 desc.set_time_start(Time(*iter,desc.get_frame_rate()));
660 arg_list.erase(iter);
662 if(*iter=="--end-time")
664 arg_list.erase(iter);
666 desc.set_time_end(Time(*iter,desc.get_frame_rate()));
667 arg_list.erase(iter);
671 arg_list.erase(iter);
673 desc.set_time(Time(*iter,desc.get_frame_rate()));
674 VERBOSE_OUT(1)<<_("Rendering frame at ")<<desc.get_time_start().get_string(desc.get_frame_rate())<<endl;
675 arg_list.erase(iter);
679 synfig::warning("Gamma argument is currently ignored");
680 //arg_list.erase(iter);
682 //desc.set_gamma(Gamma(atof(iter->c_str())));
683 //arg_list.erase(iter);
689 VERBOSE_OUT(1)<<strprintf(_("Resolution set to %dx%d"),w,h)<<endl;
695 VERBOSE_OUT(1)<<strprintf(_("Width set to %d pixels"),w)<<endl;
700 VERBOSE_OUT(1)<<strprintf(_("Height set to %d pixels"),h)<<endl;
706 return SYNFIGTOOL_OK;
709 int extract_quality(arg_list_t &arg_list,int &quality)
711 arg_list_t::iterator iter, next;
712 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
716 arg_list.erase(iter);
718 quality=atoi(iter->c_str());
719 VERBOSE_OUT(1)<<strprintf(_("Quality set to %d"),quality)<<endl;
720 arg_list.erase(iter);
724 return SYNFIGTOOL_OK;
727 int extract_threads(arg_list_t &arg_list,int &threads)
729 arg_list_t::iterator iter, next;
730 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
734 arg_list.erase(iter);
736 threads=atoi(iter->c_str());
737 VERBOSE_OUT(1)<<strprintf(_("Threads set to %d"),threads)<<endl;
738 arg_list.erase(iter);
742 return SYNFIGTOOL_OK;
745 int extract_target(arg_list_t &arg_list,string &type)
747 arg_list_t::iterator iter, next;
750 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
754 arg_list.erase(iter);
757 arg_list.erase(iter);
761 return SYNFIGTOOL_OK;
764 int extract_append(arg_list_t &arg_list,string &filename)
766 arg_list_t::iterator iter, next;
769 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
771 if(*iter=="--append")
773 arg_list.erase(iter);
776 arg_list.erase(iter);
780 return SYNFIGTOOL_OK;
783 int extract_outfile(arg_list_t &arg_list,string &outfile)
785 arg_list_t::iterator iter, next;
786 int ret=SYNFIGTOOL_FILENOTFOUND;
789 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
793 arg_list.erase(iter);
796 arg_list.erase(iter);
804 int extract_canvasid(arg_list_t &arg_list,string &canvasid)
806 arg_list_t::iterator iter, next;
809 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
813 arg_list.erase(iter);
816 arg_list.erase(iter);
820 return SYNFIGTOOL_OK;
823 /* === M E T H O D S ======================================================= */
825 /* === E N T R Y P O I N T ================================================= */
827 int main(int argc, char *argv[])
836 if(!SYNFIG_CHECK_VERSION())
838 cerr<<_("FATAL: Synfig Version Mismatch")<<endl;
839 return SYNFIGTOOL_BADVERSION;
844 return SYNFIGTOOL_BLANK;
848 arg_list.push_back(argv[i]);
850 if((i=process_global_flags(arg_list)))
853 VERBOSE_OUT(1)<<_("verbosity set to ")<<verbosity<<endl;
854 synfig::Main synfig_main(dirname(progname),&p);
857 arg_list_t defaults, imageargs;
859 // Grab the defaults before the first file
860 extract_arg_cluster(arg_list,defaults);
862 while(arg_list.size())
865 job_list.push_front(Job());
869 job_list.front().filename=arg_list.front();
870 arg_list.pop_front();
872 extract_arg_cluster(arg_list,imageargs);
874 // Open the composition
876 job_list.front().root=open_canvas(job_list.front().filename);
878 if(!job_list.front().root)
880 cerr<<_("Unable to open ")<<job_list.front().filename<<"."<<endl;
881 cerr<<_("Throwing out job...")<<endl;
882 job_list.pop_front();
886 job_list.front().root->set_time(0);
889 extract_canvasid(imageargs,canvasid);
890 if(!canvasid.empty())
894 job_list.front().canvas=job_list.front().root->find_canvas(canvasid);
896 catch(Exception::IDNotFound)
898 cerr<<_("Unable to find canvas with ID \"")<<canvasid<<_("\" in ")<<job_list.front().filename<<"."<<endl;
899 cerr<<_("Throwing out job...")<<endl;
900 job_list.pop_front();
904 catch(Exception::BadLinkName)
906 cerr<<_("Invalid canvas name \"")<<canvasid<<_("\" in ")<<job_list.front().filename<<"."<<endl;
907 cerr<<_("Throwing out job...")<<endl;
908 job_list.pop_front();
914 job_list.front().canvas=job_list.front().root;
916 extract_RendDesc(imageargs,job_list.front().canvas->rend_desc());
917 extract_target(imageargs,target_name);
918 extract_threads(imageargs,threads);
919 job_list.front().quality=DEFAULT_QUALITY;
920 extract_quality(imageargs,job_list.front().quality);
921 VERBOSE_OUT(2)<<_("Quality set to ")<<job_list.front().quality<<endl;
922 job_list.front().desc=job_list.front().canvas->rend_desc();
923 extract_outfile(imageargs,job_list.front().outfilename);
927 string composite_file;
928 extract_append(imageargs,composite_file);
929 if(!composite_file.empty())
931 Canvas::Handle composite(open_canvas(composite_file));
934 Canvas::reverse_iterator iter;
935 for(iter=composite->rbegin();iter!=composite->rend();++iter)
937 Layer::Handle layer(*iter);
939 job_list.front().canvas->push_front(layer->clone());
941 VERBOSE_OUT(2)<<_("Appended contents of ")<<composite_file<<endl;
945 VERBOSE_OUT(4)<<_("Attempting to determine target/outfile...")<<endl;
947 // If the target type is not yet defined,
948 // try to figure it out from the outfile.
949 if(target_name.empty() && !job_list.front().outfilename.empty())
952 VERBOSE_OUT(3)<<_("Target name undefined, attempting to figure it out")<<endl;
953 string ext=string(find(job_list.front().outfilename.begin(),job_list.front().outfilename.end(),'.')+1,job_list.front().outfilename.end());
954 if(Target::ext_book().count(ext))
955 target_name=Target::ext_book()[ext];
959 catch(std::length_error)
961 synfig::warning("Length error caught when attempting to figure out target name");
964 // If the target type is STILL not yet defined, then
965 // set it to a some sort of default
966 if(target_name.empty())
968 VERBOSE_OUT(2)<<_("Defaulting to PNG target...")<<endl;
972 // If no output filename was provided, then
973 // create a output filename based on the
974 // given input filename. (ie: change the extension)
975 if(job_list.front().outfilename.empty())
977 job_list.front().outfilename=job_list.front().filename;
978 job_list.front().outfilename.erase(find(job_list.front().outfilename.begin(),job_list.front().outfilename.end(),'.'),job_list.front().outfilename.end());
979 job_list.front().outfilename+='.';
980 if(Target::book().count(target_name))
981 job_list.front().outfilename+=Target::book()[target_name].second;
983 job_list.front().outfilename+=target_name;
986 VERBOSE_OUT(4)<<"target_name="<<target_name<<endl;
987 VERBOSE_OUT(4)<<"outfile_name="<<job_list.front().outfilename<<endl;
989 VERBOSE_OUT(4)<<_("Creating the target...")<<endl;
990 job_list.front().target=synfig::Target::create(target_name,job_list.front().outfilename);
992 if(target_name=="sif")
994 job_list.front().sifout=true;
998 if(!job_list.front().target)
1000 cerr<<_("Unknown target for ")<<job_list.front().filename<<": "<<target_name<<endl;
1001 cerr<<_("Throwing out job...")<<endl;
1002 job_list.pop_front();
1005 job_list.front().sifout=false;
1008 // Set the Canvas on the Target
1009 if(job_list.front().target)
1011 VERBOSE_OUT(4)<<_("Setting the canvas on the target...")<<endl;
1012 job_list.front().target->set_canvas(job_list.front().canvas);
1013 VERBOSE_OUT(4)<<_("Setting the quality of the target...")<<endl;
1014 job_list.front().target->set_quality(job_list.front().quality);
1017 // Set the threads for the target
1018 if(job_list.front().target && Target_Scanline::Handle::cast_dynamic(job_list.front().target))
1020 Target_Scanline::Handle::cast_dynamic(job_list.front().target)->set_threads(threads);
1023 if(imageargs.size())
1025 cerr<<_("Unidentified arguments for ")<<job_list.front().filename<<": ";
1026 for(;imageargs.size();imageargs.pop_front())
1027 cerr<<' '<<imageargs.front();
1029 cerr<<_("Throwing out job...")<<endl;
1030 job_list.pop_front();
1034 //getline(cin,bleh);
1040 cerr<<_("Unidentified arguments:");
1041 for(;arg_list.size();arg_list.pop_front())
1042 cerr<<' '<<arg_list.front();
1044 return SYNFIGTOOL_UNKNOWNARGUMENT;
1047 if(!job_list.size())
1049 cerr<<_("Nothing to do!")<<endl;
1050 return SYNFIGTOOL_BORRED;
1053 for(;job_list.size();job_list.pop_front())
1055 VERBOSE_OUT(3)<<job_list.front().filename<<" -- "<<endl<<'\t'<<
1056 strprintf("w:%d, h:%d, a:%d, pxaspect:%f, imaspect:%f, span:%f",
1057 job_list.front().desc.get_w(),
1058 job_list.front().desc.get_h(),
1059 job_list.front().desc.get_antialias(),
1060 job_list.front().desc.get_pixel_aspect(),
1061 job_list.front().desc.get_image_aspect(),
1062 job_list.front().desc.get_span()
1064 strprintf("tl:[%f,%f], br:[%f,%f], focus:[%f,%f]",
1065 job_list.front().desc.get_tl()[0],job_list.front().desc.get_tl()[1],
1066 job_list.front().desc.get_br()[0],job_list.front().desc.get_br()[1],
1067 job_list.front().desc.get_focus()[0],job_list.front().desc.get_focus()[1]
1071 p.task(job_list.front().filename+" ==> "+job_list.front().outfilename);
1072 if(!job_list.front().sifout)
1074 VERBOSE_OUT(1)<<_("Rendering...")<<endl;
1077 // Call the render member of the target
1078 if(!job_list.front().target->render(&p))
1080 cerr<<"Render Failure."<<endl;
1081 return SYNFIGTOOL_RENDERFAILURE;
1083 if(print_benchmarks)
1085 cout<<job_list.front().filename+": Rendered in "<<timer()<<" seconds."<<endl;
1090 if(!save_canvas(job_list.front().outfilename,job_list.front().canvas))
1092 cerr<<"Render Failure."<<endl;
1093 return SYNFIGTOOL_RENDERFAILURE;
1100 VERBOSE_OUT(1)<<_("Done.")<<endl;
1102 return SYNFIGTOOL_OK;