moreupdates
[synfig.git] / synfig-core / trunk / src / synfig / layer_composite.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file layer_composite.h
3 **      \brief Composite Layer Class Implementation
4 **
5 **      $Id: layer_composite.h,v 1.2 2005/01/24 03:08:18 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 /* === S T A R T =========================================================== */
23
24 #ifndef __SYNFIG_LAYER_COMPOSITE_H
25 #define __SYNFIG_LAYER_COMPOSITE_H
26
27 /* === H E A D E R S ======================================================= */
28
29 #include "layer.h"
30 #include "color.h"
31
32 /* === M A C R O S ========================================================= */
33
34 /* === T Y P E D E F S ===================================================== */
35
36 /* === C L A S S E S & S T R U C T S ======================================= */
37
38 namespace synfig {
39
40 class Layer_NoDeform {};
41
42
43 /*!     \class Layer_Composite
44 **      \brief Base class for layers that put stuff ontop of lower layers
45 */
46 class Layer_Composite : public Layer
47 {
48 private:
49
50         float amount_;
51
52         Color::BlendMethod blend_method_;
53
54 protected:
55
56         Layer_Composite(
57                 float   amount=1.0,
58                 Color::BlendMethod      blend_method=Color::BLEND_COMPOSITE
59         ):
60                 amount_                         (amount),
61                 blend_method_           (blend_method)
62         { }
63
64 public:
65
66         float get_amount()const { return amount_; }
67
68         Layer_Composite& set_amount(float x) { amount_=x; return *this; }
69
70         Color::BlendMethod get_blend_method()const { return blend_method_; }
71
72         Layer_Composite& set_blend_method(Color::BlendMethod x) { blend_method_=x; return *this; }
73
74         bool is_solid_color()const { return amount_==1.0f && blend_method_==Color::BLEND_STRAIGHT; }
75         
76         bool is_disabled()const { return amount_==0.0f; }
77         
78         virtual Vocab get_param_vocab()const;
79
80         virtual bool set_param(const String &param, const ValueBase &value);
81
82         virtual ValueBase get_param(const String &param)const;
83
84         virtual Rect get_full_bounding_rect(Context context)const;
85
86         virtual bool accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const;
87 }; // END of class Layer_Composite
88
89 }; // END of namespace synfig
90
91 /* === E N D =============================================================== */
92
93 #endif