1 #ifndef DALI_DECOREATED_VISUAL_RENDERER_H
2 #define DALI_DECOREATED_VISUAL_RENDERER_H
5 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/rendering/visual-renderer.h>
27 * @addtogroup dali_core_rendering_effects
31 namespace Internal DALI_INTERNAL
33 class DecoratedVisualRenderer;
37 * @brief DecoratedVisualRenderer is a handle to a Renderer with extra properties for Toolkit::Visuals with some decoration
41 class DALI_CORE_API DecoratedVisualRenderer : public VisualRenderer
45 * @brief Enumeration for instances of properties belonging to the DecoratedVisualRenderer class.
50 static constexpr Dali::Property::Index DEFAULT_DECORATED_VISUAL_RENDERER_PROPERTY_START_INDEX = VisualRenderer::Property::DEFAULT_VISUAL_RENDERER_PROPERTY_START_INDEX + DEFAULT_PROPERTY_MAX_COUNT_PER_DERIVATION;
53 * @brief Enumeration for instances of properties belonging to the DecoratedVisualRenderer class.
59 * @brief The radius for the rounded corners of the visual.
60 * @details Name "cornerRadius", type Property::Vector4, animatable.
62 * @see Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS
64 * @note The default value is (0, 0, 0, 0).
66 CORNER_RADIUS = DEFAULT_DECORATED_VISUAL_RENDERER_PROPERTY_START_INDEX,
69 * @brief Whether the CORNER_RADIUS values are relative (percentage [0.0f to 0.5f] of the control) or absolute (in world units).
70 * @details Name "cornerRadiusPolicy", type Property::FLOAT
73 * decoratedVisualRenderer.SetProperty( DecoratedVisualRenderer::Property::CORNER_RADIUS_POLICY, Policy::ABSOLUTE );
77 * @see Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY
79 * @note The default value is Policy::RELATIVE.
84 * @brief The width for the borderline of the visual.
85 * @details Name "borderlineWidth", type Property::FLOAT, animatable.
87 * @see Dali::Toolkit::DevelVisual::Property::BORDERLINE_WIDTH
89 * @note The default value is 0.0.
94 * @brief The color for the borderline of the visual.
95 * @details Name "borderlineColor", type Property::Vector4, animatable.
97 * @see Dali::Toolkit::DevelVisual::Property::BORDERLINE_COLOR
99 * @note The default value is Color::BLACK.
104 * @brief The offset from the visual borderline (recommend [-1.0f to 1.0f]).
105 * @details Name "borderlineOffset", type Property::FLOAT, animatable.
107 * @see Dali::Toolkit::DevelVisual::Property::BORDERLINE_OFFSET
109 * @note The default value is 0.0f.
114 * @brief The blur radius of the visual.
115 * @details Name "blurRadius", type Property::FLOAT, animatable.
116 * If the value is 0, the edge is sharp. Otherwise, the larger the value, the more the edge is blurred.
118 * @see Dali::Toolkit::DevelColorVisual::Property::BLUR_RADIUS
120 * @note The default value is 0.0f.
127 * @brief Creates a new DecoratedVisualRenderer object.
130 * @param[in] geometry Geometry to be used by this renderer
131 * @param[in] shader Shader to be used by this renderer
132 * @return A handle to the Renderer
134 static DecoratedVisualRenderer New(Geometry& geometry, Shader& shader);
137 * @brief Default constructor, creates an empty handle
141 DecoratedVisualRenderer();
148 ~DecoratedVisualRenderer();
151 * @brief Copy constructor, creates a new handle to the same object.
154 * @param[in] handle Handle to an object
156 DecoratedVisualRenderer(const DecoratedVisualRenderer& handle);
159 * @brief Downcasts to a decorated visual renderer handle.
160 * If not, a renderer the returned decorated visual renderer handle is left uninitialized.
163 * @param[in] handle Handle to an object
164 * @return Renderer handle or an uninitialized handle
166 static DecoratedVisualRenderer DownCast(BaseHandle handle);
169 * @brief Assignment operator, changes this handle to point at the same object.
172 * @param[in] handle Handle to an object
173 * @return Reference to the assigned object
175 DecoratedVisualRenderer& operator=(const DecoratedVisualRenderer& handle);
178 * @brief Register relate with corner radius uniforms so we can use it as uniform properties.
182 void RegisterCornerRadiusUniform();
185 * @brief Register relate with borderline uniforms so we can use it as uniform properties.
189 void RegisterBorderlineUniform();
192 * @brief Register relate with blur radius uniforms so we can use it as uniform properties.
196 void RegisterBlurRadiusUniform();
199 * @brief Move constructor.
202 * @param[in] rhs A reference to the moved handle
204 DecoratedVisualRenderer(DecoratedVisualRenderer&& rhs) noexcept;
207 * @brief Move assignment operator.
210 * @param[in] rhs A reference to the moved handle
211 * @return A reference to this handle
213 DecoratedVisualRenderer& operator=(DecoratedVisualRenderer&& rhs) noexcept;
218 * @brief The constructor.
219 * @note Not intended for application developers.
221 * @param[in] pointer A pointer to a newly allocated DecoratedVisualRenderer
223 explicit DALI_INTERNAL DecoratedVisualRenderer(Internal::DecoratedVisualRenderer* pointer);
232 #endif // DALI_DECOREATED_VISUAL_RENDERER_H