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 ======================================================= */
26 #define SYNFIG_NO_ANGLE
35 #include "target_null.h"
36 #include "target_null_tile.h"
37 #include "targetparam.h"
39 using namespace synfig;
43 synfig::Target::Book* synfig::Target::book_;
44 synfig::Target::ExtBook* synfig::Target::ext_book_;
46 static synfig::Gamma* default_gamma_;
48 /* === P R O C E D U R E S ================================================= */
53 book_=new synfig::Target::Book();
54 ext_book_=new synfig::Target::ExtBook();
56 default_gamma_=new synfig::Gamma(1.0/2.2);
57 //default_gamma_->set_black_level(0.05); // Default to 5% black level.
59 // At least one target must be available.
60 book()["null"].factory =
61 reinterpret_cast<synfig::Target::Factory>(&Target_Null::create);
62 book()["null"].filename = "null";
63 book()["null"].target_param = TargetParam();
64 ext_book()["null"]="null";
66 book()["null-tile"].factory =
67 reinterpret_cast<synfig::Target::Factory>(&Target_Null_Tile::create);
68 book()["null-tile"].filename = "null-tile";
69 book()["null-tile"].target_param = TargetParam();
70 ext_book()["null-tile"]="null-tile";
80 delete default_gamma_;
97 /* === M E T H O D S ======================================================= */
101 gamma_(*default_gamma_),
103 avoid_time_sync_(false)
108 synfig::Target::set_canvas(etl::handle<Canvas> c)
111 RendDesc desc=canvas->rend_desc();
112 set_rend_desc(&desc);
117 Target::create(const String &name, const String &filename,
118 synfig::TargetParam params)
120 if(!book().count(name))
121 return handle<Target>();
123 return Target::Handle(book()[name].factory(filename.c_str(), params));