1 #ifndef DALI_TOOLKIT_INTERNAL_BORDER_VISUAL_H
2 #define DALI_TOOLKIT_INTERNAL_BORDER_VISUAL_H
5 * Copyright (c) 2016 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/geometry.h>
23 #include <dali/public-api/common/intrusive-ptr.h>
26 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
38 typedef IntrusivePtr< BorderVisual > BorderVisualPtr;
41 * The visual which renders a solid color to the control's quad border fixed to a specified size.
43 * The following properties are required for create a BorderRender
45 * | %Property Name | Type |
46 * |-----------------|-------------|
47 * | borderColor | VECTOR4 |
48 * | borderSize | FLOAT |
49 * | antiAliasing | BOOLEAN |
51 class BorderVisual : public Visual::Base
56 * @brief Create a new border visual.
58 * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
59 * @param[in] properties A Property::Map containing settings for this visual
60 * @return A smart-pointer to the newly allocated visual.
62 static BorderVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
69 * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
71 BorderVisual( VisualFactoryCache& factoryCache );
74 * @brief A reference counted object may only be deleted by calling Unreference().
76 virtual ~BorderVisual();
79 * @copydoc Visual::Base::DoSetProperties
81 virtual void DoSetProperties( const Property::Map& propertyMap );
84 * @copydoc Visual::Base::DoSetOnStage
86 virtual void DoSetOnStage( Actor& actor );
89 * @copydoc Visual::Base::CreatePropertyMap
91 virtual void DoCreatePropertyMap( Property::Map& map ) const;
94 * @copydoc Visual::Base::OnSetTransform
96 virtual void OnSetTransform();
101 * Set the color of the border.
102 * @param[in] color The border color.
104 void SetBorderColor( const Vector4& color);
107 * Set the size of the border.
108 * @param[in] size The border size.
110 void SetBorderSize( float size );
113 * Enable/Disable the anti-aliasing.
114 * @param[in] enable Whether the anti-aliasing be enabled or not.
116 void RequireAntiAliasing( bool antiAliasing );
121 * @brief Initialize the renderer with the geometry and shader from the cache, if not available, create and save to the cache for sharing.
123 void InitializeRenderer();
126 * Request the border shader from the factory cache. If fail, create tha shader and add it to cache.
127 * @return The border shader.
129 Shader GetBorderShader();
132 * Create the geometry which presents the border.
133 * @return The border geometry
135 Geometry CreateBorderGeometry();
138 * Helper method to set individual values by index key.
139 * @param[in] index The index key of the value
140 * @param[in] value The value
142 void DoSetProperty( Property::Index index, const Property::Value& value );
145 BorderVisual( const BorderVisual& borderRenderer );
148 BorderVisual& operator=( const BorderVisual& borderRenderer );
152 Vector4 mBorderColor;
155 Property::Index mBorderColorIndex;
156 Property::Index mBorderSizeIndex;
161 } // namespace Internal
163 } // namespace Toolkit
167 #endif // DALI_TOOLKIT_INTERNAL_BORDER_VISUAL_H