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>
40 #include <synfig/loadcanvas.h>
41 #include <synfig/savecanvas.h>
42 #include <synfig/target_scanline.h>
43 #include <synfig/module.h>
44 #include <synfig/importer.h>
45 #include <synfig/layer.h>
46 #include <synfig/canvas.h>
47 #include <synfig/target.h>
48 #include <synfig/time.h>
49 #include <synfig/string.h>
50 #include <synfig/paramdesc.h>
51 #include <synfig/main.h>
52 #include <synfig/guid.h>
57 using namespace synfig;
59 /* === M A C R O S ========================================================= */
63 #define _(x) gettext(x)
72 SYNFIGTOOL_FILENOTFOUND = 1,
75 SYNFIGTOOL_UNKNOWNARGUMENT = 4,
76 SYNFIGTOOL_UNKNOWNERROR = 5,
77 SYNFIGTOOL_INVALIDTARGET = 6,
78 SYNFIGTOOL_RENDERFAILURE = 7,
80 SYNFIGTOOL_BADVERSION = 9,
81 SYNFIGTOOL_MISSINGARGUMENT =10
85 #define VERSION "unknown"
86 #define PACKAGE "synfig-tool"
89 #ifdef DEFAULT_QUALITY
90 #undef DEFAULT_QUALITY
93 #define DEFAULT_QUALITY 2
94 #define VERBOSE_OUT(x) if(verbosity>=(x))std::cerr
96 /* === G L O B A L S ======================================================= */
101 bool print_benchmarks=false;
103 /* === M E T H O D S ======================================================= */
105 class Progress : public synfig::ProgressCallback
111 Progress(const char *name):program(name) { }
114 task(const String &task)
116 VERBOSE_OUT(1)<<program<<": "<<task<<std::endl;
121 error(const String &task)
123 std::cerr<<program<<": "<<_("error")<<": "<<task<<std::endl;
128 warning(const String &task)
130 std::cerr<<program<<": "<<_("warning")<<": "<<task<<std::endl;
135 amount_complete(int /*current*/, int /*total*/)
141 class RenderProgress : public synfig::ProgressCallback
146 int clk_scanline; // The scanline at which the clock was reset
152 RenderProgress():clk_scanline(0), last_time(0) { }
155 task(const String &thetask)
162 error(const String &task)
164 std::cout<<_("error")<<": "<<task<<std::endl;
169 warning(const String &task)
171 std::cout<<_("warning")<<": "<<task<<std::endl;
176 amount_complete(int scanline, int h)
178 if(be_quiet)return true;
181 const float time(clk()*(float)(h-scanline)/(float)(scanline-clk_scanline));
182 const float delta(time-last_time);
184 int weeks=0,days=0,hours=0,minutes=0,seconds=0;
196 //cerr<<"reset"<<endl;
198 clk_scanline=scanline;
204 clk_scanline=scanline;
208 minutes++,seconds-=60;
216 cerr<<taskname<<": "<<_("Line")<<" "<<scanline<<_(" of ")<<h<<" -- ";
217 //cerr<<time/(h-clk_scanline)<<" ";
219 if(delta>=-time/(h-clk_scanline) )
222 if(delta>=0 && clk()>4.0 && scanline>clk_scanline+200)
224 //cerr<<"reset"<<endl;
226 clk_scanline=scanline;
243 cerr<<taskname<<": "<<_("DONE")<<" "<<endl;;
256 Canvas::Handle canvas;
257 Target::Handle target;
263 typedef list<String> arg_list_t;
264 typedef list<Job> job_list_t;
268 cout<<"GUID Test"<<endl;
271 cout<<synfig::GUID().get_string()<<' '<<synfig::GUID().get_string()<<endl;
275 void signal_test_func()
277 cout<<"**SIGNAL CALLED**"<<endl;
282 sigc::signal<void> sig;
283 sigc::connection conn;
284 cout<<"Signal Test"<<endl;
285 conn=sig.connect(sigc::ptr_fun(signal_test_func));
286 cout<<"Next line should exclaim signal called."<<endl;
289 cout<<"Next line should NOT exclaim signal called."<<endl;
294 /* === P R O C E D U R E S ================================================= */
296 void display_help(int amount)
301 Argument(const char *flag,const char *arg, string description)
303 const char spaces[]=" ";
305 cerr<<strprintf(" %s %s %s",flag, arg, spaces+strlen(arg)+strlen(flag)+1)+description<<endl;
307 cerr<<strprintf(" %s %s",flag,spaces+strlen(flag))+description<<endl;
311 cerr << endl << _("syntax: ") << progname << " [DEFAULT OPTIONS] ([SIF FILE] [SPECIFIC OPTIONS])..." << endl << endl;
314 Argument("--help",NULL,_("Print out usage and syntax info"));
317 Argument("-t","<output type>",_("Specify output target (Default:unknown)"));
318 Argument("-w","<pixel width>",_("Set the image width (Use zero for file default)"));
319 Argument("-h","<pixel height>",_("Set the image height (Use zero for file default)"));
320 Argument("-s","<image dist>",_("Set the diagonal size of image window (Span)"));
321 Argument("-a","<1...30>",_("Set antialias amount for parametric renderer."));
322 Argument("-Q","<0...10>",strprintf(_("Specify image quality for accelerated renderer (default=%d)"),DEFAULT_QUALITY).c_str());
323 Argument("-g","<amount>",_("Gamma (default=2.2)"));
324 Argument("-v",NULL,_("Verbose Output (add more for more verbosity)"));
325 Argument("-q",NULL,_("Quiet mode (No progress/time-remaining display)"));
326 Argument("-c","<canvas id>",_("Render the canvas with the given id instead of the root."));
327 Argument("-o","<output file>",_("Specify output filename"));
328 Argument("-T","<# of threads>",_("Enable multithreaded renderer using specified # of threads"));
329 Argument("-b",NULL,_("Print Benchmarks"));
330 Argument("--fps","<framerate>",_("Set the frame rate"));
331 Argument("--time","<time>",_("Render a single frame at <seconds>"));
332 Argument("--begin-time","<time>",_("Set the starting time"));
333 Argument("--end-time","<time>",_("Set the ending time"));
334 Argument("--dpi","<res>",_("Set the dots-per-inch"));
335 Argument("--append","<filename>",_("Append layers in <filename> to composition"));
336 Argument("--layer-info","<layer>",_("Print out layer's description, parameter info, etc."));
337 Argument("--layers",NULL,_("Print out the list of available layers"));
338 Argument("--targets",NULL,_("Print out the list of available targets"));
339 Argument("--importers",NULL,_("Print out the list of available importers"));
340 Argument("--valuenodes",NULL,_("Print out the list of available ValueNodes"));
341 Argument("--modules",NULL,_("Print out the list of loaded modules"));
342 Argument("--version",NULL,_("Print out version information"));
343 Argument("--info",NULL,_("Print out misc build information"));
344 Argument("--license",NULL,_("Print out license information"));
347 Argument("--guid-test",NULL,_("Test GUID generation"));
348 Argument("--signal-test",NULL,_("Test signal implementation"));
355 int process_global_flags(arg_list_t &arg_list)
357 arg_list_t::iterator iter, next;
359 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
362 return SYNFIGTOOL_OK;
364 if(*iter == "--signal-test")
367 return SYNFIGTOOL_HELP;
370 if(*iter == "--guid-test")
373 return SYNFIGTOOL_HELP;
376 if(*iter == "--help")
379 return SYNFIGTOOL_HELP;
382 if(*iter == "--info")
384 cout<<PACKAGE"-"VERSION<<endl;
385 cout<<"Compiled on "__DATE__ " at "__TIME__;
387 cout<<" with GCC "<<__VERSION__;
390 cout<<" with Microsoft Visual C++ "<<(_MSC_VER>>8)<<'.'<<(_MSC_VER&255);
392 #ifdef __TCPLUSPLUS__
393 cout<<" with Borland Turbo C++ "<<(__TCPLUSPLUS__>>8)<<'.'<<((__TCPLUSPLUS__&255)>>4)<<'.'<<(__TCPLUSPLUS__&15);
396 cout<<endl<<SYNFIG_COPYRIGHT<<endl;
398 return SYNFIGTOOL_HELP;
401 if(*iter == "--layers")
404 synfig::Main synfig_main(dirname(progname),&p);
405 synfig::Layer::Book::iterator iter=synfig::Layer::book().begin();
406 for(;iter!=synfig::Layer::book().end();iter++)
407 cout<<iter->first<<endl;
409 return SYNFIGTOOL_HELP;
412 if(*iter == "--layer-info")
415 synfig::Main synfig_main(dirname(progname),&p);
417 Layer::Handle layer=synfig::Layer::create(*iter);
418 cout<<"Layer Name: "<<layer->get_name()<<endl;
419 cout<<"Localized Layer Name: "<<layer->get_local_name()<<endl;
420 cout<<"Version: "<<layer->get_version()<<endl;
421 Layer::Vocab vocab=layer->get_param_vocab();
422 for(;!vocab.empty();vocab.pop_front())
424 cout<<"param - "<<vocab.front().get_name();
425 if(!vocab.front().get_critical())
426 cout<<" (not critical)";
427 cout<<endl<<"\tLocalized Name: "<<vocab.front().get_local_name()<<endl;
428 if(!vocab.front().get_description().empty())
429 cout<<"\tDescription: "<<vocab.front().get_description()<<endl;
430 if(!vocab.front().get_hint().empty())
431 cout<<"\tHint: "<<vocab.front().get_hint()<<endl;
434 return SYNFIGTOOL_HELP;
437 if(*iter == "--modules")
440 synfig::Main synfig_main(dirname(progname),&p);
441 synfig::Module::Book::iterator iter=synfig::Module::book().begin();
442 for(;iter!=synfig::Module::book().end();iter++)
443 cout<<iter->first<<endl;
444 return SYNFIGTOOL_HELP;
447 if(*iter == "--targets")
450 synfig::Main synfig_main(dirname(progname),&p);
451 synfig::Target::Book::iterator iter=synfig::Target::book().begin();
452 for(;iter!=synfig::Target::book().end();iter++)
453 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;
464 return SYNFIGTOOL_HELP;
467 if(*iter == "--importers")
470 synfig::Main synfig_main(dirname(progname),&p);
471 synfig::Importer::Book::iterator iter=synfig::Importer::book().begin();
472 for(;iter!=synfig::Importer::book().end();iter++)
473 cout<<iter->first<<endl;
474 return SYNFIGTOOL_HELP;
477 if(*iter == "--version")
479 cerr<<PACKAGE<<" "<<VERSION<<endl;
480 arg_list.erase(iter);
481 return SYNFIGTOOL_HELP;
484 if(*iter == "--license")
486 cerr<<PACKAGE<<" "<<VERSION<<endl;
487 cout<<SYNFIG_COPYRIGHT<<endl<<endl;
489 ** This package is free software; you can redistribute it and/or\n\
490 ** modify it under the terms of the GNU General Public License as\n\
491 ** published by the Free Software Foundation; either version 2 of\n\
492 ** the License, or (at your option) any later version.\n\
494 ** " << endl << endl;
495 arg_list.erase(iter);
496 return SYNFIGTOOL_HELP;
502 arg_list.erase(iter);
509 arg_list.erase(iter);
514 print_benchmarks=true;
515 arg_list.erase(iter);
520 return SYNFIGTOOL_OK;
523 int extract_arg_cluster(arg_list_t &arg_list,arg_list_t &cluster)
525 arg_list_t::iterator iter, next;
527 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
529 if(*iter->begin() != '-')
531 //cerr<<*iter->begin()<<"-----------"<<endl;
532 return SYNFIGTOOL_OK;
546 *iter=="--start-time" ||
547 *iter=="--begin-time" ||
548 *iter=="--end-time" ||
549 *iter=="--start-frame" ||
550 *iter=="--end-frame" ||
559 cluster.push_back(*iter);
560 arg_list.erase(iter);
562 if (iter==arg_list.end()) {
563 error("The `%s' flag requires a value. Use --help for a list of options.", cluster.back().c_str());
564 return SYNFIGTOOL_MISSINGARGUMENT;
568 cluster.push_back(*iter);
569 arg_list.erase(iter);
572 return SYNFIGTOOL_OK;
575 int extract_RendDesc(arg_list_t &arg_list,RendDesc &desc)
577 arg_list_t::iterator iter, next;
580 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
584 arg_list.erase(iter);
586 w=atoi(iter->c_str());
587 arg_list.erase(iter);
591 arg_list.erase(iter);
593 h=atoi(iter->c_str());
594 arg_list.erase(iter);
599 arg_list.erase(iter);
601 a=atoi(iter->c_str());
602 desc.set_antialias(a);
603 VERBOSE_OUT(1)<<strprintf(_("Antialiasing set to %d, (%d samples per pixel)"),a,a*a)<<endl;
604 arg_list.erase(iter);
608 arg_list.erase(iter);
610 span=atof(iter->c_str());
611 VERBOSE_OUT(1)<<strprintf(_("Span set to %d units"),span)<<endl;
612 arg_list.erase(iter);
614 else if(*iter=="--fps")
616 arg_list.erase(iter);
618 float fps=atof(iter->c_str());
619 desc.set_frame_rate(fps);
620 arg_list.erase(iter);
621 VERBOSE_OUT(1)<<strprintf(_("Frame rate set to %d frames per second"),fps)<<endl;
623 else if(*iter=="--dpi")
625 arg_list.erase(iter);
627 float dpi=atof(iter->c_str());
628 float dots_per_meter=dpi*39.3700787402;
629 desc.set_x_res(dots_per_meter).set_y_res(dots_per_meter);
630 arg_list.erase(iter);
631 VERBOSE_OUT(1)<<strprintf(_("Physical resolution set to %f dpi"),dpi)<<endl;
633 else if(*iter=="--dpi-x")
635 arg_list.erase(iter);
637 float dpi=atof(iter->c_str());
638 float dots_per_meter=dpi*39.3700787402;
639 desc.set_x_res(dots_per_meter);
640 arg_list.erase(iter);
641 VERBOSE_OUT(1)<<strprintf(_("Physical X resolution set to %f dpi"),dpi)<<endl;
643 else if(*iter=="--dpi-y")
645 arg_list.erase(iter);
647 float dpi=atof(iter->c_str());
648 float dots_per_meter=dpi*39.3700787402;
649 desc.set_y_res(dots_per_meter);
650 arg_list.erase(iter);
651 VERBOSE_OUT(1)<<strprintf(_("Physical Y resolution set to %f dpi"),dpi)<<endl;
653 else if(*iter=="--start-time" || *iter=="--begin-time")
655 arg_list.erase(iter);
657 desc.set_time_start(Time(*iter,desc.get_frame_rate()));
658 arg_list.erase(iter);
660 else if(*iter=="--end-time")
662 arg_list.erase(iter);
664 desc.set_time_end(Time(*iter,desc.get_frame_rate()));
665 arg_list.erase(iter);
667 else if(*iter=="--time")
669 arg_list.erase(iter);
671 desc.set_time(Time(*iter,desc.get_frame_rate()));
672 VERBOSE_OUT(1)<<_("Rendering frame at ")<<desc.get_time_start().get_string(desc.get_frame_rate())<<endl;
673 arg_list.erase(iter);
677 synfig::warning("Gamma argument is currently ignored");
678 arg_list.erase(iter);
680 //desc.set_gamma(Gamma(atof(iter->c_str())));
681 arg_list.erase(iter);
687 VERBOSE_OUT(1)<<strprintf(_("Resolution set to %dx%d"),w,h)<<endl;
693 VERBOSE_OUT(1)<<strprintf(_("Width set to %d pixels"),w)<<endl;
698 VERBOSE_OUT(1)<<strprintf(_("Height set to %d pixels"),h)<<endl;
704 return SYNFIGTOOL_OK;
707 int extract_quality(arg_list_t &arg_list,int &quality)
709 arg_list_t::iterator iter, next;
710 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
714 arg_list.erase(iter);
716 quality=atoi(iter->c_str());
717 VERBOSE_OUT(1)<<strprintf(_("Quality set to %d"),quality)<<endl;
718 arg_list.erase(iter);
722 return SYNFIGTOOL_OK;
725 int extract_threads(arg_list_t &arg_list,int &threads)
727 arg_list_t::iterator iter, next;
728 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
732 arg_list.erase(iter);
734 threads=atoi(iter->c_str());
735 VERBOSE_OUT(1)<<strprintf(_("Threads set to %d"),threads)<<endl;
736 arg_list.erase(iter);
740 return SYNFIGTOOL_OK;
743 int extract_target(arg_list_t &arg_list,string &type)
745 arg_list_t::iterator iter, next;
748 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
752 arg_list.erase(iter);
755 arg_list.erase(iter);
759 return SYNFIGTOOL_OK;
762 int extract_append(arg_list_t &arg_list,string &filename)
764 arg_list_t::iterator iter, next;
767 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
769 if(*iter=="--append")
771 arg_list.erase(iter);
774 arg_list.erase(iter);
778 return SYNFIGTOOL_OK;
781 int extract_outfile(arg_list_t &arg_list,string &outfile)
783 arg_list_t::iterator iter, next;
784 int ret=SYNFIGTOOL_FILENOTFOUND;
787 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
791 arg_list.erase(iter);
794 arg_list.erase(iter);
802 int extract_canvasid(arg_list_t &arg_list,string &canvasid)
804 arg_list_t::iterator iter, next;
807 for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++)
811 arg_list.erase(iter);
814 arg_list.erase(iter);
818 return SYNFIGTOOL_OK;
821 /* === M E T H O D S ======================================================= */
823 /* === E N T R Y P O I N T ================================================= */
825 int main(int argc, char *argv[])
831 setlocale(LC_ALL, "");
834 bindtextdomain("synfig", LOCALEDIR);
835 textdomain("synfig");
841 if(!SYNFIG_CHECK_VERSION())
843 cerr<<_("FATAL: Synfig Version Mismatch")<<endl;
844 return SYNFIGTOOL_BADVERSION;
849 return SYNFIGTOOL_BLANK;
853 arg_list.push_back(argv[i]);
855 if((i=process_global_flags(arg_list)))
858 VERBOSE_OUT(1)<<_("verbosity set to ")<<verbosity<<endl;
859 synfig::Main synfig_main(dirname(progname),&p);
862 arg_list_t defaults, imageargs;
865 // Grab the defaults before the first file
866 if ((ret = extract_arg_cluster(arg_list,defaults)) != SYNFIGTOOL_OK)
869 while(arg_list.size())
872 job_list.push_front(Job());
876 job_list.front().filename=arg_list.front();
877 arg_list.pop_front();
879 if ((ret = extract_arg_cluster(arg_list,imageargs)) != SYNFIGTOOL_OK)
882 // Open the composition
883 job_list.front().root=open_canvas(job_list.front().filename);
885 if(!job_list.front().root)
887 cerr<<_("Unable to open ")<<job_list.front().filename<<"."<<endl;
888 cerr<<_("Throwing out job...")<<endl;
889 job_list.pop_front();
893 job_list.front().root->set_time(0);
896 extract_canvasid(imageargs,canvasid);
897 if(!canvasid.empty())
901 job_list.front().canvas=job_list.front().root->find_canvas(canvasid);
903 catch(Exception::IDNotFound)
905 cerr<<_("Unable to find canvas with ID \"")<<canvasid<<_("\" in ")<<job_list.front().filename<<"."<<endl;
906 cerr<<_("Throwing out job...")<<endl;
907 job_list.pop_front();
911 catch(Exception::BadLinkName)
913 cerr<<_("Invalid canvas name \"")<<canvasid<<_("\" in ")<<job_list.front().filename<<"."<<endl;
914 cerr<<_("Throwing out job...")<<endl;
915 job_list.pop_front();
921 job_list.front().canvas=job_list.front().root;
923 extract_RendDesc(imageargs,job_list.front().canvas->rend_desc());
924 extract_target(imageargs,target_name);
925 extract_threads(imageargs,threads);
926 job_list.front().quality=DEFAULT_QUALITY;
927 extract_quality(imageargs,job_list.front().quality);
928 VERBOSE_OUT(2)<<_("Quality set to ")<<job_list.front().quality<<endl;
929 job_list.front().desc=job_list.front().canvas->rend_desc();
930 extract_outfile(imageargs,job_list.front().outfilename);
934 string composite_file;
935 extract_append(imageargs,composite_file);
936 if(!composite_file.empty())
938 Canvas::Handle composite(open_canvas(composite_file));
941 Canvas::reverse_iterator iter;
942 for(iter=composite->rbegin();iter!=composite->rend();++iter)
944 Layer::Handle layer(*iter);
946 job_list.front().canvas->push_front(layer->clone());
948 VERBOSE_OUT(2)<<_("Appended contents of ")<<composite_file<<endl;
952 VERBOSE_OUT(4)<<_("Attempting to determine target/outfile...")<<endl;
954 // If the target type is not yet defined,
955 // try to figure it out from the outfile.
956 if(target_name.empty() && !job_list.front().outfilename.empty())
958 VERBOSE_OUT(3)<<_("Target name undefined, attempting to figure it out")<<endl;
959 string ext = filename_extension(job_list.front().outfilename);
960 if (ext.length()) ext = ext.substr(1);
961 if(Target::ext_book().count(ext))
962 target_name=Target::ext_book()[ext];
967 // If the target type is STILL not yet defined, then
968 // set it to a some sort of default
969 if(target_name.empty())
971 VERBOSE_OUT(2)<<_("Defaulting to PNG target...")<<endl;
975 // If no output filename was provided, then
976 // create a output filename based on the
977 // given input filename. (ie: change the extension)
978 if(job_list.front().outfilename.empty())
980 job_list.front().outfilename = filename_sans_extension(job_list.front().filename) + '.';
981 if(Target::book().count(target_name))
982 job_list.front().outfilename+=Target::book()[target_name].second;
984 job_list.front().outfilename+=target_name;
987 VERBOSE_OUT(4)<<"target_name="<<target_name<<endl;
988 VERBOSE_OUT(4)<<"outfile_name="<<job_list.front().outfilename<<endl;
990 VERBOSE_OUT(4)<<_("Creating the target...")<<endl;
991 job_list.front().target=synfig::Target::create(target_name,job_list.front().outfilename);
993 if(target_name=="sif")
995 job_list.front().sifout=true;
999 if(!job_list.front().target)
1001 cerr<<_("Unknown target for ")<<job_list.front().filename<<": "<<target_name<<endl;
1002 cerr<<_("Throwing out job...")<<endl;
1003 job_list.pop_front();
1006 job_list.front().sifout=false;
1009 // Set the Canvas on the Target
1010 if(job_list.front().target)
1012 VERBOSE_OUT(4)<<_("Setting the canvas on the target...")<<endl;
1013 job_list.front().target->set_canvas(job_list.front().canvas);
1014 VERBOSE_OUT(4)<<_("Setting the quality of the target...")<<endl;
1015 job_list.front().target->set_quality(job_list.front().quality);
1018 // Set the threads for the target
1019 if(job_list.front().target && Target_Scanline::Handle::cast_dynamic(job_list.front().target))
1021 Target_Scanline::Handle::cast_dynamic(job_list.front().target)->set_threads(threads);
1024 if(imageargs.size())
1026 cerr<<_("Unidentified arguments for ")<<job_list.front().filename<<": ";
1027 for(;imageargs.size();imageargs.pop_front())
1028 cerr<<' '<<imageargs.front();
1030 cerr<<_("Throwing out job...")<<endl;
1031 job_list.pop_front();
1039 cerr<<_("Unidentified arguments:");
1040 for(;arg_list.size();arg_list.pop_front())
1041 cerr<<' '<<arg_list.front();
1043 return SYNFIGTOOL_UNKNOWNARGUMENT;
1046 if(!job_list.size())
1048 cerr<<_("Nothing to do!")<<endl;
1049 return SYNFIGTOOL_BORED;
1052 for(;job_list.size();job_list.pop_front())
1054 VERBOSE_OUT(3)<<job_list.front().filename<<" -- "<<endl<<'\t'<<
1055 strprintf("w:%d, h:%d, a:%d, pxaspect:%f, imaspect:%f, span:%f",
1056 job_list.front().desc.get_w(),
1057 job_list.front().desc.get_h(),
1058 job_list.front().desc.get_antialias(),
1059 job_list.front().desc.get_pixel_aspect(),
1060 job_list.front().desc.get_image_aspect(),
1061 job_list.front().desc.get_span()
1063 strprintf("tl:[%f,%f], br:[%f,%f], focus:[%f,%f]",
1064 job_list.front().desc.get_tl()[0],job_list.front().desc.get_tl()[1],
1065 job_list.front().desc.get_br()[0],job_list.front().desc.get_br()[1],
1066 job_list.front().desc.get_focus()[0],job_list.front().desc.get_focus()[1]
1070 p.task(job_list.front().filename+" ==> "+job_list.front().outfilename);
1071 if(!job_list.front().sifout)
1073 VERBOSE_OUT(1)<<_("Rendering...")<<endl;
1076 // Call the render member of the target
1077 if(!job_list.front().target->render(&p))
1079 cerr<<"Render Failure."<<endl;
1080 return SYNFIGTOOL_RENDERFAILURE;
1082 if(print_benchmarks)
1084 cout<<job_list.front().filename+": Rendered in "<<timer()<<" seconds."<<endl;
1089 if(!save_canvas(job_list.front().outfilename,job_list.front().canvas))
1091 cerr<<"Render Failure."<<endl;
1092 return SYNFIGTOOL_RENDERFAILURE;
1099 VERBOSE_OUT(1)<<_("Done.")<<endl;
1101 return SYNFIGTOOL_OK;