propertyMap.Insert("rendererType", "gradient");
Vector2 start(-1.f, -1.f);
Vector2 end(1.f, 1.f);
- propertyMap.Insert("gradientStartPosition", start);
- propertyMap.Insert("gradientEndPosition", end);
- propertyMap.Insert("gradientStopOffset", Vector2(0.f, 1.f));
+ propertyMap.Insert("startPosition", start);
+ propertyMap.Insert("endPosition", end);
+ propertyMap.Insert("stopOffset", Vector2(0.f, 1.f));
Property::Array stopColors;
stopColors.PushBack( Color::RED );
stopColors.PushBack( Color::GREEN );
- propertyMap.Insert("gradientStopColor", stopColors);
+ propertyMap.Insert("stopColor", stopColors);
ControlRenderer gradientRenderer = factory.GetControlRenderer(propertyMap);
gradientRenderer.SetSize( rendererSize );
DALI_TEST_EQUALS( gradientRenderer.GetSize(), rendererSize, TEST_LOCATION );
Vector2 start(-1.f, -1.f);
Vector2 end(1.f, 1.f);
- propertyMap.Insert("gradientStartPosition", start);
- propertyMap.Insert("gradientEndPosition", end);
- propertyMap.Insert("gradientSpreadMethod", "repeat");
+ propertyMap.Insert("startPosition", start);
+ propertyMap.Insert("endPosition", end);
+ propertyMap.Insert("spreadMethod", "repeat");
- propertyMap.Insert("gradientStopOffset", Vector2(0.2f, 0.8f));
+ propertyMap.Insert("stopOffset", Vector2(0.2f, 0.8f));
Property::Array stopColors;
stopColors.PushBack( Color::RED );
stopColors.PushBack( Color::GREEN );
- propertyMap.Insert("gradientStopColor", stopColors);
+ propertyMap.Insert("stopColor", stopColors);
ControlRenderer gradientRenderer = factory.GetControlRenderer(propertyMap);
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == "gradient" );
- value = resultMap.Find( "gradientUnits", Property::STRING );
+ value = resultMap.Find( "units", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == "objectBoundingBox" );
- value = resultMap.Find( "gradientSpreadMethod", Property::STRING );
+ value = resultMap.Find( "spreadMethod", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == "repeat" );
- value = resultMap.Find( "gradientStartPosition", Property::VECTOR2 );
+ value = resultMap.Find( "startPosition", Property::VECTOR2 );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<Vector2>(), start , Math::MACHINE_EPSILON_100, TEST_LOCATION );
- value = resultMap.Find( "gradientEndPosition", Property::VECTOR2 );
+ value = resultMap.Find( "endPosition", Property::VECTOR2 );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<Vector2>(), end , Math::MACHINE_EPSILON_100, TEST_LOCATION );
- value = resultMap.Find( "gradientStopOffset", Property::ARRAY );
+ value = resultMap.Find( "stopOffset", Property::ARRAY );
DALI_TEST_CHECK( value );
Property::Array* offsetArray = value->GetArray();
DALI_TEST_CHECK( offsetArray->Count() == 2 );
DALI_TEST_EQUALS( offsetArray->GetElementAt(0).Get<float>(), 0.2f , Math::MACHINE_EPSILON_100, TEST_LOCATION );
DALI_TEST_EQUALS( offsetArray->GetElementAt(1).Get<float>(), 0.8f , Math::MACHINE_EPSILON_100, TEST_LOCATION );
- value = resultMap.Find( "gradientStopColor", Property::ARRAY );
+ value = resultMap.Find( "stopColor", Property::ARRAY );
DALI_TEST_CHECK( value );
Property::Array* colorArray = value->GetArray();
DALI_TEST_CHECK( colorArray->Count() == 2 );
Vector2 center(100.f, 100.f);
float radius = 100.f;
- propertyMap.Insert("gradientUnits", "userSpace");
- propertyMap.Insert("gradientCenter", center);
- propertyMap.Insert("gradientRadius", radius);
- propertyMap.Insert("gradientStopOffset", Vector3(0.1f, 0.3f, 1.1f));
+ propertyMap.Insert("units", "userSpace");
+ propertyMap.Insert("center", center);
+ propertyMap.Insert("radius", radius);
+ propertyMap.Insert("stopOffset", Vector3(0.1f, 0.3f, 1.1f));
Property::Array stopColors;
stopColors.PushBack( Color::RED );
stopColors.PushBack( Color::BLACK );
stopColors.PushBack( Color::GREEN );
- propertyMap.Insert("gradientStopColor", stopColors);
+ propertyMap.Insert("stopColor", stopColors);
ControlRenderer gradientRenderer = factory.GetControlRenderer(propertyMap);
DALI_TEST_CHECK( gradientRenderer );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == "gradient" );
- value = resultMap.Find( "gradientUnits", Property::STRING );
+ value = resultMap.Find( "units", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == "userSpace" );
- value = resultMap.Find( "gradientSpreadMethod", Property::STRING );
+ value = resultMap.Find( "spreadMethod", Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == "pad" );
- value = resultMap.Find( "gradientCenter", Property::VECTOR2 );
+ value = resultMap.Find( "center", Property::VECTOR2 );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<Vector2>(), center , Math::MACHINE_EPSILON_100, TEST_LOCATION );
- value = resultMap.Find( "gradientRadius", Property::FLOAT );
+ value = resultMap.Find( "radius", Property::FLOAT );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<float>(), radius , Math::MACHINE_EPSILON_100, TEST_LOCATION );
- value = resultMap.Find( "gradientStopOffset", Property::ARRAY );
+ value = resultMap.Find( "stopOffset", Property::ARRAY );
DALI_TEST_CHECK( value );
Property::Array* offsetArray = value->GetArray();
DALI_TEST_CHECK( offsetArray->Count() == 3 );
// any stop value will be clamped to [0.0, 1.0];
DALI_TEST_EQUALS( offsetArray->GetElementAt(2).Get<float>(), 1.0f , Math::MACHINE_EPSILON_100, TEST_LOCATION );
- value = resultMap.Find( "gradientStopColor", Property::ARRAY );
+ value = resultMap.Find( "stopColor", Property::ARRAY );
DALI_TEST_CHECK( value );
Property::Array* colorArray = value->GetArray();
DALI_TEST_CHECK( colorArray->Count() == 3 );
Vector2 start(-1.f, -1.f);
Vector2 end(1.f, 1.f);
- propertyMap.Insert("gradientStartPosition", start);
- propertyMap.Insert("gradientEndPosition", end);
- propertyMap.Insert("gradientSpreadMethod", "repeat");
+ propertyMap.Insert("startPosition", start);
+ propertyMap.Insert("endPosition", end);
+ propertyMap.Insert("spreadMethod", "repeat");
Property::Array stopOffsets;
stopOffsets.PushBack( 0.2f );
stopOffsets.PushBack( 0.8f );
- propertyMap.Insert("gradientStopOffset", stopOffsets);
+ propertyMap.Insert("stopOffset", stopOffsets);
Property::Array stopColors;
stopColors.PushBack( Color::RED );
stopColors.PushBack( Color::GREEN );
- propertyMap.Insert("gradientStopColor", stopColors);
+ propertyMap.Insert("stopColor", stopColors);
ControlRenderer controlRenderer = factory.GetControlRenderer(propertyMap);
DALI_TEST_CHECK( controlRenderer );
Vector2 center(100.f, 100.f);
float radius = 100.f;
- propertyMap.Insert("gradientUnits", "userSpace");
- propertyMap.Insert("gradientCenter", center);
- propertyMap.Insert("gradientRadius", radius);
+ propertyMap.Insert("units", "userSpace");
+ propertyMap.Insert("center", center);
+ propertyMap.Insert("radius", radius);
Property::Array stopOffsets;
stopOffsets.PushBack( 0.0f );
stopOffsets.PushBack( 1.f );
- propertyMap.Insert("gradientStopOffset", stopOffsets);
+ propertyMap.Insert("stopOffset", stopOffsets);
Property::Array stopColors;
stopColors.PushBack( Color::RED );
stopColors.PushBack( Color::GREEN );
- propertyMap.Insert("gradientStopColor", stopColors);
+ propertyMap.Insert("stopColor", stopColors);
ControlRenderer controlRenderer = factory.GetControlRenderer(propertyMap);
DALI_TEST_CHECK( controlRenderer );
END_TEST;
}
+int UtcDaliRendererFactoryDefaultOffsetsGradientRenderer(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliRendererFactoryGetRadialGradientRenderer");
+
+ RendererFactory factory = RendererFactory::Get();
+ DALI_TEST_CHECK( factory );
+
+ Property::Map propertyMap;
+ propertyMap.Insert("rendererType", "gradient");
+
+ Vector2 start(-1.f, -1.f);
+ Vector2 end(1.f, 1.f);
+ propertyMap.Insert("startPosition", start);
+ propertyMap.Insert("endPosition", end);
+ propertyMap.Insert("spreadMethod", "repeat");
+
+ Property::Array stopColors;
+ stopColors.PushBack( Color::RED );
+ stopColors.PushBack( Color::GREEN );
+ propertyMap.Insert("stopColor", stopColors);
+
+ ControlRenderer controlRenderer = factory.GetControlRenderer(propertyMap);
+ DALI_TEST_CHECK( controlRenderer );
+
+ // A lookup texture is generated and pass to shader as sampler
+ Actor actor = Actor::New();
+ TestControlRendererRender( application, actor, controlRenderer, 1u );
+
+ controlRenderer.SetOffStage( actor );
+ DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
+
+ END_TEST;
+}
+
int UtcDaliRendererFactoryGetImageRenderer1(void)
{
ToolkitTestApplication application;
const char * const RENDERER_TYPE_VALUE("gradient");
// properties: linear gradient
-const char * const GRADIENT_START_POSITION_NAME("gradientStartPosition"); // Property::VECTOR2
-const char * const GRADIENT_END_POSITION_NAME("gradientEndPosition"); // Property::VECTOR2
+const char * const START_POSITION_NAME("startPosition"); // Property::VECTOR2
+const char * const END_POSITION_NAME("endPosition"); // Property::VECTOR2
// properties: radial gradient
-const char * const GRADIENT_CENTER_NAME("gradientCenter"); // Property::VECTOR2
-const char * const GRADIENT_RADIUS_NAME("gradientRadius"); // Property::FLOAT
+const char * const CENTER_NAME("center"); // Property::VECTOR2
+const char * const RADIUS_NAME("radius"); // Property::FLOAT
// properties: linear&radial gradient
-const char * const GRADIENT_STOP_OFFSET_NAME("gradientStopOffset"); // Property::Array FLOAT
-const char * const GRADIENT_STOP_COLOR_NAME("gradientStopColor"); // Property::Array VECTOR4
-const char * const GRADIENT_UNITS_NAME("gradientUnits"); // Property::String "userSpaceOnUse | objectBoundingBox"
-const char * const GRADIENT_SPREAD_METHOD_NAME("gradientSpreadMethod"); // Property::String "pad | reflect | repeat"
+const char * const STOP_OFFSET_NAME("stopOffset"); // Property::Array FLOAT
+const char * const STOP_COLOR_NAME("stopColor"); // Property::Array VECTOR4
+const char * const UNITS_NAME("units"); // Property::String "userSpaceOnUse | objectBoundingBox"
+const char * const SPREAD_METHOD_NAME("spreadMethod"); // Property::String "pad | reflect | repeat"
// string values
const char * const UNIT_USER_SPACE("userSpace");
const char * const UNIFORM_ALIGNMENT_MATRIX_NAME( "uAlignmentMatrix" );
const char * const UNIFORM_TEXTULRE_NAME("sTexture");
+// default offset value
+const unsigned int DEFAULT_OFFSET_MINIMUM = 0.0f;
+const unsigned int DEFAULT_OFFSET_MAXIMUM = 1.0f;
+
RendererFactoryCache::ShaderType GetShaderType( GradientRenderer::Type type, Gradient::GradientUnits units)
{
if( type==GradientRenderer::LINEAR )
void GradientRenderer::DoInitialize( Actor& actor, const Property::Map& propertyMap )
{
Gradient::GradientUnits gradientUnits = Gradient::OBJECT_BOUNDING_BOX;
- Property::Value* unitsValue = propertyMap.Find( GRADIENT_UNITS_NAME );
+ Property::Value* unitsValue = propertyMap.Find( UNITS_NAME );
std::string units;
// The default unit is OBJECT_BOUNDING_BOX.
// Only need to set new units if 'user-space'
}
mGradientType = LINEAR;
- if( propertyMap.Find( GRADIENT_RADIUS_NAME ))
+ if( propertyMap.Find( RADIUS_NAME ))
{
mGradientType = RADIAL;
}
Gradient::GradientUnits units = mGradient->GetGradientUnits();
if( units == Gradient::USER_SPACE_ON_USE )
{
- map.Insert( GRADIENT_UNITS_NAME, UNIT_USER_SPACE );
+ map.Insert( UNITS_NAME, UNIT_USER_SPACE );
}
else // if( units == Gradient::OBJECT_BOUNDING_BOX )
{
- map.Insert( GRADIENT_UNITS_NAME, UNIT_BOUNDING_BOX );
+ map.Insert( UNITS_NAME, UNIT_BOUNDING_BOX );
}
Gradient::SpreadMethod spread = mGradient->GetSpreadMethod();
if( spread == Gradient::PAD )
{
- map.Insert( GRADIENT_SPREAD_METHOD_NAME, SPREAD_PAD );
+ map.Insert( SPREAD_METHOD_NAME, SPREAD_PAD );
}
else if( spread == Gradient::REFLECT )
{
- map.Insert( GRADIENT_SPREAD_METHOD_NAME, SPREAD_REFLECT );
+ map.Insert( SPREAD_METHOD_NAME, SPREAD_REFLECT );
}
else // if( units == Gradient::REPEAT )
{
- map.Insert( GRADIENT_SPREAD_METHOD_NAME, SPREAD_REPEAT );
+ map.Insert( SPREAD_METHOD_NAME, SPREAD_REPEAT );
}
const Vector<Gradient::GradientStop>& stops( mGradient->GetStops() );
colors.PushBack( stops[i].mStopColor );
}
- map.Insert( GRADIENT_STOP_OFFSET_NAME, offsets );
- map.Insert( GRADIENT_STOP_COLOR_NAME, colors );
+ map.Insert( STOP_OFFSET_NAME, offsets );
+ map.Insert( STOP_COLOR_NAME, colors );
if( &typeid( *mGradient ) == &typeid(LinearGradient) )
{
LinearGradient* gradient = static_cast<LinearGradient*>( mGradient.Get() );
- map.Insert( GRADIENT_START_POSITION_NAME, gradient->GetStartPosition() );
- map.Insert( GRADIENT_END_POSITION_NAME, gradient->GetEndPosition() );
+ map.Insert( START_POSITION_NAME, gradient->GetStartPosition() );
+ map.Insert( END_POSITION_NAME, gradient->GetEndPosition() );
}
else // if( &typeid( *mGradient ) == &typeid(RadialGradient) )
{
RadialGradient* gradient = static_cast<RadialGradient*>( mGradient.Get() );
- map.Insert( GRADIENT_CENTER_NAME, gradient->GetCenter() );
- map.Insert( GRADIENT_RADIUS_NAME, gradient->GetRadius() );
+ map.Insert( CENTER_NAME, gradient->GetCenter() );
+ map.Insert( RADIUS_NAME, gradient->GetRadius() );
}
}
{
if( gradientType==LINEAR )
{
- Property::Value* startPositionValue = propertyMap.Find( GRADIENT_START_POSITION_NAME );
- Property::Value* endPositionValue = propertyMap.Find( GRADIENT_END_POSITION_NAME );
+ Property::Value* startPositionValue = propertyMap.Find( START_POSITION_NAME );
+ Property::Value* endPositionValue = propertyMap.Find( END_POSITION_NAME );
Vector2 startPosition;
Vector2 endPosition;
}
else // type==RADIAL
{
- Property::Value* centerValue = propertyMap.Find( GRADIENT_CENTER_NAME );
- Property::Value* radiusValue = propertyMap.Find( GRADIENT_RADIUS_NAME );
+ Property::Value* centerValue = propertyMap.Find( CENTER_NAME );
+ Property::Value* radiusValue = propertyMap.Find( RADIUS_NAME );
Vector2 center;
float radius;
if( centerValue && centerValue->Get(center)
}
unsigned int numValidStop = 0u;
- Property::Value* stopOffsetValue = propertyMap.Find( GRADIENT_STOP_OFFSET_NAME );
- Property::Value* stopColorValue = propertyMap.Find( GRADIENT_STOP_COLOR_NAME );
- if( stopOffsetValue && stopColorValue )
+ Property::Value* stopOffsetValue = propertyMap.Find( STOP_OFFSET_NAME );
+ Property::Value* stopColorValue = propertyMap.Find( STOP_COLOR_NAME );
+ if( stopColorValue )
{
Vector<float> offsetArray;
Property::Array* colorArray = stopColorValue->GetArray();
- if( colorArray && GetStopOffsets( stopOffsetValue, offsetArray ))
+ if( colorArray )
{
+ GetStopOffsets( stopOffsetValue, offsetArray );
unsigned int numStop = offsetArray.Count() < colorArray->Count() ?
offsetArray.Count() : colorArray->Count();
Vector4 color;
return false;
}
- Property::Value* spread = propertyMap.Find( GRADIENT_SPREAD_METHOD_NAME );
+ Property::Value* spread = propertyMap.Find( SPREAD_METHOD_NAME );
std::string stringValue ;
// The default spread method is PAD.
// Only need to set new spread if 'reflect' or 'repeat"
return true;
}
-bool GradientRenderer::GetStopOffsets(const Property::Value* value, Vector<float>& stopOffsets)
+void GradientRenderer::GetStopOffsets(const Property::Value* value, Vector<float>& stopOffsets)
{
- Vector2 offset2;
- if( value->Get( offset2 ) )
- {
- stopOffsets.PushBack( offset2.x );
- stopOffsets.PushBack( offset2.y );
- return true;
- }
-
- Vector3 offset3;
- if( value->Get( offset3 ) )
- {
- stopOffsets.PushBack( offset3.x );
- stopOffsets.PushBack( offset3.y );
- stopOffsets.PushBack( offset3.z );
- return true;
- }
- Vector4 offset4;
- if( value->Get( offset4 ) )
+ if ( value ) // Only check valve type if a valid Property has been passed in
{
- stopOffsets.PushBack( offset4.x );
- stopOffsets.PushBack( offset4.y );
- stopOffsets.PushBack( offset4.z );
- stopOffsets.PushBack( offset4.w );
- return true;
- }
-
- Property::Array* offsetArray = value->GetArray();
- if( offsetArray )
- {
- unsigned int numStop = offsetArray->Count();
- float offset;
- for( unsigned int i=0; i<numStop; i++ )
+ switch ( value->GetType() )
{
- if( offsetArray->GetElementAt(i).Get(offset) )
+ case Property::VECTOR2:
+ {
+ Vector2 offset2;
+ value->Get( offset2 );
+ stopOffsets.PushBack( offset2.x );
+ stopOffsets.PushBack( offset2.y );
+ break;
+ }
+ case Property::VECTOR3:
{
- stopOffsets.PushBack( offset );
+ Vector3 offset3;
+ value->Get( offset3 );
+ stopOffsets.PushBack( offset3.x );
+ stopOffsets.PushBack( offset3.y );
+ stopOffsets.PushBack( offset3.z );
+ break;
+ }
+ case Property::VECTOR4:
+ {
+ Vector4 offset4;
+ value->Get( offset4 );
+ stopOffsets.PushBack( offset4.x );
+ stopOffsets.PushBack( offset4.y );
+ stopOffsets.PushBack( offset4.z );
+ stopOffsets.PushBack( offset4.w );
+ break;
+ }
+ case Property::ARRAY:
+ {
+ Property::Array* offsetArray = value->GetArray();
+ unsigned int numStop = offsetArray->Count();
+ float offset;
+ for( unsigned int i=0; i<numStop; i++ )
+ {
+ if( offsetArray->GetElementAt(i).Get(offset) )
+ {
+ stopOffsets.PushBack( offset );
+ }
+ }
+ break;
+ }
+ default:
+ {
+ DALI_LOG_WARNING("GetStopOffsets passed unsupported Property Map\n");
+ // Unsupported Type
}
}
- return true;
}
- return false;
+ if ( stopOffsets.Empty() )
+ {
+ // Set default offset if none set by Property system, need a minimum and maximum
+ stopOffsets.PushBack( DEFAULT_OFFSET_MINIMUM );
+ stopOffsets.PushBack( DEFAULT_OFFSET_MAXIMUM );
+ }
}
} // namespace Internal
*
* | %Property Name | Type |
* |-------------------------|------------------|
- * | gradientStartPosition | VECTOR2 |
- * | gradientEndPosition | VECTOR2 |
- * | gradientStopOffset | ARRAY of FLOAT |
- * | gradientStopColor | ARRAY of VECTOR4 |
+ * | startPosition | VECTOR2 |
+ * | endPosition | VECTOR2 |
+ * | stopColor | ARRAY of VECTOR4 |
*
* The following properties are essential for create a RADIAL GradientRender
*
* | %Property Name | Type |
* |-------------------------|------------------|
- * | gradientCenter | VECTOR2 |
- * | gradientRadius | FLOAT |
- * | gradientStopOffset | ARRAY of FLOAT |
- * | gradientStopColor | ARRAY of VECTOR4 |
+ * | center | VECTOR2 |
+ * | radius | FLOAT |
+ * | stopColor | ARRAY of VECTOR4 |
*
* The following properties are optional for both LINEAR and RADIAL GradientRender.
*
* | %Property Name | Type |
* |-------------------------|------------------|
- * | gradientUnits | STRING |
- * | gradientSpreadMethod | STRING |
+ * | units | STRING |
+ * | spreadMethod | STRING |
*
- * Valid values for gradientUnits are 'userSpace' and 'objectBoundingBox'.
- * Valid values for gradientSpreadMethod 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
* @param[in] value The property value of stop-offsets
* @param[out] stopOffsets The vector contains the stop offset values.
*/
- static bool GetStopOffsets(const Property::Value* value, Vector<float>& stopOffsets);
+ static void GetStopOffsets(const Property::Value* value, Vector<float>& stopOffsets);
// Undefined
GradientRenderer( const GradientRenderer& gradientRenderer );
**RendererType:** "gradient"
-| Property Name | Type | Required | Description |
-|--------------------------------------------------------------|:----------------:|:----------:|-------------------------------------------------------------------|
-| gradientStartPosition | VECTOR2 | For Linear | The start position of the linear gradient. |
-| gradientEndPosition | VECTOR2 | For Linear | The end position of the linear gradient. |
-| gradientCenter | VECTOR2 | For Radial | The center point of the gradient. |
-| gradientRadius | FLOAT | For Radial | The size of the radius. |
-| gradientStopOffset | ARRAY of FLOAT | Yes | All the stop offsets. |
-| gradientStopColor | ARRAY of VECTOR4 | Yes | The color at those stop offsets. |
-| [gradientUnits](@ref gradient-renderer-units) | STRING | No | *objectBoundingBox* or *userSpace*. Default: *objectBoundingBox*. |
-| [gradientSpreadMethod](@ref gradient-renderer-spread-method) | STRING | No | *pad*, *repeat* or *reflect*. Default: *pad* |
-
-If the *gradientStopOffset* and *gradientStopColor* arrays do not have the same number of elements, then the minimum of the two is used as the stop points.
+| Property Name | Type | Required | Description |
+|--------------------------------------------------------------|:----------------:|:----------:|-------------------------------------------------------------------------|
+| startPosition | VECTOR2 | For Linear | The start position of the linear gradient. |
+| endPosition | VECTOR2 | For Linear | The end position of the linear gradient. |
+| center | VECTOR2 | For Radial | The center point of the gradient. |
+| radius | FLOAT | For Radial | The size of the radius. |
+| stopOffset | ARRAY of FLOAT | No | All the stop offsets. If not supplied default is 0.0 and 1.0 |
+| stopColor | ARRAY of VECTOR4 | Yes | The color at those stop offsets. At least 2 required to show a gradient |
+| [gradientUnits](@ref gradient-renderer-units) | STRING | No | *objectBoundingBox* or *userSpace*. Default: *objectBoundingBox*. |
+| [gradientSpreadMethod](@ref gradient-renderer-spread-method) | STRING | No | *pad*, *repeat* or *reflect*. Default: *pad* |
+
+If the *stopOffset* and *stopColor* arrays do not have the same number of elements, then the minimum of the two is used as the stop points.
### Units {#gradient-renderer-units}
Dali::Property::Map map;
map[ "rendererType" ] = "gradient";
-map[ "gradientStartPosition" ] = Vector2( 0.5f, 0.5f );
-map[ "gradientEndPosition" ] = Vector2( -0.5f, -0.5f );
+map[ "startPosition" ] = Vector2( 0.5f, 0.5f );
+map[ "endPosition" ] = Vector2( -0.5f, -0.5f );
Dali::Property::Array stopOffsets;
stopOffsets.PushBack( 0.0f );
stopOffsets.PushBack( 0.6f );
stopOffsets.PushBack( 0.8f );
stopOffsets.PushBack( 1.f );
-map[ "gradientStopOffset" ] = stopOffsets;
+map[ "stopOffset" ] = stopOffsets;
Dali::Property::Array stopColors;
stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 255.f )/255.f );
stopColors.PushBack( Vector4( 214.f, 37.f, 139.f, 191.f )/255.f );
stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 150.f )/255.f );
stopColors.PushBack( Color::YELLOW );
-map[ "gradientStopColor" ] = stopColors;
+map[ "stopColor" ] = stopColors;
control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
~~~
control.background =
{
rendererType : "gradient",
- gradientStartPosition : [ 0.5, 0.5 ],
- gradientEndPosition : [ -0.5, -0.5 ],
- gradientStopOffset : [ 0.0, 0.3, 0.6, 0.8, 1.0 ],
- gradientStopColor : [
+ startPosition : [ 0.5, 0.5 ],
+ endPosition : [ -0.5, -0.5 ],
+ stopOffset : [ 0.0, 0.3, 0.6, 0.8, 1.0 ],
+ stopColor : [
[ 129 / 255, 198 / 255, 193 / 255, 255 / 255 ],
[ 196 / 255, 198 / 255, 71 / 255, 122 / 255 ],
[ 214 / 255, 37 / 255, 139 / 255, 191 / 255 ],
Dali::Property::Map map;
map[ "rendererType" ] = "gradient";
-map[ "gradientCenter" ] = Vector2( 0.5f, 0.5f );
-map[ "gradientRadius" ] = 1.414f;
+map[ "center" ] = Vector2( 0.5f, 0.5f );
+map[ "radius" ] = 1.414f;
Dali::Property::Array stopOffsets;
stopOffsets.PushBack( 0.0f );
stopOffsets.PushBack( 0.6f );
stopOffsets.PushBack( 0.8f );
stopOffsets.PushBack( 1.f );
-map[ "gradientStopOffset" ] = stopOffsets;
+map[ "stopOffset" ] = stopOffsets;
Dali::Property::Array stopColors;
stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 255.f )/255.f );
stopColors.PushBack( Vector4( 214.f, 37.f, 139.f, 191.f )/255.f );
stopColors.PushBack( Vector4( 129.f, 198.f, 193.f, 150.f )/255.f );
stopColors.PushBack( Color::YELLOW );
-map[ "gradientStopColor" ] = stopColors;
+map[ "stopColor" ] = stopColors;
control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
~~~
control.background =
{
rendererType : "gradient",
- gradientCenter : [ 0.5, 0.5 ],
- gradientRadius : 1.414,
- gradientStopOffset : [ 0.0, 0.3, 0.6, 0.8, 1.0 ],
- gradientStopColor : [
+ center : [ 0.5, 0.5 ],
+ radius : 1.414,
+ stopOffset : [ 0.0, 0.3, 0.6, 0.8, 1.0 ],
+ stopColor : [
[ 129 / 255, 198 / 255, 193 / 255, 255 / 255 ],
[ 196 / 255, 198 / 255, 71 / 255, 122 / 255 ],
[ 214 / 255, 37 / 255, 139 / 255, 191 / 255 ],