[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / particle-system / particle-renderer.h
1 #ifndef DALI_TOOLKIT_PARTICLE_SYSTEM_PARTICLE_RENDERER_H
2 #define DALI_TOOLKIT_PARTICLE_SYSTEM_PARTICLE_RENDERER_H
3 /*
4  * Copyright (c) 2023 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 // INTERNAL INCLUDES
21 #include <dali-toolkit/public-api/particle-system/particle-types.h>
22
23 // EXTERNAL INCLUDES
24 #include <dali/public-api/object/base-handle.h>
25 #include <dali/public-api/signals/callback.h>
26 #include <memory>
27
28 namespace Dali
29 {
30 class Texture;
31 }
32 namespace Dali::Toolkit::ParticleSystem::Internal
33 {
34 class ParticleRenderer;
35 }
36
37 namespace Dali::Toolkit::ParticleSystem
38 {
39 /**
40  * @brief Blending modes for particle renderer
41  */
42 enum class DALI_TOOLKIT_API BlendingMode
43 {
44   ADDITIVE, ///< Additive blending mode (default)
45   DEFAULT = ADDITIVE,
46   SCREEN ///< SCREEN mode, Advanced blending support required
47 };
48
49 class DALI_TOOLKIT_API ParticleRenderer : public Dali::BaseHandle
50 {
51 public:
52   ParticleRenderer() = default;
53
54   /**
55    * @brief Creates new instance of basic 2D renderer
56    *
57    * @return Valid instance of renderer
58    */
59   static ParticleRenderer New();
60
61   /**
62    * @brief Sets blending mode for the renderer
63    *
64    * @param[in] blendingMode Valid particle blending mode to be used
65    */
66   void SetBlendingMode(BlendingMode blendingMode);
67
68   /**
69    * @brief Sets blending mode for the renderer
70    *
71    * @return Current blending mode
72    */
73   BlendingMode GetBlendingMode() const;
74
75   /**
76    * @brief Sets renderable as a 2D texture (sprites)
77    *
78    * @param[in] texture Valid texture
79    */
80   void SetTexture(const Dali::Texture& texture);
81
82   /**
83    * @brief Downcasts a handle to ParticleRenderer handle.
84    *
85    * If handle points to an ParticleRenderer object, the downcast produces valid handle.
86    * If not, the returned handle is left uninitialized.
87    *
88    * @param[in] handle to An object
89    * @return handle to a ParticleRenderer object or an uninitialized handle
90    */
91   static ParticleRenderer DownCast(BaseHandle handle);
92
93 private:
94   /// @cond internal
95   /**
96    * @brief This constructor is used by ParticleRenderer::New() methods.
97    *
98    * @param [in] impl A pointer to a newly allocated implementation
99    */
100   ParticleRenderer(Internal::ParticleRenderer* impl);
101   /// @endcond
102 };
103 } // namespace Dali::Toolkit::ParticleSystem
104
105 #endif // DALI_TOOLKIT_PARTICLE_SYSTEM_PARTICLE_RENDERER_H