1 #ifndef __DALI_TOOLKIT_INTERNAL_GRADIENT_RENDERER_H__
2 #define __DALI_TOOLKIT_INTERNAL_GRADIENT_RENDERER_H__
5 * Copyright (c) 2015 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-toolkit/internal/controls/renderers/control-renderer-impl.h>
23 #include <dali-toolkit/internal/controls/renderers/gradient/gradient.h>
38 * The renderer which renders smooth transition of colors to the control's quad.
39 * It supports two types of gradients: linear and radial.
41 * The following properties are essential for create a LINEAR GradientRender
43 * | %Property Name | Type |
44 * |---------------------------|------------------|
45 * | gradient-start-position | VECTOR2 |
46 * | gradient-end-position | VECTOR2 |
47 * | gradient-stop-offset | ARRAY of FLOAT |
48 * | gradient-stop-color | ARRAY of VECTOR4 |
50 * The following properties are essential for create a RADIAL GradientRender
52 * | %Property Name | Type |
53 * |---------------------------|------------------|
54 * | gradient-center | VECTOR2 |
55 * | gradient-radius | FLOAT |
56 * | gradient-stop-offset | ARRAY of FLOAT |
57 * | gradient-stop-color | ARRAY of VECTOR4 |
59 * The following properties are optional for both LINEAR and RADIAL GradientRender.
61 * | %Property Name | Type |
62 * |---------------------------|------------------|
63 * | gradient-units | STRING |
64 * | gradient-spread-method | STRING |
66 * Valid values for gradient-units are 'user-space' and 'object-bounding-box'.
67 * Valid values for gradient-spread-method are 'pad', 'repeat' and 'reflect.'
68 * If not provided, 'objectBoundingBox' is used as default gradient units, and 'pad' is used as default spread method.
70 class GradientRenderer: public ControlRenderer
80 * @brief A reference counted object may only be deleted by calling Unreference().
84 public: // from ControlRenderer
87 * @copydoc ControlRenderer::Initialize
89 virtual void Initialize( RendererFactoryCache& factoryCache, const Property::Map& propertyMap );
92 * @copydoc ControlRenderer::SetSize
94 virtual void SetSize( const Vector2& size );
97 * @copydoc ControlRenderer::SetClipRect
99 virtual void SetClipRect( const Rect<int>& clipRect );
102 * @copydoc ControlRenderer::SetOffset
104 virtual void SetOffset( const Vector2& offset );
107 * @copydoc ControlRenderer::SetOnStage
109 virtual void SetOnStage( Actor& actor );
114 * Types of the gradient
123 * New a gradient object with the given property map.
125 * @return True if the property map provides valid properties to create a gradient. Otherwise, returns false.
127 bool NewGradient(Type gradientType, const Property::Map& propertyMap);
130 GradientRenderer( const GradientRenderer& gradientRenderer );
133 GradientRenderer& operator=( const GradientRenderer& gradientRenderer );
137 Matrix3 mGradientTransform;
138 Property::Index mGradientTransformIndex;
139 IntrusivePtr<Gradient> mGradient;
142 } // namespace Internal
144 } // namespace Toolkit
148 #endif /* __DALI_TOOLKIT_INTERNAL_GRADIENT_RENDERER_H__ */