Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-core / tags / synfig_0_61_07_rc3 / src / modules / lyr_std / booleancurve.cpp
1 /* === S Y N F I G ========================================================= */
2 /*!     \file booleancurve.cpp
3 **      \brief Boolean Curve Implementation File
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **
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.
14 **
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.
19 **      \endlegal
20 */
21 /* ========================================================================= */
22
23 /* === H E A D E R S ======================================================= */
24
25 #ifdef USING_PCH
26 #       include "pch.h"
27 #else
28 #ifdef HAVE_CONFIG_H
29 #       include <config.h>
30 #endif
31
32 #include "booleancurve.h"
33
34 #include <synfig/string.h>
35 #include <synfig/time.h>
36 #include <synfig/context.h>
37 #include <synfig/paramdesc.h>
38 #include <synfig/renddesc.h>
39 #include <synfig/surface.h>
40 #include <synfig/value.h>
41 #include <synfig/valuenode.h>
42
43 #endif
44
45 /* === U S I N G =========================================================== */
46
47 using namespace std;
48 using namespace etl;
49 using namespace synfig;
50
51 /* === M A C R O S ========================================================= */
52
53 /* === G L O B A L S ======================================================= */
54
55 /* === P R O C E D U R E S ================================================= */
56
57 /* === M E T H O D S ======================================================= */
58
59 /* === E N T R Y P O I N T ================================================= */
60
61 BooleanCurve::BooleanCurve()
62 {
63 }
64
65 BooleanCurve::~BooleanCurve()
66 {
67 }
68
69 bool BooleanCurve::set_param(const String & param, const synfig::ValueBase &value)
70 {
71         if(param=="regions" && value.same_type_as(regions))
72         {
73                 vector<BLinePoint> bv;
74                 int size = value.get_list().size();
75
76                 const vector<ValueBase> &vlist = value.get_list();
77
78                 regions.clear();
79                 for(int i = 0; i < size; ++i)
80                 {
81                         regions.push_back(vector<BLinePoint>(vlist[i].get_list().begin(),vlist[i].get_list().end()));
82                 }
83                 return true;
84         }
85
86         return Layer_Shape::set_param(param,value);
87 }
88
89 ValueBase BooleanCurve::get_param(const String & param)const
90 {
91         EXPORT(regions);
92
93         EXPORT_NAME();
94         EXPORT_VERSION();
95
96         return Layer_Shape::get_param(param);
97 }
98
99 Layer::Vocab BooleanCurve::get_param_vocab()const
100 {
101         Layer::Vocab ret(Layer_Shape::get_param_vocab());
102
103         ret.push_back(ParamDesc("regions")
104                 .set_local_name(_("Region Set"))
105                 .set_description(_("Set of regions to combine"))
106         );
107
108         return ret;
109 }
110
111 Color BooleanCurve::get_color(Context /*context*/, const Point &/*pos*/)const
112 {
113         Color c(Color::alpha());
114
115         return c;
116 }
117
118 bool BooleanCurve::accelerated_render(Context /*context*/,Surface */*surface*/,int /*quality*/, const RendDesc &/*renddesc*/, ProgressCallback */*cb*/)const
119 {
120         return false;
121 }