1 /* === S Y N F I G ========================================================= */
3 ** \brief Target Class Implementation
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 ** Copyright (c) 2010 Diego Barrios Romero
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 ======================================================= */
33 #include "target_null.h"
34 #include "target_null_tile.h"
35 #include "targetparam.h"
37 using namespace synfig;
41 synfig::Target::Book* synfig::Target::book_;
42 synfig::Target::ExtBook* synfig::Target::ext_book_;
44 static synfig::Gamma* default_gamma_;
46 /* === P R O C E D U R E S ================================================= */
51 book_=new synfig::Target::Book();
52 ext_book_=new synfig::Target::ExtBook();
53 //! \todo Do not hard core gamma to 2.2
54 default_gamma_=new synfig::Gamma(1.0/2.2);
56 // At least one target must be available.
57 book()["null"].factory =
58 reinterpret_cast<synfig::Target::Factory>(&Target_Null::create);
59 book()["null"].filename = "null";
60 book()["null"].target_param = TargetParam();
61 ext_book()["null"]="null";
63 book()["null-tile"].factory =
64 reinterpret_cast<synfig::Target::Factory>(&Target_Null_Tile::create);
65 book()["null-tile"].filename = "null-tile";
66 book()["null-tile"].target_param = TargetParam();
67 ext_book()["null-tile"]="null-tile";
77 delete default_gamma_;
94 /* === M E T H O D S ======================================================= */
98 gamma_(*default_gamma_),
100 avoid_time_sync_(false)
105 synfig::Target::set_canvas(etl::handle<Canvas> c)
108 RendDesc desc=canvas->rend_desc();
109 set_rend_desc(&desc);
114 Target::create(const String &name, const String &filename,
115 synfig::TargetParam params)
117 if(!book().count(name))
118 return handle<Target>();
120 return Target::Handle(book()[name].factory(filename.c_str(), params));