*
* 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 |
+ * |-------------------------|------------------|
+ * | gradientStartPosition | VECTOR2 |
+ * | gradientEndPosition | VECTOR2 |
+ * | gradientStopOffset | ARRAY of FLOAT |
+ * | gradientStopColor | 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 |
+ * |-------------------------|------------------|
+ * | gradientCenter | VECTOR2 |
+ * | gradientRadius | FLOAT |
+ * | gradientStopOffset | ARRAY of FLOAT |
+ * | gradientStopColor | 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 |
+ * |-------------------------|------------------|
+ * | gradientUnits | STRING |
+ * | gradientSpreadMethod | 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 gradientUnits are 'userSpace' and 'objectBoundingBox'.
+ * Valid values for gradientSpreadMethod 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
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().
public: // from ControlRenderer
/**
- * @copydoc ControlRenderer::Initialize
- */
- virtual void Initialize( RendererFactoryCache& factoryCache, const Property::Map& propertyMap );
-
- /**
* @copydoc ControlRenderer::SetSize
*/
virtual void SetSize( const Vector2& size );
/**
* @copydoc ControlRenderer::CreatePropertyMap
*/
- virtual void CreatePropertyMap( Property::Map& map ) const;
+ 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.
private:
Matrix3 mGradientTransform;
- Property::Index mGradientTransformIndex;
IntrusivePtr<Gradient> mGradient;
+ Type mGradientType;
};
} // namespace Internal