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 ========================================================= */
63 SYNFIGTOOL_FILENOTFOUND =1,
66 SYNFIGTOOL_UNKNOWNARGUMENT =4,
67 SYNFIGTOOL_UNKNOWNERROR =5,
68 SYNFIGTOOL_INVALIDTARGET =6,
69 SYNFIGTOOL_RENDERFAILURE =7,
71 SYNFIGTOOL_BADVERSION =9,
72 SYNFIGTOOL_MISSINGARGUMENT =10
76 #define VERSION "unknown"
77 #define PACKAGE "synfig-tool"
80 #ifdef DEFAULT_QUALITY
81 #undef DEFAULT_QUALITY
84 #define DEFAULT_QUALITY 2
85 #define VERBOSE_OUT(x) if(verbosity>=(x))std::cerr
87 /* === G L O B A L S ======================================================= */
92 bool print_benchmarks=false;
94 /* === M E T H O D S ======================================================= */
96 class Progress : public synfig::ProgressCallback
102 Progress(const char *name):program(name) { }
105 task(const String &task)
107 VERBOSE_OUT(1)<<program<<": "<<task<<std::endl;
112 error(const String &task)
114 std::cerr<<program<<": "<<_("error")<<": "<<task<<std::endl;
119 warning(const String &task)
121 std::cerr<<program<<": "<<_("warning")<<": "<<task<<std::endl;
126 amount_complete(int /*current*/, int /*total*/)
132 class RenderProgress : public synfig::ProgressCallback
137 int clk_scanline; // The scanline at which the clock was reset
143 RenderProgress():clk_scanline(0), last_time(0) { }
146 task(const String &thetask)
153 error(const String &task)
155 std::cout<<_("error")<<": "<<task<<std::endl;
160 warning(const String &task)
162 std::cout<<_("warning")<<": "<<task<<std::endl;
167 amount_complete(int scanline, int h)
169 if(be_quiet)return true;
172 const float time(clk()*(float)(h-scanline)/(float)(scanline-clk_scanline));
173 const float delta(time-last_time);
175 int weeks=0,days=0,hours=0,minutes=0,seconds=0;
187 //cerr<<"reset"<<endl;
189 clk_scanline=scanline;
195 clk_scanline=scanline;
199 minutes++,seconds-=60;
207 cerr<<taskname<<": "<<_("Line")<<" "<<scanline<<_(" of ")<<h<<" -- ";
208 //cerr<<time/(h-clk_scanline)<<" ";
210 if(delta>=-time/(h-clk_scanline) )
213 if(delta>=0 && clk()>4.0 && scanline>clk_scanline+200)
215 //cerr<<"reset"<<endl;
217 clk_scanline=scanline;
234 cerr<<taskname<<": "<<_("DONE")<<" "<<endl;;
247 Canvas::Handle canvas;
248 Target::Handle target;
254 typedef list<String> arg_list_t;
255 typedef list<Job> job_list_t;
259 cout<<"GUID Test"<<endl;
262 cout<<synfig::GUID().get_string()<<' '<<synfig::GUID().get_string()<<endl;
266 void signal_test_func()
268 cout<<"**SIGNAL CALLED**"<<endl;
273 sigc::signal<void> sig;
274 sigc::connection conn;
275 cout<<"Signal Test"<<endl;
276 conn=sig.connect(sigc::ptr_fun(signal_test_func));
277 cout<<"Next line should exclaim signal called."<<endl;
280 cout<<"Next line should NOT exclaim signal called."<<endl;
285 /* === P R O C E D U R E S ================================================= */
287 void display_help(int amount)
292 Argument(const char *flag,const char *arg, string description)
294 const char spaces[]=" ";
296 cerr<<strprintf(" %s %s %s",flag, arg, spaces+strlen(arg)+strlen(flag)+1)+description<<endl;
298 cerr<<strprintf(" %s %s",flag,spaces+strlen(flag))+description<<endl;
302 cerr<<_("syntax: ")<<progname<<" [DEFAULT OPTIONS] ([SIF FILE] [SPECIFIC OPTIONS])..."<<endl;
306 Argument("-t","<output type>",_("Specify output target (Default:unknown)"));
307 Argument("-w","<pixel width>",_("Set the image width (Use zero for file default)"));
308 Argument("-h","<pixel height>",_("Set the image height (Use zero for file default)"));
309 Argument("-s","<image dist>",_("Set the diagonal size of image window (Span)"));
310 Argument("-a","<1...30>",_("Set antialias amount for parametric renderer."));
311 Argument("-Q","<0...10>",strprintf(_("Specify image quality for accelerated renderer (default=%d)"),DEFAULT_QUALITY).c_str());
312 Argument("-g","<amount>",_("Gamma (default=2.2)"));
313 Argument("-v",NULL,_("Verbose Output (add more for more verbosity)"));
314 Argument("-q",NULL,_("Quiet mode (No progress/time-remaining display)"));
315 Argument("-c","<canvas id>",_("Render the canvas with the given id instead of the root."));
316 Argument("-o","<output file>",_("Specify output filename"));
317 Argument("-T","<# of threads>",_("Enable multithreaded renderer using specified # of threads"));
319 Argument("-b",NULL,_("Print Benchmarks"));
321 Argument("--fps","<framerate>",_("Set the frame rate"));
322 Argument("--time","<time>",_("Render a single frame at <seconds>"));
323 Argument("--begin-time","<time>",_("Set the starting time"));
324 Argument("--end-time","<time>",_("Set the ending time"));
325 Argument("--dpi","<res>",_("Set the dots-per-inch"));
326 Argument("--append","<filename>",_("Append layers in <filename> to composition"));
328 Argument("--layer-info","<layer>",_("Print out layer's description, parameter info, etc."));
329 Argument("--layers",NULL,_("Print out the list of available layers"));
330 Argument("--targets",NULL,_("Print out the list of available targets"));
331 Argument("--importers",NULL,_("Print out the list of available importers"));
332 Argument("--valuenodes",NULL,_("Print out the list of available ValueNodes"));
333 Argument("--modules",NULL,_("Print out the list of loaded modules"));
334 Argument("--version",NULL,_("Print out version information"));
335 Argument("--info",NULL,_("Print out misc build information"));
336 Argument("--license",NULL,_("Print out license information"));
339 Argument("--guid-test",NULL,_("Test GUID generation"));
340 Argument("--signal-test",NULL,_("Test signal implementation"));
345 Argument("--help",NULL,_("Print out usage and syntax info"));
349 int process_global_flags(arg_list_t &arg_list)
351 arg_list_t::iterator iter, next;
353 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
356 return SYNFIGTOOL_OK;
358 if(*iter == "--signal-test")
361 return SYNFIGTOOL_HELP;
364 if(*iter == "--guid-test")
367 return SYNFIGTOOL_HELP;
371 if(*iter == "--help")
375 return SYNFIGTOOL_HELP;
378 if(*iter == "--info")
380 cout<<PACKAGE"-"VERSION<<endl;
381 cout<<"Compiled on "__DATE__ " at "__TIME__;
383 cout<<" with GCC "<<__VERSION__;
386 cout<<" with Microsoft Visual C++ "<<(_MSC_VER>>8)<<'.'<<(_MSC_VER&255);
388 #ifdef __TCPLUSPLUS__
389 cout<<" with Borland Turbo C++ "<<(__TCPLUSPLUS__>>8)<<'.'<<((__TCPLUSPLUS__&255)>>4)<<'.'<<(__TCPLUSPLUS__&15);
392 cout<<endl<<SYNFIG_COPYRIGHT<<endl;
394 return SYNFIGTOOL_HELP;
397 if(*iter == "--layers")
400 synfig::Main synfig_main(dirname(progname),&p);
401 synfig::Layer::Book::iterator iter=synfig::Layer::book().begin();
402 for(;iter!=synfig::Layer::book().end();iter++)
403 cout<<iter->first<<endl;
405 return SYNFIGTOOL_HELP;
408 if(*iter == "--layer-info")
411 synfig::Main synfig_main(dirname(progname),&p);
413 Layer::Handle layer=synfig::Layer::create(*iter);
414 cout<<"Layer Name: "<<layer->get_name()<<endl;
415 cout<<"Localized Layer Name: "<<layer->get_local_name()<<endl;
416 cout<<"Version: "<<layer->get_version()<<endl;
417 Layer::Vocab vocab=layer->get_param_vocab();
418 for(;!vocab.empty();vocab.pop_front())
420 cout<<"param - "<<vocab.front().get_name();
421 if(!vocab.front().get_critical())
422 cout<<" (not critical)";
423 cout<<endl<<"\tLocalized Name: "<<vocab.front().get_local_name()<<endl;
424 if(!vocab.front().get_description().empty())
425 cout<<"\tDescription: "<<vocab.front().get_description()<<endl;
426 if(!vocab.front().get_hint().empty())
427 cout<<"\tHint: "<<vocab.front().get_hint()<<endl;
430 return SYNFIGTOOL_HELP;
433 if(*iter == "--modules")
436 synfig::Main synfig_main(dirname(progname),&p);
437 synfig::Module::Book::iterator iter=synfig::Module::book().begin();
438 for(;iter!=synfig::Module::book().end();iter++)
439 cout<<iter->first<<endl;
440 return SYNFIGTOOL_HELP;
443 if(*iter == "--targets")
446 synfig::Main synfig_main(dirname(progname),&p);
447 synfig::Target::Book::iterator iter=synfig::Target::book().begin();
448 for(;iter!=synfig::Target::book().end();iter++)
449 cout<<iter->first<<endl;
451 return SYNFIGTOOL_HELP;
454 if(*iter == "--valuenodes")
457 synfig::Main synfig_main(dirname(progname),&p);
458 synfig::LinkableValueNode::Book::iterator iter=synfig::LinkableValueNode::book().begin();
459 for(;iter!=synfig::LinkableValueNode::book().end();iter++)
460 cout<<iter->first<<endl;
462 return SYNFIGTOOL_HELP;
465 if(*iter == "--importers")
468 synfig::Main synfig_main(dirname(progname),&p);
469 synfig::Importer::Book::iterator iter=synfig::Importer::book().begin();
470 for(;iter!=synfig::Importer::book().end();iter++)
471 cout<<iter->first<<endl;
473 return SYNFIGTOOL_HELP;
476 if(*iter == "--version")
478 cerr<<PACKAGE<<" "<<VERSION<<endl;
480 arg_list.erase(iter);
482 return SYNFIGTOOL_HELP;
485 if(*iter == "--license")
487 cerr<<PACKAGE<<" "<<VERSION<<endl;
488 cout<<SYNFIG_COPYRIGHT<<endl<<endl;
490 ** This package is free software; you can redistribute it and/or\n\
491 ** modify it under the terms of the GNU General Public License as\n\
492 ** published by the Free Software Foundation; either version 2 of\n\
493 ** the License, or (at your option) any later version.\n\
495 ** " << endl << endl;
496 arg_list.erase(iter);
498 return SYNFIGTOOL_HELP;
505 arg_list.erase(iter);
514 arg_list.erase(iter);
520 print_benchmarks=true;
522 arg_list.erase(iter);
528 return SYNFIGTOOL_OK;
531 int extract_arg_cluster(arg_list_t &arg_list,arg_list_t &cluster)
533 arg_list_t::iterator iter, next;
535 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
537 if(*iter->begin() != '-')
539 //cerr<<*iter->begin()<<"-----------"<<endl;
540 return SYNFIGTOOL_OK;
554 *iter=="--start-time" ||
555 *iter=="--begin-time" ||
556 *iter=="--end-time" ||
557 *iter=="--start-frame" ||
558 *iter=="--end-frame" ||
567 cluster.push_back(*iter);
568 arg_list.erase(iter);
570 if (iter==arg_list.end()) {
571 error("The `%s' flag requires a value. Use --help for a list of options.", cluster.back().c_str());
572 return SYNFIGTOOL_MISSINGARGUMENT;
576 cluster.push_back(*iter);
577 arg_list.erase(iter);
580 return SYNFIGTOOL_OK;
583 int extract_RendDesc(arg_list_t &arg_list,RendDesc &desc)
585 arg_list_t::iterator iter, next;
588 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
592 arg_list.erase(iter);
594 w=atoi(iter->c_str());
595 arg_list.erase(iter);
599 arg_list.erase(iter);
601 h=atoi(iter->c_str());
602 arg_list.erase(iter);
607 arg_list.erase(iter);
609 a=atoi(iter->c_str());
610 desc.set_antialias(a);
611 VERBOSE_OUT(1)<<strprintf(_("Antialiasing set to %d, (%d samples per pixel)"),a,a*a)<<endl;
612 arg_list.erase(iter);
616 arg_list.erase(iter);
618 span=atof(iter->c_str());
619 VERBOSE_OUT(1)<<strprintf(_("Span set to %d units"),span)<<endl;
620 arg_list.erase(iter);
622 else if(*iter=="--fps")
624 arg_list.erase(iter);
626 float fps=atof(iter->c_str());
627 desc.set_frame_rate(fps);
628 arg_list.erase(iter);
629 VERBOSE_OUT(1)<<strprintf(_("Frame rate set to %d frames per second"),fps)<<endl;
631 else if(*iter=="--dpi")
633 arg_list.erase(iter);
635 float dpi=atof(iter->c_str());
636 float dots_per_meter=dpi*39.3700787402;
637 desc.set_x_res(dots_per_meter).set_y_res(dots_per_meter);
638 arg_list.erase(iter);
639 VERBOSE_OUT(1)<<strprintf(_("Physical resolution set to %f dpi"),dpi)<<endl;
641 else if(*iter=="--dpi-x")
643 arg_list.erase(iter);
645 float dpi=atof(iter->c_str());
646 float dots_per_meter=dpi*39.3700787402;
647 desc.set_x_res(dots_per_meter);
648 arg_list.erase(iter);
649 VERBOSE_OUT(1)<<strprintf(_("Physical X resolution set to %f dpi"),dpi)<<endl;
651 else if(*iter=="--dpi-y")
653 arg_list.erase(iter);
655 float dpi=atof(iter->c_str());
656 float dots_per_meter=dpi*39.3700787402;
657 desc.set_y_res(dots_per_meter);
658 arg_list.erase(iter);
659 VERBOSE_OUT(1)<<strprintf(_("Physical Y resolution set to %f dpi"),dpi)<<endl;
661 else if(*iter=="--start-time" || *iter=="--begin-time")
663 arg_list.erase(iter);
665 desc.set_time_start(Time(*iter,desc.get_frame_rate()));
666 arg_list.erase(iter);
668 else if(*iter=="--end-time")
670 arg_list.erase(iter);
672 desc.set_time_end(Time(*iter,desc.get_frame_rate()));
673 arg_list.erase(iter);
675 else if(*iter=="--time")
677 arg_list.erase(iter);
679 desc.set_time(Time(*iter,desc.get_frame_rate()));
680 VERBOSE_OUT(1)<<_("Rendering frame at ")<<desc.get_time_start().get_string(desc.get_frame_rate())<<endl;
681 arg_list.erase(iter);
685 synfig::warning("Gamma argument is currently ignored");
686 arg_list.erase(iter);
688 //desc.set_gamma(Gamma(atof(iter->c_str())));
689 arg_list.erase(iter);
695 VERBOSE_OUT(1)<<strprintf(_("Resolution set to %dx%d"),w,h)<<endl;
701 VERBOSE_OUT(1)<<strprintf(_("Width set to %d pixels"),w)<<endl;
706 VERBOSE_OUT(1)<<strprintf(_("Height set to %d pixels"),h)<<endl;
712 return SYNFIGTOOL_OK;
715 int extract_quality(arg_list_t &arg_list,int &quality)
717 arg_list_t::iterator iter, next;
718 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
722 arg_list.erase(iter);
724 quality=atoi(iter->c_str());
725 VERBOSE_OUT(1)<<strprintf(_("Quality set to %d"),quality)<<endl;
726 arg_list.erase(iter);
730 return SYNFIGTOOL_OK;
733 int extract_threads(arg_list_t &arg_list,int &threads)
735 arg_list_t::iterator iter, next;
736 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
740 arg_list.erase(iter);
742 threads=atoi(iter->c_str());
743 VERBOSE_OUT(1)<<strprintf(_("Threads set to %d"),threads)<<endl;
744 arg_list.erase(iter);
748 return SYNFIGTOOL_OK;
751 int extract_target(arg_list_t &arg_list,string &type)
753 arg_list_t::iterator iter, next;
756 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
760 arg_list.erase(iter);
763 arg_list.erase(iter);
767 return SYNFIGTOOL_OK;
770 int extract_append(arg_list_t &arg_list,string &filename)
772 arg_list_t::iterator iter, next;
775 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
777 if(*iter=="--append")
779 arg_list.erase(iter);
782 arg_list.erase(iter);
786 return SYNFIGTOOL_OK;
789 int extract_outfile(arg_list_t &arg_list,string &outfile)
791 arg_list_t::iterator iter, next;
792 int ret=SYNFIGTOOL_FILENOTFOUND;
795 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
799 arg_list.erase(iter);
802 arg_list.erase(iter);
810 int extract_canvasid(arg_list_t &arg_list,string &canvasid)
812 arg_list_t::iterator iter, next;
815 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
819 arg_list.erase(iter);
822 arg_list.erase(iter);
826 return SYNFIGTOOL_OK;
829 /* === M E T H O D S ======================================================= */
831 /* === E N T R Y P O I N T ================================================= */
833 int main(int argc, char *argv[])
842 if(!SYNFIG_CHECK_VERSION())
844 cerr<<_("FATAL: Synfig Version Mismatch")<<endl;
845 return SYNFIGTOOL_BADVERSION;
850 return SYNFIGTOOL_BLANK;
854 arg_list.push_back(argv[i]);
856 if((i=process_global_flags(arg_list)))
859 VERBOSE_OUT(1)<<_("verbosity set to ")<<verbosity<<endl;
860 synfig::Main synfig_main(dirname(progname),&p);
863 arg_list_t defaults, imageargs;
866 // Grab the defaults before the first file
867 if ((ret = extract_arg_cluster(arg_list,defaults)) != SYNFIGTOOL_OK)
870 while(arg_list.size())
873 job_list.push_front(Job());
877 job_list.front().filename=arg_list.front();
878 arg_list.pop_front();
880 if ((ret = extract_arg_cluster(arg_list,imageargs)) != SYNFIGTOOL_OK)
883 // Open the composition
885 job_list.front().root=open_canvas(job_list.front().filename);
887 if(!job_list.front().root)
889 cerr<<_("Unable to open ")<<job_list.front().filename<<"."<<endl;
890 cerr<<_("Throwing out job...")<<endl;
891 job_list.pop_front();
895 job_list.front().root->set_time(0);
898 extract_canvasid(imageargs,canvasid);
899 if(!canvasid.empty())
903 job_list.front().canvas=job_list.front().root->find_canvas(canvasid);
905 catch(Exception::IDNotFound)
907 cerr<<_("Unable to find canvas with ID \"")<<canvasid<<_("\" in ")<<job_list.front().filename<<"."<<endl;
908 cerr<<_("Throwing out job...")<<endl;
909 job_list.pop_front();
913 catch(Exception::BadLinkName)
915 cerr<<_("Invalid canvas name \"")<<canvasid<<_("\" in ")<<job_list.front().filename<<"."<<endl;
916 cerr<<_("Throwing out job...")<<endl;
917 job_list.pop_front();
923 job_list.front().canvas=job_list.front().root;
925 extract_RendDesc(imageargs,job_list.front().canvas->rend_desc());
926 extract_target(imageargs,target_name);
927 extract_threads(imageargs,threads);
928 job_list.front().quality=DEFAULT_QUALITY;
929 extract_quality(imageargs,job_list.front().quality);
930 VERBOSE_OUT(2)<<_("Quality set to ")<<job_list.front().quality<<endl;
931 job_list.front().desc=job_list.front().canvas->rend_desc();
932 extract_outfile(imageargs,job_list.front().outfilename);
936 string composite_file;
937 extract_append(imageargs,composite_file);
938 if(!composite_file.empty())
940 Canvas::Handle composite(open_canvas(composite_file));
943 Canvas::reverse_iterator iter;
944 for(iter=composite->rbegin();iter!=composite->rend();++iter)
946 Layer::Handle layer(*iter);
948 job_list.front().canvas->push_front(layer->clone());
950 VERBOSE_OUT(2)<<_("Appended contents of ")<<composite_file<<endl;
954 VERBOSE_OUT(4)<<_("Attempting to determine target/outfile...")<<endl;
956 // If the target type is not yet defined,
957 // try to figure it out from the outfile.
958 if(target_name.empty() && !job_list.front().outfilename.empty())
960 VERBOSE_OUT(3)<<_("Target name undefined, attempting to figure it out")<<endl;
961 string ext=job_list.front().outfilename.substr(job_list.front().outfilename.rfind('.')+1);
962 if(Target::ext_book().count(ext))
963 target_name=Target::ext_book()[ext];
968 // If the target type is STILL not yet defined, then
969 // set it to a some sort of default
970 if(target_name.empty())
972 VERBOSE_OUT(2)<<_("Defaulting to PNG target...")<<endl;
976 // If no output filename was provided, then
977 // create a output filename based on the
978 // given input filename. (ie: change the extension)
979 if(job_list.front().outfilename.empty())
981 job_list.front().outfilename=job_list.front().filename;
982 job_list.front().outfilename.erase(find(job_list.front().outfilename.begin(),job_list.front().outfilename.end(),'.'),job_list.front().outfilename.end());
983 job_list.front().outfilename+='.';
984 if(Target::book().count(target_name))
985 job_list.front().outfilename+=Target::book()[target_name].second;
987 job_list.front().outfilename+=target_name;
990 VERBOSE_OUT(4)<<"target_name="<<target_name<<endl;
991 VERBOSE_OUT(4)<<"outfile_name="<<job_list.front().outfilename<<endl;
993 VERBOSE_OUT(4)<<_("Creating the target...")<<endl;
994 job_list.front().target=synfig::Target::create(target_name,job_list.front().outfilename);
996 if(target_name=="sif")
998 job_list.front().sifout=true;
1002 if(!job_list.front().target)
1004 cerr<<_("Unknown target for ")<<job_list.front().filename<<": "<<target_name<<endl;
1005 cerr<<_("Throwing out job...")<<endl;
1006 job_list.pop_front();
1009 job_list.front().sifout=false;
1012 // Set the Canvas on the Target
1013 if(job_list.front().target)
1015 VERBOSE_OUT(4)<<_("Setting the canvas on the target...")<<endl;
1016 job_list.front().target->set_canvas(job_list.front().canvas);
1017 VERBOSE_OUT(4)<<_("Setting the quality of the target...")<<endl;
1018 job_list.front().target->set_quality(job_list.front().quality);
1021 // Set the threads for the target
1022 if(job_list.front().target && Target_Scanline::Handle::cast_dynamic(job_list.front().target))
1024 Target_Scanline::Handle::cast_dynamic(job_list.front().target)->set_threads(threads);
1027 if(imageargs.size())
1029 cerr<<_("Unidentified arguments for ")<<job_list.front().filename<<": ";
1030 for(;imageargs.size();imageargs.pop_front())
1031 cerr<<' '<<imageargs.front();
1033 cerr<<_("Throwing out job...")<<endl;
1034 job_list.pop_front();
1038 //getline(cin,bleh);
1044 cerr<<_("Unidentified arguments:");
1045 for(;arg_list.size();arg_list.pop_front())
1046 cerr<<' '<<arg_list.front();
1048 return SYNFIGTOOL_UNKNOWNARGUMENT;
1051 if(!job_list.size())
1053 cerr<<_("Nothing to do!")<<endl;
1054 return SYNFIGTOOL_BORRED;
1057 for(;job_list.size();job_list.pop_front())
1059 VERBOSE_OUT(3)<<job_list.front().filename<<" -- "<<endl<<'\t'<<
1060 strprintf("w:%d, h:%d, a:%d, pxaspect:%f, imaspect:%f, span:%f",
1061 job_list.front().desc.get_w(),
1062 job_list.front().desc.get_h(),
1063 job_list.front().desc.get_antialias(),
1064 job_list.front().desc.get_pixel_aspect(),
1065 job_list.front().desc.get_image_aspect(),
1066 job_list.front().desc.get_span()
1068 strprintf("tl:[%f,%f], br:[%f,%f], focus:[%f,%f]",
1069 job_list.front().desc.get_tl()[0],job_list.front().desc.get_tl()[1],
1070 job_list.front().desc.get_br()[0],job_list.front().desc.get_br()[1],
1071 job_list.front().desc.get_focus()[0],job_list.front().desc.get_focus()[1]
1075 p.task(job_list.front().filename+" ==> "+job_list.front().outfilename);
1076 if(!job_list.front().sifout)
1078 VERBOSE_OUT(1)<<_("Rendering...")<<endl;
1081 // Call the render member of the target
1082 if(!job_list.front().target->render(&p))
1084 cerr<<"Render Failure."<<endl;
1085 return SYNFIGTOOL_RENDERFAILURE;
1087 if(print_benchmarks)
1089 cout<<job_list.front().filename+": Rendered in "<<timer()<<" seconds."<<endl;
1094 if(!save_canvas(job_list.front().outfilename,job_list.front().canvas))
1096 cerr<<"Render Failure."<<endl;
1097 return SYNFIGTOOL_RENDERFAILURE;
1104 VERBOSE_OUT(1)<<_("Done.")<<endl;
1106 return SYNFIGTOOL_OK;