ae5ccca0b233a57d10d5caeaeda9c7036bcd33db
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / renderers / color / color-renderer.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_COLOR_RENDERER_H__
2 #define __DALI_TOOLKIT_INTERNAL_COLOR_RENDERER_H__
3
4 /*
5  * Copyright (c) 2015 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/internal/controls/renderers/control-renderer-impl.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 namespace Internal
31 {
32
33 /**
34  * The renderer which renders a solid color to the control's quad
35  *
36  * The following properties are required for create a ColorRender
37  *
38  * | %Property Name   | Type        |
39  * |------------------|-------------|
40  * | blend-color      | VECTOR4     |
41  */
42 class ColorRenderer: public ControlRenderer
43 {
44 public:
45
46   /**
47    * @brief Constructor.
48    */
49   ColorRenderer();
50
51   /**
52    * @brief A reference counted object may only be deleted by calling Unreference().
53    */
54   virtual ~ColorRenderer();
55
56 public:  // from ControlRenderer
57
58   /**
59    * @copydoc ControlRenderer::DoInitialize
60    */
61   virtual void DoInitialize( RendererFactoryCache& factoryCache, const Property::Map& propertyMap );
62
63   /**
64    * @copydoc ControlRenderer::SetSize
65    */
66   virtual void SetSize( const Vector2& size );
67
68   /**
69    * @copydoc ControlRenderer::SetClipRect
70    */
71   virtual void SetClipRect( const Rect<int>& clipRect );
72
73   /**
74    * @copydoc ControlRenderer::SetOffset
75    */
76   virtual void SetOffset( const Vector2& offset );
77
78   /**
79    * @copydoc ControlRenderer::CreatePropertyMap
80    */
81   virtual void DoCreatePropertyMap( Property::Map& map ) const;
82
83 protected:
84   /**
85    * @copydoc ControlRenderer::DoSetOnStage
86    */
87   virtual void DoSetOnStage( Actor& actor );
88
89 public:
90
91   /**
92    * Request the geometry and shader from the cache, if not available, create and save to the cache for sharing.
93    *
94    * @param[in] factoryCache A pointer pointing to the RendererFactoryCache object
95    */
96   void Initialize( RendererFactoryCache& factoryCache );
97
98   /**
99    * Set the color for rendering.
100    * @param[in] color The color to be rendered.
101    */
102   void SetColor( const Vector4& color );
103
104 private:
105
106   // Undefined
107   ColorRenderer( const ColorRenderer& colorRenderer );
108
109   // Undefined
110   ColorRenderer& operator=( const ColorRenderer& colorRenderer );
111
112 private:
113
114   Vector4 mBlendColor;
115   Property::Index mBlendColorIndex;
116
117 };
118
119 } // namespace Internal
120
121 } // namespace Toolkit
122
123 } // namespace Dali
124
125 #endif /* __DALI_TOOLKIT_INTERNAL_COLOR_RENDERER_H__ */