Remove some public Setter/Getter APIs from Dali::Actor
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / effects-view / effects-view.h
1 #ifndef DALI_TOOLKIT_EFFECTS_VIEW_H
2 #define DALI_TOOLKIT_EFFECTS_VIEW_H
3
4 /*
5  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/images/frame-buffer-image.h>
23
24 // INTERNAL INCLUDES
25 #include <dali-toolkit/public-api/controls/control.h>
26
27 namespace Dali
28 {
29
30 namespace Toolkit
31 {
32
33 namespace Internal DALI_INTERNAL
34 {
35
36 class EffectsView;
37
38 } // namespace Internal
39
40 /**
41  * EffectsView: Applies an effect to a tree of actors
42  *
43  * Example usage: Applying an emboss effect
44  * ...
45  * EffectsView effectsView = EffectsView::New( Toolkit::EffectsView::EMBOSS );
46  *
47  * // set position and format
48  * effectsView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
49  * effectsView.SetSize( Vector2( width, height) );
50  * effectsView.SetPixelFormat( Pixel::RGBA8888 );
51  *
52  * // set effect type and properties
53  * effectsView.SetProperty( effectsView.GetEffectSizePropertyIndex(), static_cast< float >( shadowSize ) );
54  * effectsView.SetProperty( effectsView.GetEffectOffsetPropertyIndex(), Vector3( shadowDistance.x, shadowDistance.y, 0.0f ) );
55  * effectsView.SetProperty( effectsView.GetEffectColorPropertyIndex(), shadowColor );
56  *
57  * // Render once
58  * effectsView.SetRefreshOnDemand( true );
59  *
60  * // optionally set a clear color
61  * effectsView.SetBackgroundColor( Vector4( 0.0f, 0.0f, 0.0f, 0.0f ) );
62  */
63 class DALI_TOOLKIT_API EffectsView : public Control
64 {
65 public:
66
67   enum EffectType
68   {
69     DROP_SHADOW,
70     EMBOSS,
71     INVALID_TYPE
72   };
73
74   /**
75    * @brief The start and end property ranges for this control.
76    */
77   enum PropertyRange
78   {
79     PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,  ///< @SINCE_1_0.0
80     PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000,              ///< Reserve property indices @SINCE_1_0.0
81
82     ANIMATABLE_PROPERTY_START_INDEX = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX,        ///< @SINCE_1_1.18
83     ANIMATABLE_PROPERTY_END_INDEX =   ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1000  ///< Reserve animatable property indices, @SINCE_1_1.18
84   };
85
86   /**
87    * @brief An enumeration of properties belonging to the EffectsView class.
88    */
89   struct Property
90   {
91     enum
92     {
93       // Event side properties
94       EFFECT_SIZE = PROPERTY_START_INDEX,              ///< name "effectSize", type INTEGER
95
96       // Animatable properties
97       EFFECT_OFFSET = ANIMATABLE_PROPERTY_START_INDEX, ///< name "effectOffset", type VECTOR3
98       EFFECT_COLOR,                                    ///< name "effectColor", type VECTOR4
99     };
100   };
101
102 public:
103
104   /**
105    * Create an EffectsView object with default configuration
106    * @param[in] type The type of effect to be performed by the EffectView.
107    *                 A member of the EffectType enumeration.
108    */
109   static EffectsView New( EffectType type );
110
111   /**
112    * Create an uninitialized EffectsView. Only derived versions can be instantiated.
113    * Calling member functions with an uninitialized Dali::Object is not allowed.
114    */
115   EffectsView();
116
117   /**
118    * Copy constructor.
119    */
120   EffectsView( const EffectsView& handle );
121
122   /**
123    * Assignment operator.
124    */
125   EffectsView& operator=( const EffectsView& rhs );
126
127   /**
128    * Downcast an Object handle to EffectsView. If handle points to a EffectsView the
129    * downcast produces a valid handle. If not the returned handle is left uninitialized.
130    * @param[in] handle Handle to an object
131    * @return handle to a EffectsView or an uninitialized handle
132    */
133   static EffectsView DownCast( BaseHandle handle );
134
135   /**
136    * @brief Destructor
137    *
138    * This is non-virtual since derived Handle types must not contain data or virtual methods.
139    */
140   ~EffectsView();
141
142 public:
143
144   /**
145    * Get the effect type
146    * @return The type of effect performed by the EffectView. A member of the EffectType enumeration.
147    */
148   EffectType GetType() const;
149
150   /**
151    * Refresh/Redraw the effect
152    */
153   void Refresh();
154
155   /**
156    * Set refresh mode
157    * @param[in] onDemand Set true to enable on demand rendering, call Refresh() whenever a render is required.
158    *                     Set false to render each frame. (EffectsView refresh mode is set to continuous by default).
159    */
160   void SetRefreshOnDemand( bool onDemand );
161
162    /**
163     * Set the pixel format for the output
164     * @param[in] pixelFormat The pixel format for the output
165     */
166    void SetPixelFormat( Pixel::Format pixelFormat );
167
168    /**
169     * Set background color for the view. The background will be filled with this color.
170     * @param[in] color The background color.
171     */
172    void SetBackgroundColor( const Vector4& color );
173
174    /**
175     * Get the background color.
176     * @return The background color.
177     */
178    Vector4 GetBackgroundColor() const;
179
180 public: // Not intended for application developers
181
182   /**
183    * Creates a handle using the Toolkit::Internal implementation.
184    * @param[in]  implementation  The Control implementation.
185    */
186   DALI_INTERNAL EffectsView( Internal::EffectsView& implementation );
187
188   /**
189    * Allows the creation of this Control from an Internal::CustomActor pointer.
190    * @param[in]  internal  A pointer to the internal CustomActor.
191    */
192   explicit DALI_INTERNAL EffectsView( Dali::Internal::CustomActor* internal );
193
194 }; // class EffectsView
195
196 } // namespace Toolkit
197
198 } // namespace Dali
199
200 #endif // DALI_TOOLKIT_EFFECTS_VIEW_H