[ATSPI] make ScrollToChild use descendant
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / bubble-effect / bubble-emitter.h
1 #ifndef DALI_TOOLKIT_BUBBLE_EMMITER_H
2 #define DALI_TOOLKIT_BUBBLE_EMMITER_H
3
4 /*
5  * Copyright (c) 2020 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 // INTERNAL INCLUDES
22 #include <dali-toolkit/public-api/controls/control.h>
23 #include <dali/public-api/rendering/texture.h>
24
25 namespace Dali
26 {
27 namespace Toolkit
28 {
29 namespace Internal DALI_INTERNAL
30 {
31 /**
32    * @brief BubbleEmitter implementation class.
33    */
34 class BubbleEmitter;
35 } // namespace DALI_INTERNAL
36
37 /**
38  * @brief BubbleEmitter is used to display lots of moving bubbles on the stage.
39  *
40  * This is done by applying BubbleEffect to multiple specifically created meshActors.
41  */
42 class DALI_TOOLKIT_API BubbleEmitter : public Control
43 {
44 public:
45   /**
46    * @brief Create an empty BubbleEmitter handle.
47    */
48   BubbleEmitter();
49
50   /**
51    * @brief Virtual destructor.
52    */
53   ~BubbleEmitter();
54
55   /**
56    * @brief Create an initialized BubbleEmitter.
57    *
58    * @param[in] winSize The size of the bubble moving area, usually the same size as the background.
59    * @param[in] shapeTexture The alpha channnel of this texture defines the bubble shape.
60    * @param[in] maximumNumberOfBubble The maximum number of bubble needed.
61    * @param[in] bubbleSizeRange The size range of the bubbles; x component is the low bound, and y component is the up bound.
62    * @return The initialized BubbleEmitter object.
63    */
64   static BubbleEmitter New(const Vector2& winSize,
65                            Dali::Texture  shapeTexture,
66                            unsigned int   maximumNumberOfBubble,
67                            const Vector2& bubbleSizeRange);
68
69   /**
70    * @brief Copy constructor.
71    *
72    * Creates another handle that points to the same real object
73    * @param[in] handle The handle to copy
74    */
75   BubbleEmitter(const BubbleEmitter& handle);
76
77   /**
78    * @brief Assignment operator.
79    *
80    * Changes this handle to point to another real object
81    * @param[in] rhs The object to point at
82    * @return A reference to this
83    */
84   BubbleEmitter& operator=(const BubbleEmitter& rhs);
85
86   /**
87    * @brief Downcast an Object handle to SuperBlurView.
88    *
89    * If handle points to a BubbleEmitter, the downcast produces valid handle.
90    * If not, the returned handle is left uninitialized.
91    * @param[in] handle Handle to an object
92    * @return handle to a BubbleEmitter or an uninitialized handle
93    */
94   static BubbleEmitter DownCast(BaseHandle handle);
95
96   /**
97    * @brief Return the root actor of all bubbles, should then be added to stage.
98    *
99    * @return The bubble root actor.
100    */
101   Actor GetRootActor();
102
103   /**
104    * @brief Set Background image.
105    *
106    * The bubbles pick color from this image with HSV values adjusted.
107    * @param[in] bgTexture The background texture which provide color to bubbles.
108    * @param[in] hsvDelta The hsv channel difference used to adjust the background image color.
109    *            If set these vector as Vector3::Zero, original colors are used.
110    */
111   void SetBackground(Dali::Texture bgTexture, const Vector3& hsvDelta);
112
113   /**
114    * @brief Set bubble shape.
115    *
116    * The bubble mesh is a rectangular patch, but its displayed shape is decided by the alpha channel of the shape texture.
117    * @param[in] shapeTexture The texture whose alpha channel defines the bubble shape.
118    */
119   void SetBubbleShape(Dali::Texture shapeTexture);
120
121   /**
122    * @brief Set the scale factor applied to all the bubbles.
123    *
124    * @param [in] scale The scale factor applied on bubbles.
125    */
126   void SetBubbleScale(float scale);
127
128   /**
129    * @brief Set the density of the bubble.
130    *
131    * Ideally every bubble's moving track is controlled by different uniforms in shader.
132    * To increase the density, 'density' number of bubbles are sharing one group of uniforms, but with random offsets between these bubbles.
133    * The available densities are one to nine only. The default value is five.
134    * By set the density bigger than one, instead of emit one bubble each time, a 'density' number of bubbles are emitted.
135    * @param[in] density The density of the bubble.
136    */
137   void SetBubbleDensity(unsigned int density);
138
139   /**
140    * @brief Add a bubble movement to the animation.
141    *
142    * @param[in] animation The animation reference.
143    * By passing the animation into BubbleEmitter, the animation's duration and how many bubbles contained within this animation are freely decided in App.
144    * @param[in] emitPosition The start position of the bubble movement.
145    * @param[in] direction The direction used to constrain the bubble to move in an adjacent direction around it.
146    * @param[in] displacement The displacement used to bound the moving distance of the bubble.
147    */
148   void EmitBubble(Animation& animation, const Vector2& emitPosition, const Vector2& direction, const Vector2& displacement);
149
150   /**
151    * @brief Reset all the parameters controlling the bubbles after animation.
152    */
153   void Restore();
154
155 public: // Not intended for developer use
156   /**
157    * @brief Creates a handle using the Toolkit::Internal implementation.
158    *
159    * @param[in]  implementation  The Control implementation.
160    */
161   DALI_INTERNAL BubbleEmitter(Internal::BubbleEmitter& implementation);
162
163   /**
164    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
165    *
166    * @param[in]  internal  A pointer to the internal CustomActor.
167    */
168   explicit DALI_INTERNAL BubbleEmitter(Dali::Internal::CustomActor* internal);
169 };
170
171 } // namespace Toolkit
172
173 } // namespace Dali
174
175 #endif /* DALI_TOOLKIT_BUBBLE_EMMITER_H */