moreupdates
[synfig.git] / synfig-core / trunk / src / modules / lyr_std / booleancurve.cpp
1 /* === S Y N F I G ========================================================= */
2 /*!     \file boolean_curve.cpp
3 **      \brief Boolean Curve Implementation File
4 **
5 **      $Id: booleancurve.cpp,v 1.1.1.1 2005/01/04 01:23:10 darco Exp $
6 **
7 **      \legal
8 **      Copyright (c) 2002 Robert B. Quattlebaum Jr.
9 **
10 **      This software and associated documentation
11 **      are CONFIDENTIAL and PROPRIETARY property of
12 **      the above-mentioned copyright holder.
13 **
14 **      You may not copy, print, publish, or in any
15 **      other way distribute this software without
16 **      a prior written agreement with
17 **      the copyright holder.
18 **      \endlegal
19 */
20 /* ========================================================================= */
21
22 /* === H E A D E R S ======================================================= */
23
24 #ifdef USING_PCH
25 #       include "pch.h"
26 #else
27 #ifdef HAVE_CONFIG_H
28 #       include <config.h>
29 #endif
30
31 #include "booleancurve.h"
32
33 #include <synfig/string.h>
34 #include <synfig/time.h>
35 #include <synfig/context.h>
36 #include <synfig/paramdesc.h>
37 #include <synfig/renddesc.h>
38 #include <synfig/surface.h>
39 #include <synfig/value.h>
40 #include <synfig/valuenode.h>
41
42 #endif
43
44 /* === U S I N G =========================================================== */
45
46 using namespace std;
47 using namespace etl;
48 using namespace synfig;
49
50 /* === M A C R O S ========================================================= */
51
52 /* === G L O B A L S ======================================================= */
53
54 /* === P R O C E D U R E S ================================================= */
55
56 /* === M E T H O D S ======================================================= */
57
58 /* === E N T R Y P O I N T ================================================= */
59
60 BooleanCurve::BooleanCurve()
61 {
62 }
63
64 BooleanCurve::~BooleanCurve()
65 {
66 }
67
68 bool BooleanCurve::set_param(const String & param, const synfig::ValueBase &value)
69 {       
70         if(param=="regions" && value.same_as(regions)) 
71         {
72                 vector<BLinePoint> bv;
73                 int size = value.get_list().size();
74                 
75                 const vector<ValueBase> &vlist = value.get_list();
76                 
77                 regions.clear();                
78                 for(int i = 0; i < size; ++i)
79                 {
80                         regions.push_back(vector<BLinePoint>(vlist[i].get_list().begin(),vlist[i].get_list().end()));
81                 }
82                 return true;
83         }
84         
85         return Layer_Shape::set_param(param,value);
86 }
87
88 ValueBase BooleanCurve::get_param(const String & param)const
89 {
90         EXPORT(regions);
91         
92         EXPORT_NAME();
93         EXPORT_VERSION();
94         
95         return Layer_Shape::get_param(param);
96 }
97
98 Layer::Vocab BooleanCurve::get_param_vocab()const
99 {
100         Layer::Vocab ret(Layer_Shape::get_param_vocab());
101         
102         ret.push_back(ParamDesc("regions")
103                 .set_local_name(_("Region Set"))
104                 .set_description(_("Set of regions to combine"))
105         );
106         
107         return ret;
108 }
109
110 Color BooleanCurve::get_color(Context context, const Point &pos)const
111 {
112         Color c(Color::alpha());
113         
114         return c;
115 }
116
117 bool BooleanCurve::accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const
118 {
119         return false;
120 }