X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Frenderers%2Fgradient%2Fgradient-renderer.h;h=3a68519e9bd83c5b822182e671a6c8db83ff0557;hb=refs%2Fchanges%2F58%2F72858%2F5;hp=257c14e281e88cda52094ed4a2dfcf998d77838a;hpb=c560f95435d40fd3980cd5f92da65c9f28f440e7;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/renderers/gradient/gradient-renderer.h b/dali-toolkit/internal/controls/renderers/gradient/gradient-renderer.h index 257c14e..3a68519 100644 --- a/dali-toolkit/internal/controls/renderers/gradient/gradient-renderer.h +++ b/dali-toolkit/internal/controls/renderers/gradient/gradient-renderer.h @@ -40,31 +40,30 @@ class Gradient; * * The following properties are essential for create a LINEAR GradientRender * - * | %Property Name | Type | - * |---------------------------|------------------| - * | gradient-start-position | VECTOR2 | - * | gradient-end-position | VECTOR2 | - * | gradient-stop-offset | ARRAY of FLOAT | - * | gradient-stop-color | ARRAY of VECTOR4 | + * | %Property Name | Type | + * |-------------------------|------------------| + * | startPosition | VECTOR2 | + * | endPosition | VECTOR2 | + * | stopColor | ARRAY of VECTOR4 | * * The following properties are essential for create a RADIAL GradientRender * - * | %Property Name | Type | - * |---------------------------|------------------| - * | gradient-center | VECTOR2 | - * | gradient-radius | FLOAT | - * | gradient-stop-offset | ARRAY of FLOAT | - * | gradient-stop-color | ARRAY of VECTOR4 | + * | %Property Name | Type | + * |-------------------------|------------------| + * | center | VECTOR2 | + * | radius | FLOAT | + * | stopColor | ARRAY of VECTOR4 | * * The following properties are optional for both LINEAR and RADIAL GradientRender. * - * | %Property Name | Type | - * |---------------------------|------------------| - * | gradient-units | STRING | - * | gradient-spread-method | STRING | + * | %Property Name | Type | + * |-------------------------|------------------| + * | stopOffset | ARRAY of FLOAT | + * | units | STRING | + * | spreadMethod | STRING | * - * Valid values for gradient-units are 'user-space' and 'object-bounding-box'. - * Valid values for gradient-spread-method are 'pad', 'repeat' and 'reflect.' + * Valid values for units are 'userSpace' and 'objectBoundingBox'. + * Valid values for spreadMethod are 'pad', 'repeat' and 'reflect.' * If not provided, 'objectBoundingBox' is used as default gradient units, and 'pad' is used as default spread method. */ class GradientRenderer: public ControlRenderer @@ -72,9 +71,20 @@ class GradientRenderer: public ControlRenderer public: /** + * Types of the gradient + */ + enum Type + { + LINEAR, + RADIAL + }; + + /** * @brief Constructor. + * + * @param[in] factoryCache A pointer pointing to the RendererFactoryCache object */ - GradientRenderer(); + GradientRenderer( RendererFactoryCache& factoryCache ); /** * @brief A reference counted object may only be deleted by calling Unreference(). @@ -84,11 +94,6 @@ public: public: // from ControlRenderer /** - * @copydoc ControlRenderer::Initialize - */ - virtual void Initialize( RendererFactoryCache& factoryCache, const Property::Map& propertyMap ); - - /** * @copydoc ControlRenderer::SetSize */ virtual void SetSize( const Vector2& size ); @@ -104,20 +109,27 @@ public: // from ControlRenderer virtual void SetOffset( const Vector2& offset ); /** - * @copydoc ControlRenderer::SetOnStage + * @copydoc ControlRenderer::CreatePropertyMap */ - virtual void SetOnStage( Actor& actor ); + virtual void DoCreatePropertyMap( Property::Map& map ) const; + +protected: + /** + * @copydoc ControlRenderer::DoInitialize + */ + virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap ); + + /** + * @copydoc ControlRenderer::DoSetOnStage + */ + virtual void DoSetOnStage( Actor& actor ); private: /** - * Types of the gradient + * @brief Initialize the renderer with the geometry and shader from the cache, if not available, create and save to the cache for sharing. */ - enum Type - { - LINEAR, - RADIAL - }; + void InitializeRenderer(); /** * New a gradient object with the given property map. @@ -126,6 +138,15 @@ private: */ bool NewGradient(Type gradientType, const Property::Map& propertyMap); + /** + * Get the stop-offsets from the property. + * The valid property type are ARRAY, VECTOR2, VECTOR3, VECTOR4. + * + * @param[in] value The property value of stop-offsets + * @param[out] stopOffsets The vector contains the stop offset values. + */ + static void GetStopOffsets(const Property::Value* value, Vector& stopOffsets); + // Undefined GradientRenderer( const GradientRenderer& gradientRenderer ); @@ -135,8 +156,8 @@ private: private: Matrix3 mGradientTransform; - Property::Index mGradientTransformIndex; IntrusivePtr mGradient; + Type mGradientType; }; } // namespace Internal