/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Property::Value propValue = control.GetProperty( Control::Property::BACKGROUND );
Property::Map* resultMap = propValue.GetMap();
- DALI_TEST_CHECK( resultMap->Find( "rendererType" ) );
- DALI_TEST_CHECK( resultMap->Find( "rendererType" )->Get<std::string>() == "COLOR" );
- DALI_TEST_CHECK( resultMap->Find( "mixColor" ) );
- DALI_TEST_CHECK( resultMap->Find( "mixColor" )->Get<Vector4>() == Color::RED );
+ DALI_TEST_CHECK( resultMap->Find( Visual::Property::TYPE ) );
+ DALI_TEST_CHECK( resultMap->Find( Visual::Property::TYPE )->Get<int>() == Visual::COLOR );
+ DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR ) );
+ DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR )->Get<Vector4>() == Color::RED );
DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::RED, TEST_LOCATION );
propValue = control.GetProperty( Control::Property::BACKGROUND );
resultMap = propValue.GetMap();
- DALI_TEST_CHECK( resultMap->Find( "mixColor" ) );
- DALI_TEST_CHECK( resultMap->Find( "mixColor" )->Get<Vector4>() == Color::YELLOW );
+ DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR ) );
+ DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR )->Get<Vector4>() == Color::YELLOW );
DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::YELLOW, TEST_LOCATION );
Property::Value propValue = control.GetProperty( Control::Property::BACKGROUND );
Property::Map* resultMap = propValue.GetMap();
- DALI_TEST_CHECK( resultMap->Find( "rendererType" ) );
- DALI_TEST_CHECK( resultMap->Find( "rendererType" )->Get<std::string>() == "IMAGE" );
- DALI_TEST_CHECK( resultMap->Find( "url" ) );
- DALI_TEST_CHECK( resultMap->Find( "url" )->Get<std::string>() == "TestImage" );
+ DALI_TEST_CHECK( resultMap->Find( Visual::Property::TYPE ) );
+ DALI_TEST_CHECK( resultMap->Find( Visual::Property::TYPE )->Get<int>() == Visual::IMAGE );
+ DALI_TEST_CHECK( resultMap->Find( ImageVisual::Property::URL ) );
+ DALI_TEST_CHECK( resultMap->Find( ImageVisual::Property::URL )->Get<std::string>() == "TestImage" );
image = ResourceImage::New("TestImage2");
control.SetBackgroundImage( image );
propValue = control.GetProperty( Control::Property::BACKGROUND );
resultMap = propValue.GetMap();
- DALI_TEST_CHECK( resultMap->Find( "url" ) );
- DALI_TEST_CHECK( resultMap->Find( "url" )->Get<std::string>() == "TestImage2" );
+ DALI_TEST_CHECK( resultMap->Find( ImageVisual::Property::URL ) );
+ DALI_TEST_CHECK( resultMap->Find( ImageVisual::Property::URL )->Get<std::string>() == "TestImage2" );
END_TEST;
}
DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND ).Get< Property::Map >().Empty() );
Property::Map imageMap;
- imageMap[ "rendererType" ] = "IMAGE";
- imageMap[ "url" ] = "TestImage";
+ imageMap[ Visual::Property::TYPE ] = Visual::IMAGE;
+ imageMap[ ImageVisual::Property::URL ] = "TestImage";
control.SetProperty( Control::Property::BACKGROUND, imageMap );
Property::Value propValue = control.GetProperty( Control::Property::BACKGROUND );
Property::Map* resultMap = propValue.GetMap();
- DALI_TEST_CHECK( resultMap->Find( "rendererType" ) );
- DALI_TEST_CHECK( resultMap->Find( "rendererType" )->Get<std::string>() == "IMAGE" );
- DALI_TEST_CHECK( resultMap->Find( "url" ) );
- DALI_TEST_CHECK( resultMap->Find( "url" )->Get<std::string>() == "TestImage" );
+ DALI_TEST_CHECK( resultMap->Find( Visual::Property::TYPE ) );
+ DALI_TEST_CHECK( resultMap->Find( Visual::Property::TYPE )->Get<int>() == Visual::IMAGE );
+ DALI_TEST_CHECK( resultMap->Find( ImageVisual::Property::URL ) );
+ DALI_TEST_CHECK( resultMap->Find( ImageVisual::Property::URL )->Get<std::string>() == "TestImage" );
Property::Map rendererMap;
- rendererMap["rendererType"] = "COLOR";
- rendererMap["mixColor"] = Color::CYAN;
+ rendererMap[Visual::Property::TYPE] = Visual::COLOR;
+ rendererMap[ColorVisual::Property::MIX_COLOR] = Color::CYAN;
control.SetProperty( Control::Property::BACKGROUND, rendererMap );
propValue = control.GetProperty( Control::Property::BACKGROUND );
resultMap = propValue.GetMap();
- DALI_TEST_CHECK( resultMap->Find( "rendererType" ) );
- DALI_TEST_CHECK( resultMap->Find( "rendererType" )->Get<std::string>() == "COLOR" );
- DALI_TEST_CHECK( resultMap->Find( "mixColor" ) );
- DALI_TEST_CHECK( resultMap->Find( "mixColor" )->Get<Vector4>() == Color::CYAN );
+ DALI_TEST_CHECK( resultMap->Find( Visual::Property::TYPE ) );
+ DALI_TEST_CHECK( resultMap->Find( Visual::Property::TYPE )->Get<int>() == Visual::COLOR );
+ DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR ) );
+ DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR )->Get<Vector4>() == Color::CYAN );
Property::Map emptyMap;
control.SetProperty( Control::Property::BACKGROUND, emptyMap );
control.SetProperty( Control::Property::BACKGROUND_IMAGE, deprecatedImageMap );
propValue = control.GetProperty( Control::Property::BACKGROUND_IMAGE );
resultMap = propValue.GetMap();
- DALI_TEST_CHECK( resultMap->Find( "url" )->Get< std::string >() == "TestImage" );
+ DALI_TEST_CHECK( resultMap->Find( ImageVisual::Property::URL )->Get< std::string >() == "TestImage" );
control.SetProperty( Control::Property::BACKGROUND_IMAGE, emptyMap );
DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND_IMAGE ).Get< Property::Map >().Empty() );
#include <dali/public-api/rendering/renderer.h>
#include <dali/public-api/rendering/geometry.h>
+#include <dali-toolkit/dali-toolkit.h>
+
#include <toolkit-environment-variable.h> // for setting environment variable: DALI_DEBUG_RENDERING
using namespace Dali;
Property::Map propertyMap;
visual.CreatePropertyMap( propertyMap );
- Property::Value* typeValue = propertyMap.Find( "rendererType", Property::STRING );
+ Property::Value* typeValue = propertyMap.Find( Visual::Property::TYPE, Property::INTEGER );
if ( typeValue )
{
- isDebugVisualType = ( typeValue->Get<std::string>() == "DEBUG" );
+ isDebugVisualType = ( typeValue->Get<int>() == Visual::DEBUG );
}
Actor actor = Actor::New();
// Test that color visual is replaced with debug visual
Property::Map propertyMap1;
- propertyMap1.Insert("rendererType", "COLOR");
- propertyMap1.Insert("mixColor", Color::BLUE);
+ propertyMap1.Insert(Visual::Property::TYPE, Visual::COLOR);
+ propertyMap1.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
Visual::Base colorVisual = factory.CreateVisual(propertyMap1);
DALI_TEST_CHECK( colorVisual );
DALI_TEST_CHECK( IsDebugVisual( colorVisual ) );
// Test that border visual is replaced with debug visual
Property::Map propertyMap2;
- propertyMap2.Insert("rendererType", "BORDER");
- propertyMap2.Insert("borderColor", Color::BLUE);
- propertyMap2.Insert("borderSize", 2.f);
+ propertyMap2.Insert(Visual::Property::TYPE, Visual::BORDER);
+ propertyMap2.Insert(BorderVisual::Property::COLOR, Color::BLUE);
+ propertyMap2.Insert(BorderVisual::Property::SIZE, 2.f);
Visual::Base borderVisual = factory.CreateVisual(propertyMap2);
DALI_TEST_CHECK( borderVisual );
DALI_TEST_CHECK( IsDebugVisual( borderVisual ) );
// Test that gradient visual is replaced with debug visual
Property::Map propertyMap3;
- propertyMap3.Insert("rendererType", "GRADIENT");
+ propertyMap3.Insert(Visual::Property::TYPE, Visual::GRADIENT);
Vector2 start(-1.f, -1.f);
Vector2 end(1.f, 1.f);
- propertyMap3.Insert("startPosition", start);
- propertyMap3.Insert("endPosition", end);
- propertyMap3.Insert("spreadMethod", "REPEAT");
+ propertyMap3.Insert(GradientVisual::Property::START_POSITION, start);
+ propertyMap3.Insert(GradientVisual::Property::END_POSITION, end);
+ propertyMap3.Insert(GradientVisual::Property::SPREAD_METHOD, GradientVisual::SpreadMethod::REPEAT);
Property::Array stopOffsets;
stopOffsets.PushBack( 0.2f );
stopOffsets.PushBack( 0.8f );
- propertyMap3.Insert("stopOffset", stopOffsets);
+ propertyMap3.Insert(GradientVisual::Property::STOP_OFFSET, stopOffsets);
Property::Array stopColors;
stopColors.PushBack( Color::RED );
stopColors.PushBack( Color::GREEN );
- propertyMap3.Insert("stopColor", stopColors);
+ propertyMap3.Insert(GradientVisual::Property::STOP_COLOR, stopColors);
Visual::Base gradientVisual = factory.CreateVisual(propertyMap3);
DALI_TEST_CHECK( gradientVisual );
DALI_TEST_CHECK( IsDebugVisual( gradientVisual ) );
// Test that image visual is replaced with debug visual
Property::Map propertyMap4;
- propertyMap4.Insert( "rendererType", "IMAGE" );
- propertyMap4.Insert( "url", TEST_IMAGE_FILE_NAME );
+ propertyMap4.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap4.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
Visual::Base imageVisual = factory.CreateVisual( propertyMap4 );
DALI_TEST_CHECK( imageVisual );
DALI_TEST_CHECK( IsDebugVisual( imageVisual ) );
// Test that n patch visual is replaced with debug visual
Property::Map propertyMap5;
- propertyMap5.Insert( "rendererType", "IMAGE" );
- propertyMap5.Insert( "url", TEST_NPATCH_FILE_NAME );
+ propertyMap5.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap5.Insert( ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME );
Visual::Base nPatchVisual = factory.CreateVisual( propertyMap4 );
DALI_TEST_CHECK( nPatchVisual );
DALI_TEST_CHECK( IsDebugVisual( nPatchVisual ) );
// Test that color visual is replaced with debug visual
Dali::Property::Map map;
- map[ "rendererType" ] = "COLOR";
- map[ "mixColor" ] = Color::CYAN;
+ map[ Visual::Property::TYPE ] = Visual::COLOR;
+ map[ ColorVisual::Property::MIX_COLOR ] = Color::CYAN;
Visual::Base colorVisual = factory.CreateVisual( map);
DALI_TEST_CHECK( colorVisual );
// Test that border visual is replaced with debug visual
map.Clear();
- map[ "rendererType" ] = "BORDER";
- map[ "borderColor" ] = Color::GREEN;
- map[ "borderSize" ] = 2.f;
+ map[ Visual::Property::TYPE ] = Visual::BORDER;
+ map[ BorderVisual::Property::COLOR ] = Color::GREEN;
+ map[ BorderVisual::Property::SIZE ] = 2.f;
Visual::Base borderVisual = factory.CreateVisual( map );
DALI_TEST_CHECK( borderVisual );
DALI_TEST_CHECK( IsDebugVisual( borderVisual ) );
ImageView imageView = ImageView::New();
// Sync loading is used
- syncLoadingMap[ "url" ] = gImage_600_RGB;
+ syncLoadingMap[ ImageVisual::Property::URL ] = gImage_600_RGB;
imageView.SetProperty( ImageView::Property::IMAGE, syncLoadingMap );
// BitmapLoader is used, and the loading is started immediately even the actor is not on stage.
ImageView imageView = ImageView::New( );
// Sync loading is used
- syncLoadingMap[ "url" ] = gImage_34_RGBA;
- syncLoadingMap[ "desiredHeight" ] = 34;
- syncLoadingMap[ "desiredWidth" ] = 34;
+ syncLoadingMap[ ImageVisual::Property::URL ] = gImage_34_RGBA;
+ syncLoadingMap[ ImageVisual::Property::DESIRED_HEIGHT ] = 34;
+ syncLoadingMap[ ImageVisual::Property::DESIRED_WIDTH ] = 34;
imageView.SetProperty( ImageView::Property::IMAGE, syncLoadingMap );
// loading is started even if the actor is offStage
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali-toolkit/devel-api/shader-effects/swirl-effect.h>
using namespace Dali;
+using namespace Dali::Toolkit;
int UtcDaliCreateAlphaDiscardEffect(void)
{
Property::Map effect = Toolkit::CreateAlphaDiscardEffect();
DALI_TEST_CHECK( !effect.Empty() );
- Property::Value* customShaderValue = effect.Find( "shader" );
+ Property::Value* customShaderValue = effect.Find( Visual::Property::SHADER );
DALI_TEST_CHECK( customShaderValue );
Property::Map customShader;
DALI_TEST_CHECK( customShaderValue->Get( customShader ) );
- Property::Value* vertexShaderValue = customShader.Find( "vertexShader" );
+ Property::Value* vertexShaderValue = customShader.Find( Visual::Shader::Property::VERTEX_SHADER );
DALI_TEST_CHECK( !vertexShaderValue );
- Property::Value* fragmentShaderValue = customShader.Find( "fragmentShader" );
+ Property::Value* fragmentShaderValue = customShader.Find( Visual::Shader::Property::FRAGMENT_SHADER );
DALI_TEST_CHECK( fragmentShaderValue );
std::string fragmentShader;
DALI_TEST_CHECK( fragmentShaderValue->Get( fragmentShader ) );
DALI_TEST_CHECK( !fragmentShader.empty() );
- Property::Value* gridXValue = customShader.Find( "subdivideGridX" );
+ Property::Value* gridXValue = customShader.Find( Visual::Shader::Property::SUBDIVIDE_GRID_X );
DALI_TEST_CHECK( !gridXValue );
- Property::Value* gridYValue = customShader.Find( "subdivideGridY" );
+ Property::Value* gridYValue = customShader.Find( Visual::Shader::Property::SUBDIVIDE_GRID_Y );
DALI_TEST_CHECK( !gridYValue );
- Property::Value* hintsValue = customShader.Find( "hints" );
+ Property::Value* hintsValue = customShader.Find( Visual::Shader::Property::HINTS );
DALI_TEST_CHECK( !hintsValue );
END_TEST;
Property::Map effect = Toolkit::CreateDissolveEffect( highPrecision );
DALI_TEST_CHECK( !effect.Empty() );
- Property::Value* customShaderValue = effect.Find( "shader" );
+ Property::Value* customShaderValue = effect.Find( Visual::Property::SHADER );
DALI_TEST_CHECK( customShaderValue );
Property::Map customShader;
DALI_TEST_CHECK( customShaderValue->Get( customShader ) );
- Property::Value* vertexShaderValue = customShader.Find( "vertexShader" );
+ Property::Value* vertexShaderValue = customShader.Find( Visual::Shader::Property::VERTEX_SHADER );
DALI_TEST_CHECK( vertexShaderValue );
std::string vertexShader;
DALI_TEST_CHECK( vertexShaderValue->Get( vertexShader ) );
DALI_TEST_CHECK( !vertexShader.empty() );
- Property::Value* fragmentShaderValue = customShader.Find( "fragmentShader" );
+ Property::Value* fragmentShaderValue = customShader.Find( Visual::Shader::Property::FRAGMENT_SHADER );
DALI_TEST_CHECK( fragmentShaderValue );
std::string fragmentShader;
DALI_TEST_CHECK( fragmentShaderValue->Get( fragmentShader ) );
DALI_TEST_CHECK( !fragmentShader.empty() );
- Property::Value* gridXValue = customShader.Find( "subdivideGridX" );
+ Property::Value* gridXValue = customShader.Find( Visual::Shader::Property::SUBDIVIDE_GRID_X );
DALI_TEST_CHECK( gridXValue );
int gridX = 0;
DALI_TEST_CHECK( gridXValue->Get( gridX ) );
DALI_TEST_CHECK( gridX > 1 );
- Property::Value* gridYValue = customShader.Find( "subdivideGridY" );
+ Property::Value* gridYValue = customShader.Find( Visual::Shader::Property::SUBDIVIDE_GRID_Y );
DALI_TEST_CHECK( gridYValue );
int gridY = 0;
DALI_TEST_CHECK( gridYValue->Get( gridY ) );
DALI_TEST_CHECK( gridY > 1 );
- Property::Value* hintsValue = customShader.Find( "hints" );
+ Property::Value* hintsValue = customShader.Find( Visual::Shader::Property::HINTS );
DALI_TEST_CHECK( hintsValue );
- std::string hints;
+ int hints;;
DALI_TEST_CHECK( hintsValue->Get( hints ) );
- DALI_TEST_CHECK( hints == "outputIsTransparent" );
+ DALI_TEST_CHECK( hints == Shader::Hint::OUTPUT_IS_TRANSPARENT );
Actor actor = Actor::New();
Toolkit::DissolveEffectSetCentralLine( actor, Vector2::ONE, Vector2::ONE, 0.0f );
Property::Map effect = Toolkit::CreateDistanceFieldEffect();
DALI_TEST_CHECK( !effect.Empty() );
- Property::Value* customShaderValue = effect.Find( "shader" );
+ Property::Value* customShaderValue = effect.Find( Visual::Property::SHADER );
DALI_TEST_CHECK( customShaderValue );
Property::Map customShader;
DALI_TEST_CHECK( customShaderValue->Get( customShader ) );
- Property::Value* vertexShaderValue = customShader.Find( "vertexShader" );
+ Property::Value* vertexShaderValue = customShader.Find( Visual::Shader::Property::VERTEX_SHADER );
DALI_TEST_CHECK( !vertexShaderValue );
- Property::Value* fragmentShaderValue = customShader.Find( "fragmentShader" );
+ Property::Value* fragmentShaderValue = customShader.Find( Visual::Shader::Property::FRAGMENT_SHADER );
DALI_TEST_CHECK( fragmentShaderValue );
std::string fragmentShader;
DALI_TEST_CHECK( fragmentShaderValue->Get( fragmentShader ) );
DALI_TEST_CHECK( !fragmentShader.empty() );
- Property::Value* gridXValue = customShader.Find( "subdivideGridX" );
+ Property::Value* gridXValue = customShader.Find( Visual::Shader::Property::SUBDIVIDE_GRID_X );
DALI_TEST_CHECK( !gridXValue );
- Property::Value* hintsValue = customShader.Find( "hints" );
+ Property::Value* hintsValue = customShader.Find( Visual::Shader::Property::HINTS );
DALI_TEST_CHECK( hintsValue );
- std::string hints;
+ int hints;;
DALI_TEST_CHECK( hintsValue->Get( hints ) );
- DALI_TEST_CHECK( hints == "outputIsTransparent" );
+ DALI_TEST_CHECK( hints == Shader::Hint::OUTPUT_IS_TRANSPARENT );
END_TEST;
}
Property::Map effect = Toolkit::CreateImageRegionEffect();
DALI_TEST_CHECK( !effect.Empty() );
- Property::Value* customShaderValue = effect.Find( "shader" );
+ Property::Value* customShaderValue = effect.Find( Visual::Property::SHADER );
DALI_TEST_CHECK( customShaderValue );
Property::Map customShader;
DALI_TEST_CHECK( customShaderValue->Get( customShader ) );
- Property::Value* vertexShaderValue = customShader.Find( "vertexShader" );
+ Property::Value* vertexShaderValue = customShader.Find( Visual::Shader::Property::VERTEX_SHADER );
DALI_TEST_CHECK( vertexShaderValue );
std::string vertexShader;
DALI_TEST_CHECK( vertexShaderValue->Get( vertexShader ) );
DALI_TEST_CHECK( !vertexShader.empty() );
- Property::Value* fragmentShaderValue = customShader.Find( "fragmentShader" );
+ Property::Value* fragmentShaderValue = customShader.Find( Visual::Shader::Property::FRAGMENT_SHADER );
DALI_TEST_CHECK( !fragmentShaderValue );
- Property::Value* gridXValue = customShader.Find( "subdivideGridX" );
+ Property::Value* gridXValue = customShader.Find( Visual::Shader::Property::SUBDIVIDE_GRID_X );
DALI_TEST_CHECK( !gridXValue );
- Property::Value* gridYValue = customShader.Find( "subdivideGridY" );
+ Property::Value* gridYValue = customShader.Find( Visual::Shader::Property::SUBDIVIDE_GRID_Y );
DALI_TEST_CHECK( !gridYValue );
- Property::Value* hintsValue = customShader.Find( "hints" );
+ Property::Value* hintsValue = customShader.Find( Visual::Shader::Property::HINTS );
DALI_TEST_CHECK( !hintsValue );
END_TEST;
Property::Map effect = Toolkit::CreateMotionBlurEffect();
DALI_TEST_CHECK( !effect.Empty() );
- Property::Value* customShaderValue = effect.Find( "shader" );
+ Property::Value* customShaderValue = effect.Find( Visual::Property::SHADER );
DALI_TEST_CHECK( customShaderValue );
Property::Map customShader;
DALI_TEST_CHECK( customShaderValue->Get( customShader ) );
- Property::Value* vertexShaderValue = customShader.Find( "vertexShader" );
+ Property::Value* vertexShaderValue = customShader.Find( Visual::Shader::Property::VERTEX_SHADER );
DALI_TEST_CHECK( vertexShaderValue );
std::string vertexShader;
DALI_TEST_CHECK( vertexShaderValue->Get( vertexShader ) );
DALI_TEST_CHECK( !vertexShader.empty() );
- Property::Value* fragmentShaderValue = customShader.Find( "fragmentShader" );
+ Property::Value* fragmentShaderValue = customShader.Find( Visual::Shader::Property::FRAGMENT_SHADER );
DALI_TEST_CHECK( fragmentShaderValue );
std::string fragmentShader;
DALI_TEST_CHECK( fragmentShaderValue->Get( fragmentShader ) );
DALI_TEST_CHECK( !fragmentShader.empty() );
- Property::Value* gridXValue = customShader.Find( "subdivideGridX" );
+ Property::Value* gridXValue = customShader.Find( Visual::Shader::Property::SUBDIVIDE_GRID_X );
DALI_TEST_CHECK( gridXValue );
int gridX = 0;
DALI_TEST_CHECK( gridXValue->Get( gridX ) );
DALI_TEST_CHECK( gridX > 1 );
- Property::Value* gridYValue = customShader.Find( "subdivideGridY" );
+ Property::Value* gridYValue = customShader.Find( Visual::Shader::Property::SUBDIVIDE_GRID_Y );
DALI_TEST_CHECK( gridYValue );
int gridY = 0;
DALI_TEST_CHECK( gridYValue->Get( gridY ) );
DALI_TEST_CHECK( gridY > 1 );
- Property::Value* hintsValue = customShader.Find( "hints" );
+ Property::Value* hintsValue = customShader.Find( Visual::Shader::Property::HINTS );
DALI_TEST_CHECK( hintsValue );
- std::string hints;
+ int hints;;
DALI_TEST_CHECK( hintsValue->Get( hints ) );
- DALI_TEST_CHECK( hints == "outputIsTransparent" );
+ DALI_TEST_CHECK( hints == Shader::Hint::OUTPUT_IS_TRANSPARENT );
unsigned int sampleCount( 4 );
Actor actor = Actor::New();
Property::Map effect = Toolkit::CreateMotionStretchEffect();
DALI_TEST_CHECK( !effect.Empty() );
- Property::Value* customShaderValue = effect.Find( "shader" );
+ Property::Value* customShaderValue = effect.Find( Visual::Property::SHADER );
DALI_TEST_CHECK( customShaderValue );
Property::Map customShader;
DALI_TEST_CHECK( customShaderValue->Get( customShader ) );
- Property::Value* vertexShaderValue = customShader.Find( "vertexShader" );
+ Property::Value* vertexShaderValue = customShader.Find( Visual::Shader::Property::VERTEX_SHADER );
DALI_TEST_CHECK( vertexShaderValue );
std::string vertexShader;
DALI_TEST_CHECK( vertexShaderValue->Get( vertexShader ) );
DALI_TEST_CHECK( !vertexShader.empty() );
- Property::Value* fragmentShaderValue = customShader.Find( "fragmentShader" );
+ Property::Value* fragmentShaderValue = customShader.Find( Visual::Shader::Property::FRAGMENT_SHADER );
DALI_TEST_CHECK( fragmentShaderValue );
std::string fragmentShader;
DALI_TEST_CHECK( fragmentShaderValue->Get( fragmentShader ) );
DALI_TEST_CHECK( !fragmentShader.empty() );
- Property::Value* gridXValue = customShader.Find( "subdivideGridX" );
+ Property::Value* gridXValue = customShader.Find( Visual::Shader::Property::SUBDIVIDE_GRID_X );
DALI_TEST_CHECK( gridXValue );
int gridX = 0;
DALI_TEST_CHECK( gridXValue->Get( gridX ) );
DALI_TEST_CHECK( gridX > 1 );
- Property::Value* gridYValue = customShader.Find( "subdivideGridY" );
+ Property::Value* gridYValue = customShader.Find( Visual::Shader::Property::SUBDIVIDE_GRID_Y );
DALI_TEST_CHECK( gridYValue );
int gridY = 0;
DALI_TEST_CHECK( gridYValue->Get( gridY ) );
DALI_TEST_CHECK( gridY > 1 );
- Property::Value* hintsValue = customShader.Find( "hints" );
+ Property::Value* hintsValue = customShader.Find( Visual::Shader::Property::HINTS );
DALI_TEST_CHECK( hintsValue );
- std::string hints;
+ int hints;;
DALI_TEST_CHECK( hintsValue->Get( hints ) );
- DALI_TEST_CHECK( hints == "outputIsTransparent" );
+ DALI_TEST_CHECK( hints == Shader::Hint::OUTPUT_IS_TRANSPARENT );
Actor actor = Actor::New();
Toolkit::SetMotionStretchProperties( actor );
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
Property::Map map;
- map["rendererType"] = "IMAGE";
+ map["visualType"] = "IMAGE";
map["size"] = Vector2(200, 200);
map["url"] = "track2.png";
slider.SetProperty(Slider::Property::TRACK_VISUAL, map);
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
VisualFactory factory = VisualFactory::Get();
Dali::Property::Map map;
- map[ "rendererType" ] = "COLOR";
- map[ "mixColor" ] = color;
+ map[ Visual::Property::TYPE ] = Visual::COLOR;
+ map[ ColorVisual::Property::MIX_COLOR ] = color;
Visual::Base colorVisual = factory.CreateVisual( map );
colorVisual.SetOnStage( solidColorActor );
#include <dali/public-api/rendering/texture-set.h>
#include <dali/public-api/rendering/shader.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/dali-toolkit.h>
using namespace Dali;
using namespace Dali::Toolkit;
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
- propertyMap.Insert("rendererType", "COLOR");
- propertyMap.Insert("mixColor", Color::BLUE);
+ propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
+ propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
Visual::Base visual = factory.CreateVisual( propertyMap );
Visual::Base visualCopy( visual );
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
- propertyMap.Insert("rendererType", "COLOR");
- propertyMap.Insert("mixColor", Color::BLUE);
+ propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
+ propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
Visual::Base visual = factory.CreateVisual( propertyMap );
visual.SetDepthIndex( 1.f );
// color colorVisual
Dali::Property::Map map;
- map[ "rendererType" ] = "COLOR";
- map[ "mixColor" ] = Color::MAGENTA;
+ map[ Visual::Property::TYPE ] = Visual::COLOR;
+ map[ ColorVisual::Property::MIX_COLOR ] = Color::MAGENTA;
Visual::Base colorVisual = factory.CreateVisual( map );
colorVisual.SetSize( visualSize );
DALI_TEST_EQUALS( colorVisual.GetSize(), visualSize, TEST_LOCATION );
// border visual
float borderSize = 5.f;
map.Clear();
- map[ "rendererType" ] = "BORDER";
- map[ "borderColor" ] = Color::RED;
- map[ "borderSize" ] = borderSize;
+ map[ Visual::Property::TYPE ] = Visual::BORDER;
+ map[ BorderVisual::Property::COLOR ] = Color::RED;
+ map[ BorderVisual::Property::SIZE ] = borderSize;
Visual::Base borderVisual = factory.CreateVisual( map );
borderVisual.SetSize( visualSize );
DALI_TEST_EQUALS( borderVisual.GetSize(), visualSize, TEST_LOCATION );
// gradient gradientVisual
Property::Map propertyMap;
- propertyMap.Insert("rendererType", "GRADIENT");
+ propertyMap.Insert(Visual::Property::TYPE, Visual::GRADIENT);
Vector2 start(-1.f, -1.f);
Vector2 end(1.f, 1.f);
- propertyMap.Insert("startPosition", start);
- propertyMap.Insert("endPosition", end);
- propertyMap.Insert("stopOffset", Vector2(0.f, 1.f));
+ propertyMap.Insert(GradientVisual::Property::START_POSITION, start);
+ propertyMap.Insert(GradientVisual::Property::END_POSITION, end);
+ propertyMap.Insert(GradientVisual::Property::STOP_OFFSET, Vector2(0.f, 1.f));
Property::Array stopColors;
stopColors.PushBack( Color::RED );
stopColors.PushBack( Color::GREEN );
- propertyMap.Insert("stopColor", stopColors);
+ propertyMap.Insert(GradientVisual::Property::STOP_COLOR, stopColors);
Visual::Base gradientVisual = factory.CreateVisual(propertyMap);
gradientVisual.SetSize( visualSize );
DALI_TEST_EQUALS( gradientVisual.GetSize(), visualSize, TEST_LOCATION );
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
- propertyMap.Insert("rendererType", "COLOR");
- propertyMap.Insert("mixColor", Color::BLUE);
+ propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
+ propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
Visual::Base visual = factory.CreateVisual( propertyMap );
Actor actor = Actor::New();
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
- propertyMap.Insert("rendererType", "COLOR");
- propertyMap.Insert("mixColor", Color::BLUE);
+ propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
+ propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
Visual::Base colorVisual = factory.CreateVisual( propertyMap );
Property::Map resultMap;
colorVisual.CreatePropertyMap( resultMap );
- Property::Value* typeValue = resultMap.Find( "rendererType", Property::STRING );
+ Property::Value* typeValue = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
DALI_TEST_CHECK( typeValue );
- DALI_TEST_CHECK( typeValue->Get<std::string>() == "COLOR" );
+ DALI_TEST_CHECK( typeValue->Get<int>() == Visual::COLOR );
- Property::Value* colorValue = resultMap.Find( "mixColor", Property::VECTOR4 );
+ Property::Value* colorValue = resultMap.Find( ColorVisual::Property::MIX_COLOR, Property::VECTOR4 );
DALI_TEST_CHECK( colorValue );
DALI_TEST_CHECK( colorValue->Get<Vector4>() == Color::BLUE );
// change the blend color
Actor actor;
colorVisual.RemoveAndReset( actor );
- propertyMap["mixColor"] = Color::CYAN;
+ propertyMap[ColorVisual::Property::MIX_COLOR] = Color::CYAN;
colorVisual = factory.CreateVisual( propertyMap );
colorVisual.CreatePropertyMap( resultMap );
- colorValue = resultMap.Find( "mixColor", Property::VECTOR4 );
+ colorValue = resultMap.Find( ColorVisual::Property::MIX_COLOR, Property::VECTOR4 );
DALI_TEST_CHECK( colorValue );
DALI_TEST_CHECK( colorValue->Get<Vector4>() == Color::CYAN );
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
- propertyMap.Insert("rendererType", "BORDER");
- propertyMap.Insert("borderColor", Color::BLUE);
- propertyMap.Insert("borderSize", 5.f);
+ propertyMap.Insert(Visual::Property::TYPE, Visual::BORDER);
+ propertyMap.Insert(BorderVisual::Property::COLOR, Color::BLUE);
+ propertyMap.Insert(BorderVisual::Property::SIZE, 5.f);
Visual::Base borderVisual = factory.CreateVisual( propertyMap );
Property::Map resultMap;
borderVisual.CreatePropertyMap( resultMap );
// check the property values from the returned map from visual
- Property::Value* typeValue = resultMap.Find( "rendererType", Property::STRING );
+ Property::Value* typeValue = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
DALI_TEST_CHECK( typeValue );
- DALI_TEST_CHECK( typeValue->Get<std::string>() == "BORDER" );
+ DALI_TEST_CHECK( typeValue->Get<int>() == Visual::BORDER );
- Property::Value* colorValue = resultMap.Find( "borderColor", Property::VECTOR4 );
+ Property::Value* colorValue = resultMap.Find( BorderVisual::Property::COLOR, Property::VECTOR4 );
DALI_TEST_CHECK( colorValue );
DALI_TEST_CHECK( colorValue->Get<Vector4>() == Color::BLUE );
- Property::Value* sizeValue = resultMap.Find( "borderSize", Property::FLOAT );
+ Property::Value* sizeValue = resultMap.Find( BorderVisual::Property::SIZE, Property::FLOAT );
DALI_TEST_CHECK( sizeValue );
DALI_TEST_CHECK( sizeValue->Get<float>() == 5.f );
Property::Map propertyMap1;
- propertyMap1[ "rendererType" ] = "BORDER";
- propertyMap1[ "borderColor" ] = Color::CYAN;
- propertyMap1[ "borderSize" ] = 10.0f;
+ propertyMap1[ Visual::Property::TYPE ] = Visual::BORDER;
+ propertyMap1[ BorderVisual::Property::COLOR ] = Color::CYAN;
+ propertyMap1[ BorderVisual::Property::SIZE ] = 10.0f;
borderVisual = factory.CreateVisual( propertyMap1 );
borderVisual.CreatePropertyMap( resultMap );
- typeValue = resultMap.Find( "rendererType", Property::STRING );
+ typeValue = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
DALI_TEST_CHECK( typeValue );
- DALI_TEST_CHECK( typeValue->Get<std::string>() == "BORDER" );
+ DALI_TEST_CHECK( typeValue->Get<int>() == Visual::BORDER );
- colorValue = resultMap.Find( "borderColor", Property::VECTOR4 );
+ colorValue = resultMap.Find( BorderVisual::Property::COLOR, Property::VECTOR4 );
DALI_TEST_CHECK( colorValue );
DALI_TEST_CHECK( colorValue->Get<Vector4>() == Color::CYAN );
- colorValue = resultMap.Find( "borderSize", Property::FLOAT );
+ colorValue = resultMap.Find( BorderVisual::Property::SIZE, Property::FLOAT );
DALI_TEST_CHECK( colorValue );
DALI_TEST_CHECK( colorValue->Get<float>() == 10.f );
DALI_TEST_CHECK( factory );
Property::Map propertyMap;
- propertyMap.Insert("rendererType", "GRADIENT");
+ propertyMap.Insert(Visual::Property::TYPE, Visual::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");
+ propertyMap.Insert(GradientVisual::Property::START_POSITION, start);
+ propertyMap.Insert(GradientVisual::Property::END_POSITION, end);
+ propertyMap.Insert(GradientVisual::Property::SPREAD_METHOD, GradientVisual::SpreadMethod::REPEAT);
- propertyMap.Insert("stopOffset", Vector2(0.2f, 0.8f));
+ propertyMap.Insert(GradientVisual::Property::STOP_OFFSET, Vector2(0.2f, 0.8f));
Property::Array stopColors;
stopColors.PushBack( Color::RED );
stopColors.PushBack( Color::GREEN );
- propertyMap.Insert("stopColor", stopColors);
+ propertyMap.Insert(GradientVisual::Property::STOP_COLOR, stopColors);
Visual::Base gradientVisual = factory.CreateVisual(propertyMap);
gradientVisual.CreatePropertyMap( resultMap );
// check the property values from the returned map from visual
- Property::Value* value = resultMap.Find( "rendererType", Property::STRING );
+ Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<std::string>() == "GRADIENT" );
+ DALI_TEST_CHECK( value->Get<int>() == Visual::GRADIENT );
- value = resultMap.Find( "units", Property::STRING );
+ value = resultMap.Find( GradientVisual::Property::UNITS, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<std::string>() == "OBJECT_BOUNDING_BOX" );
+ DALI_TEST_CHECK( value->Get<int>() == GradientVisual::Units::OBJECT_BOUNDING_BOX );
- value = resultMap.Find( "spreadMethod", Property::STRING );
+ value = resultMap.Find( GradientVisual::Property::SPREAD_METHOD, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<std::string>() == "REPEAT" );
+ DALI_TEST_CHECK( value->Get<int>() == GradientVisual::SpreadMethod::REPEAT );
- value = resultMap.Find( "startPosition", Property::VECTOR2 );
+ value = resultMap.Find( GradientVisual::Property::START_POSITION, Property::VECTOR2 );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<Vector2>(), start , Math::MACHINE_EPSILON_100, TEST_LOCATION );
- value = resultMap.Find( "endPosition", Property::VECTOR2 );
+ value = resultMap.Find( GradientVisual::Property::END_POSITION, Property::VECTOR2 );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<Vector2>(), end , Math::MACHINE_EPSILON_100, TEST_LOCATION );
- value = resultMap.Find( "stopOffset", Property::ARRAY );
+ value = resultMap.Find( GradientVisual::Property::STOP_OFFSET, 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( "stopColor", Property::ARRAY );
+ value = resultMap.Find( GradientVisual::Property::STOP_COLOR, Property::ARRAY );
DALI_TEST_CHECK( value );
Property::Array* colorArray = value->GetArray();
DALI_TEST_CHECK( colorArray->Count() == 2 );
DALI_TEST_CHECK( factory );
Property::Map propertyMap;
- propertyMap.Insert("rendererType", "GRADIENT");
+ propertyMap.Insert(Visual::Property::TYPE, Visual::GRADIENT);
Vector2 center(100.f, 100.f);
float radius = 100.f;
- propertyMap.Insert("units", "USER_SPACE");
- propertyMap.Insert("center", center);
- propertyMap.Insert("radius", radius);
- propertyMap.Insert("stopOffset", Vector3(0.1f, 0.3f, 1.1f));
+ propertyMap.Insert(GradientVisual::Property::UNITS, GradientVisual::Units::USER_SPACE);
+ propertyMap.Insert(GradientVisual::Property::CENTER, center);
+ propertyMap.Insert(GradientVisual::Property::RADIUS, radius);
+ propertyMap.Insert(GradientVisual::Property::STOP_OFFSET, Vector3(0.1f, 0.3f, 1.1f));
Property::Array stopColors;
stopColors.PushBack( Color::RED );
stopColors.PushBack( Color::BLACK );
stopColors.PushBack( Color::GREEN );
- propertyMap.Insert("stopColor", stopColors);
+ propertyMap.Insert(GradientVisual::Property::STOP_COLOR, stopColors);
Visual::Base gradientVisual = factory.CreateVisual(propertyMap);
DALI_TEST_CHECK( gradientVisual );
gradientVisual.CreatePropertyMap( resultMap );
// check the property values from the returned map from visual
- Property::Value* value = resultMap.Find( "rendererType", Property::STRING );
+ Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<std::string>() == "GRADIENT" );
+ DALI_TEST_CHECK( value->Get<int>() == Visual::GRADIENT );
- value = resultMap.Find( "units", Property::STRING );
+ value = resultMap.Find( GradientVisual::Property::UNITS, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<std::string>() == "USER_SPACE" );
+ DALI_TEST_CHECK( value->Get<int>() == GradientVisual::Units::USER_SPACE );
- value = resultMap.Find( "spreadMethod", Property::STRING );
+ value = resultMap.Find( GradientVisual::Property::SPREAD_METHOD, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<std::string>() == "PAD" );
+ DALI_TEST_CHECK( value->Get<int>() == GradientVisual::SpreadMethod::PAD );
- value = resultMap.Find( "center", Property::VECTOR2 );
+ value = resultMap.Find( GradientVisual::Property::CENTER, Property::VECTOR2 );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<Vector2>(), center , Math::MACHINE_EPSILON_100, TEST_LOCATION );
- value = resultMap.Find( "radius", Property::FLOAT );
+ value = resultMap.Find( GradientVisual::Property::RADIUS, Property::FLOAT );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<float>(), radius , Math::MACHINE_EPSILON_100, TEST_LOCATION );
- value = resultMap.Find( "stopOffset", Property::ARRAY );
+ value = resultMap.Find( GradientVisual::Property::STOP_OFFSET, 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( "stopColor", Property::ARRAY );
+ value = resultMap.Find( GradientVisual::Property::STOP_COLOR, Property::ARRAY );
DALI_TEST_CHECK( value );
Property::Array* colorArray = value->GetArray();
DALI_TEST_CHECK( colorArray->Count() == 3 );
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "IMAGE" );
- propertyMap.Insert( "url", TEST_IMAGE_FILE_NAME );
- propertyMap.Insert( "desiredWidth", 20 );
- propertyMap.Insert( "desiredHeight", 30 );
- propertyMap.Insert( "fittingMode", "FIT_HEIGHT" );
- propertyMap.Insert( "samplingMode", "BOX_THEN_NEAREST" );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+ propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, 20 );
+ propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, 30 );
+ propertyMap.Insert( ImageVisual::Property::FITTING_MODE, FittingMode::FIT_HEIGHT );
+ propertyMap.Insert( ImageVisual::Property::SAMPLING_MODE, SamplingMode::BOX_THEN_NEAREST );
propertyMap.Insert( "synchronousLoading", true );
Visual::Base imageVisual = factory.CreateVisual(propertyMap);
imageVisual.CreatePropertyMap( resultMap );
// check the property values from the returned map from visual
- Property::Value* value = resultMap.Find( "rendererType", Property::STRING );
+ Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<std::string>() == "IMAGE" );
+ DALI_TEST_CHECK( value->Get<int>() == Visual::IMAGE );
- value = resultMap.Find( "url", Property::STRING );
+ value = resultMap.Find( ImageVisual::Property::URL, Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == TEST_IMAGE_FILE_NAME );
- value = resultMap.Find( "fittingMode", Property::STRING );
+ value = resultMap.Find( ImageVisual::Property::FITTING_MODE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<std::string>() == "FIT_HEIGHT" );
+ DALI_TEST_CHECK( value->Get<int>() == FittingMode::FIT_HEIGHT );
- value = resultMap.Find( "samplingMode", Property::STRING );
+ value = resultMap.Find( ImageVisual::Property::SAMPLING_MODE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<std::string>() == "BOX_THEN_NEAREST" );
+ DALI_TEST_CHECK( value->Get<int>() == SamplingMode::BOX_THEN_NEAREST );
- value = resultMap.Find( "desiredWidth", Property::INTEGER );
+ value = resultMap.Find( ImageVisual::Property::DESIRED_WIDTH, Property::INTEGER );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 20 );
- value = resultMap.Find( "desiredHeight", Property::INTEGER );
+ value = resultMap.Find( ImageVisual::Property::DESIRED_HEIGHT, Property::INTEGER );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 30 );
imageVisual = factory.CreateVisual(image);
imageVisual.CreatePropertyMap( resultMap );
- value = resultMap.Find( "rendererType", Property::STRING );
+ value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<std::string>() == "IMAGE" );
+ DALI_TEST_CHECK( value->Get<int>() == Visual::IMAGE );
- value = resultMap.Find( "url", Property::STRING );
+ value = resultMap.Find( ImageVisual::Property::URL, Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == TEST_IMAGE_FILE_NAME );
- value = resultMap.Find( "fittingMode", Property::STRING );
+ value = resultMap.Find( ImageVisual::Property::FITTING_MODE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<std::string>() == "SHRINK_TO_FIT" );
+ DALI_TEST_CHECK( value->Get<int>() == FittingMode::SHRINK_TO_FIT );
- value = resultMap.Find( "samplingMode", Property::STRING );
+ value = resultMap.Find( ImageVisual::Property::SAMPLING_MODE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<std::string>() == "BOX" );
+ DALI_TEST_CHECK( value->Get<int>() == SamplingMode::BOX );
- value = resultMap.Find( "desiredWidth", Property::INTEGER );
+ value = resultMap.Find( ImageVisual::Property::DESIRED_WIDTH, Property::INTEGER );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 100 );
- value = resultMap.Find( "desiredHeight", Property::INTEGER );
+ value = resultMap.Find( ImageVisual::Property::DESIRED_HEIGHT, Property::INTEGER );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 200 );
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "IMAGE" );
- propertyMap.Insert( "url", TEST_NPATCH_FILE_NAME );
- propertyMap.Insert( "borderOnly", true );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME );
+ propertyMap.Insert( ImageVisual::Property::BORDER_ONLY, true );
Visual::Base nPatchVisual = factory.CreateVisual( propertyMap );
Property::Map resultMap;
nPatchVisual.CreatePropertyMap( resultMap );
// check the property values from the returned map from visual
- Property::Value* value = resultMap.Find( "rendererType", Property::STRING );
+ Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<std::string>() == "IMAGE" );
+ DALI_TEST_CHECK( value->Get<int>() == Visual::IMAGE );
- value = resultMap.Find( "url", Property::STRING );
+ value = resultMap.Find( ImageVisual::Property::URL, Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == TEST_NPATCH_FILE_NAME );
- value = resultMap.Find( "borderOnly", Property::BOOLEAN );
+ value = resultMap.Find( ImageVisual::Property::BORDER_ONLY, Property::BOOLEAN );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<bool>() );
// request SvgVisual with a property map
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "IMAGE" );
- propertyMap.Insert( "url", TEST_SVG_FILE_NAME );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( ImageVisual::Property::URL, TEST_SVG_FILE_NAME );
Visual::Base svgVisual = factory.CreateVisual( propertyMap );
Property::Map resultMap;
svgVisual.CreatePropertyMap( resultMap );
// check the property values from the returned map from a visual
- Property::Value* value = resultMap.Find( "rendererType", Property::STRING );
+ Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<std::string>() == "IMAGE" );
+ DALI_TEST_CHECK( value->Get<int>() == Visual::IMAGE );
- value = resultMap.Find( "url", Property::STRING );
+ value = resultMap.Find( ImageVisual::Property::URL, Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == TEST_SVG_FILE_NAME );
resultMap.Clear();
svgVisual2.CreatePropertyMap( resultMap );
// check the property values from the returned map from a visual
- value = resultMap.Find( "rendererType", Property::STRING );
+ value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<std::string>() == "IMAGE" );
+ DALI_TEST_CHECK( value->Get<int>() == Visual::IMAGE );
- value = resultMap.Find( "url", Property::STRING );
+ value = resultMap.Find( ImageVisual::Property::URL, Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == TEST_SVG_FILE_NAME );
//Request MeshVisual using a property map.
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "MESH" );
- propertyMap.Insert( "objectUrl", TEST_OBJ_FILE_NAME );
- propertyMap.Insert( "materialUrl", TEST_MTL_FILE_NAME );
- propertyMap.Insert( "texturesPath", TEST_RESOURCE_LOCATION );
- propertyMap.Insert( "shaderType", "TEXTURELESS" );
- propertyMap.Insert( "lightPosition", Vector3( 5.0f, 10.0f, 15.0f) );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
+ propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_LOCATION );
+ propertyMap.Insert( MeshVisual::Property::SHADING_MODE, MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING );
+ propertyMap.Insert( MeshVisual::Property::LIGHT_POSITION, Vector3( 5.0f, 10.0f, 15.0f) );
Visual::Base meshVisual = factory.CreateVisual( propertyMap );
Property::Map resultMap;
meshVisual.CreatePropertyMap( resultMap );
//Check values in the result map are identical to the initial map's values.
- Property::Value* value = resultMap.Find( "rendererType", Property::STRING );
+ Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( value->Get<std::string>(), "MESH", TEST_LOCATION );
+ DALI_TEST_EQUALS( value->Get<int>(), (int)Visual::MESH, TEST_LOCATION );
- value = resultMap.Find( "objectUrl", Property::STRING );
+ value = resultMap.Find( MeshVisual::Property::OBJECT_URL, Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<std::string>(), TEST_OBJ_FILE_NAME, TEST_LOCATION );
- value = resultMap.Find( "materialUrl", Property::STRING );
+ value = resultMap.Find( MeshVisual::Property::MATERIAL_URL, Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<std::string>(), TEST_MTL_FILE_NAME, TEST_LOCATION );
- value = resultMap.Find( "texturesPath", Property::STRING );
+ value = resultMap.Find( MeshVisual::Property::TEXTURES_PATH, Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<std::string>(), TEST_RESOURCE_LOCATION, TEST_LOCATION );
- value = resultMap.Find( "shaderType", Property::STRING );
+ value = resultMap.Find( MeshVisual::Property::SHADING_MODE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( value->Get<std::string>(), "TEXTURELESS", TEST_LOCATION );
+ DALI_TEST_EQUALS( value->Get<int>(), (int)MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING, TEST_LOCATION );
- value = resultMap.Find( "lightPosition", Property::VECTOR3 );
+ value = resultMap.Find( MeshVisual::Property::LIGHT_POSITION, Property::VECTOR3 );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<Vector3>(), Vector3( 5.0f, 10.0f, 15.0f), Math::MACHINE_EPSILON_100, TEST_LOCATION );
//Request PrimitiveVisual using a property map.
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "PRIMITIVE" );
- propertyMap.Insert( "shape", "CUBE" );
- propertyMap.Insert( "shapeColor", color );
- propertyMap.Insert( "slices", 10 );
- propertyMap.Insert( "stacks", 20 );
- propertyMap.Insert( "scaleTopRadius", 30.0f );
- propertyMap.Insert( "scaleBottomRadius", 40.0f );
- propertyMap.Insert( "scaleHeight", 50.0f );
- propertyMap.Insert( "scaleRadius", 60.0f );
- propertyMap.Insert( "scaleDimensions", dimensions );
- propertyMap.Insert( "bevelPercentage", 0.3f );
- propertyMap.Insert( "bevelSmoothness", 0.6f );
- propertyMap.Insert( "lightPosition", Vector3( 5.0f, 10.0f, 15.0f) );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+ propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::CUBE );
+ propertyMap.Insert( PrimitiveVisual::Property::COLOR, color );
+ propertyMap.Insert( PrimitiveVisual::Property::SLICES, 10 );
+ propertyMap.Insert( PrimitiveVisual::Property::STACKS, 20 );
+ propertyMap.Insert( PrimitiveVisual::Property::SCALE_TOP_RADIUS, 30.0f );
+ propertyMap.Insert( PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS, 40.0f );
+ propertyMap.Insert( PrimitiveVisual::Property::SCALE_HEIGHT, 50.0f );
+ propertyMap.Insert( PrimitiveVisual::Property::SCALE_RADIUS, 60.0f );
+ propertyMap.Insert( PrimitiveVisual::Property::SCALE_DIMENSIONS, dimensions );
+ propertyMap.Insert( PrimitiveVisual::Property::BEVEL_PERCENTAGE, 0.3f );
+ propertyMap.Insert( PrimitiveVisual::Property::BEVEL_SMOOTHNESS, 0.6f );
+ propertyMap.Insert( PrimitiveVisual::Property::LIGHT_POSITION, Vector3( 5.0f, 10.0f, 15.0f) );
Visual::Base primitiveVisual = factory.CreateVisual( propertyMap );
Property::Map resultMap;
primitiveVisual.CreatePropertyMap( resultMap );
//Check values in the result map are identical to the initial map's values.
- Property::Value* value = resultMap.Find( "rendererType", Property::STRING );
+ Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( value->Get<std::string>(), "PRIMITIVE", TEST_LOCATION );
+ DALI_TEST_EQUALS( value->Get<int>(), (int)Visual::PRIMITIVE, TEST_LOCATION );
- value = resultMap.Find( "shape", Property::STRING );
+ value = resultMap.Find( PrimitiveVisual::Property::SHAPE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( value->Get<std::string>(), "CUBE", TEST_LOCATION );
+ DALI_TEST_EQUALS( value->Get<int>(), (int)PrimitiveVisual::Shape::CUBE, TEST_LOCATION );
- value = resultMap.Find( "shapeColor", Property::VECTOR4 );
+ value = resultMap.Find( PrimitiveVisual::Property::COLOR, Property::VECTOR4 );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<Vector4>() == color );
DALI_TEST_EQUALS( value->Get<Vector4>(), color, Math::MACHINE_EPSILON_100, TEST_LOCATION );
- value = resultMap.Find( "slices", Property::INTEGER );
+ value = resultMap.Find( PrimitiveVisual::Property::SLICES, Property::INTEGER );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<int>(), 10, TEST_LOCATION );
- value = resultMap.Find( "stacks", Property::INTEGER );
+ value = resultMap.Find( PrimitiveVisual::Property::STACKS, Property::INTEGER );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<int>(), 20, TEST_LOCATION );
- value = resultMap.Find( "scaleTopRadius", Property::FLOAT );
+ value = resultMap.Find( PrimitiveVisual::Property::SCALE_TOP_RADIUS, Property::FLOAT );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<float>(), 30.0f, Math::MACHINE_EPSILON_100, TEST_LOCATION );
- value = resultMap.Find( "scaleBottomRadius", Property::FLOAT );
+ value = resultMap.Find( PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS, Property::FLOAT );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<float>(), 40.0f, Math::MACHINE_EPSILON_100, TEST_LOCATION );
- value = resultMap.Find( "scaleHeight", Property::FLOAT );
+ value = resultMap.Find( PrimitiveVisual::Property::SCALE_HEIGHT, Property::FLOAT );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<float>(), 50.0f, Math::MACHINE_EPSILON_100, TEST_LOCATION );
- value = resultMap.Find( "scaleRadius", Property::FLOAT );
+ value = resultMap.Find( PrimitiveVisual::Property::SCALE_RADIUS, Property::FLOAT );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<float>(), 60.0f, Math::MACHINE_EPSILON_100, TEST_LOCATION );
- value = resultMap.Find( "scaleDimensions", Property::VECTOR3 );
+ value = resultMap.Find( PrimitiveVisual::Property::SCALE_DIMENSIONS, Property::VECTOR3 );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<Vector3>(), dimensions, Math::MACHINE_EPSILON_100, TEST_LOCATION );
- value = resultMap.Find( "bevelPercentage", Property::FLOAT );
+ value = resultMap.Find( PrimitiveVisual::Property::BEVEL_PERCENTAGE, Property::FLOAT );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<float>(), 0.3f, Math::MACHINE_EPSILON_100, TEST_LOCATION );
- value = resultMap.Find( "bevelSmoothness", Property::FLOAT );
+ value = resultMap.Find( PrimitiveVisual::Property::BEVEL_SMOOTHNESS, Property::FLOAT );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<float>(), 0.6f, Math::MACHINE_EPSILON_100, TEST_LOCATION );
- value = resultMap.Find( "lightPosition", Property::VECTOR3 );
+ value = resultMap.Find( PrimitiveVisual::Property::LIGHT_POSITION, Property::VECTOR3 );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<Vector3>(), Vector3( 5.0f, 10.0f, 15.0f), Math::MACHINE_EPSILON_100, TEST_LOCATION );
#include <dali/public-api/rendering/texture-set.h>
#include <dali/public-api/rendering/shader.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/dali-toolkit.h>
using namespace Dali;
using namespace Dali::Toolkit;
Property::Map propertyMap;
Vector4 testColor( 1.f, 0.5f, 0.3f, 0.2f );
- propertyMap.Insert("rendererType", "COLOR");
- propertyMap.Insert("mixColor", testColor);
+ propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
+ propertyMap.Insert(ColorVisual::Property::MIX_COLOR, testColor);
Visual::Base visual = factory.CreateVisual(propertyMap);
DALI_TEST_CHECK( visual );
Vector4 testColor( 1.f, 0.5f, 0.3f, 0.2f );
Dali::Property::Map map;
- map[ "rendererType" ] = "COLOR";
- map[ "mixColor" ] = testColor;
+ map[ Visual::Property::TYPE ] = Visual::COLOR;
+ map[ ColorVisual::Property::MIX_COLOR ] = testColor;
Visual::Base visual = factory.CreateVisual( map );
DALI_TEST_CHECK( visual );
Property::Map propertyMap;
Vector4 testColor( 1.f, 0.5f, 0.3f, 0.2f );
float testSize = 5.f;
- propertyMap.Insert("rendererType", "BORDER");
- propertyMap.Insert("borderColor", testColor);
- propertyMap.Insert("borderSize", testSize);
+ propertyMap.Insert(Visual::Property::TYPE, Visual::BORDER);
+ propertyMap.Insert(BorderVisual::Property::COLOR, testColor);
+ propertyMap.Insert(BorderVisual::Property::SIZE, testSize);
Visual::Base visual = factory.CreateVisual(propertyMap);
DALI_TEST_CHECK( visual );
float testSize = 5.f;
Dali::Property::Map propertyMap;
- propertyMap[ "rendererType" ] = "BORDER";
- propertyMap[ "borderColor" ] = testColor;
- propertyMap[ "borderSize" ] = testSize;
+ propertyMap[ Visual::Property::TYPE ] = Visual::BORDER;
+ propertyMap[ BorderVisual::Property::COLOR ] = testColor;
+ propertyMap[ BorderVisual::Property::SIZE ] = testSize;
Visual::Base visual = factory.CreateVisual( propertyMap );
DALI_TEST_CHECK( visual );
// enable the anti-aliasing
Dali::Property::Map map;
- map[ "rendererType" ] = "BORDER";
- map[ "borderColor" ] = testColor;
- map[ "borderSize" ] = testSize;
- map[ "antiAliasing" ] = true;
+ map[ Visual::Property::TYPE ] = Visual::BORDER;
+ map[ BorderVisual::Property::COLOR ] = testColor;
+ map[ BorderVisual::Property::SIZE ] = testSize;
+ map[ BorderVisual::Property::ANTI_ALIASING ] = true;
visual = factory.CreateVisual( map );
visual.SetOnStage( actor );
DALI_TEST_CHECK( factory );
Property::Map propertyMap;
- propertyMap.Insert("rendererType", "GRADIENT");
+ propertyMap.Insert(Visual::Property::TYPE, Visual::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");
+ propertyMap.Insert(GradientVisual::Property::START_POSITION, start);
+ propertyMap.Insert(GradientVisual::Property::END_POSITION, end);
+ propertyMap.Insert(GradientVisual::Property::SPREAD_METHOD, GradientVisual::SpreadMethod::REPEAT);
Property::Array stopOffsets;
stopOffsets.PushBack( 0.2f );
stopOffsets.PushBack( 0.8f );
- propertyMap.Insert("stopOffset", stopOffsets);
+ propertyMap.Insert(GradientVisual::Property::STOP_OFFSET, stopOffsets);
Property::Array stopColors;
stopColors.PushBack( Color::RED );
stopColors.PushBack( Color::GREEN );
- propertyMap.Insert("stopColor", stopColors);
+ propertyMap.Insert(GradientVisual::Property::STOP_COLOR, stopColors);
Visual::Base visual = factory.CreateVisual(propertyMap);
DALI_TEST_CHECK( visual );
DALI_TEST_CHECK( factory );
Property::Map propertyMap;
- propertyMap.Insert("rendererType", "GRADIENT");
+ propertyMap.Insert(Visual::Property::TYPE, Visual::GRADIENT);
Vector2 center(100.f, 100.f);
float radius = 100.f;
- propertyMap.Insert("units", "USER_SPACE");
- propertyMap.Insert("center", center);
- propertyMap.Insert("radius", radius);
+ propertyMap.Insert(GradientVisual::Property::UNITS, GradientVisual::Units::USER_SPACE);
+ propertyMap.Insert(GradientVisual::Property::CENTER, center);
+ propertyMap.Insert(GradientVisual::Property::RADIUS, radius);
Property::Array stopOffsets;
stopOffsets.PushBack( 0.0f );
stopOffsets.PushBack( 1.f );
- propertyMap.Insert("stopOffset", stopOffsets);
+ propertyMap.Insert(GradientVisual::Property::STOP_OFFSET, stopOffsets);
Property::Array stopColors;
stopColors.PushBack( Color::RED );
stopColors.PushBack( Color::GREEN );
- propertyMap.Insert("stopColor", stopColors);
+ propertyMap.Insert(GradientVisual::Property::STOP_COLOR, stopColors);
Visual::Base visual = factory.CreateVisual(propertyMap);
DALI_TEST_CHECK( visual );
DALI_TEST_CHECK( factory );
Property::Map propertyMap;
- propertyMap.Insert("rendererType", "GRADIENT");
+ propertyMap.Insert(Visual::Property::TYPE, Visual::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");
+ propertyMap.Insert(GradientVisual::Property::START_POSITION, start);
+ propertyMap.Insert(GradientVisual::Property::END_POSITION, end);
+ propertyMap.Insert(GradientVisual::Property::SPREAD_METHOD, GradientVisual::SpreadMethod::REPEAT);
Property::Array stopColors;
stopColors.PushBack( Color::RED );
stopColors.PushBack( Color::GREEN );
- propertyMap.Insert("stopColor", stopColors);
+ propertyMap.Insert(GradientVisual::Property::STOP_COLOR, stopColors);
Visual::Base visual = factory.CreateVisual(propertyMap);
DALI_TEST_CHECK( visual );
DALI_TEST_CHECK( factory );
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "IMAGE" );
- propertyMap.Insert( "url", TEST_IMAGE_FILE_NAME );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
Visual::Base visual = factory.CreateVisual( propertyMap );
DALI_TEST_CHECK( visual );
Integration::ResourcePointer ninePatchResource = CustomizeNinePatch( application, ninePatchImageWidth, ninePatchImageHeight, stretchRangesX, stretchRangesY );
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "IMAGE" );
- propertyMap.Insert( "url", TEST_NPATCH_FILE_NAME );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME );
{
tet_infoline( "whole grid" );
Visual::Base visual = factory.CreateVisual( propertyMap );
DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
}
- propertyMap.Insert( "borderOnly", true );
+ propertyMap.Insert( ImageVisual::Property::BORDER_ONLY, true );
{
tet_infoline( "border only" );
Visual::Base visual = factory.CreateVisual( propertyMap );
Integration::ResourcePointer ninePatchResource = CustomizeNinePatch( application, ninePatchImageWidth, ninePatchImageHeight, stretchRangesX, stretchRangesY );
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "IMAGE" );
- propertyMap.Insert( "url", TEST_NPATCH_FILE_NAME );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME );
{
Visual::Base visual = factory.CreateVisual( propertyMap );
DALI_TEST_CHECK( visual );
DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
}
- propertyMap.Insert( "borderOnly", true );
+ propertyMap.Insert( ImageVisual::Property::BORDER_ONLY, true );
{
tet_infoline( "border only" );
Visual::Base visual = factory.CreateVisual( propertyMap );
DALI_TEST_CHECK( factory );
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", 111 );
- propertyMap.Insert( "url", "ERROR.9.jpg" );
+ propertyMap.Insert( Visual::Property::TYPE, 111 );
+ propertyMap.Insert( ImageVisual::Property::URL, "ERROR.9.jpg" );
Visual::Base visual = factory.CreateVisual( propertyMap );
DALI_TEST_CHECK( visual );
//Set up visual properties.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "MESH" );
- propertyMap.Insert( "objectUrl", TEST_OBJ_FILE_NAME );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
+ propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
//Test to see if mesh loads correctly.
MeshVisualLoadsCorrectlyTest( propertyMap, application );
//Set up visual properties.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "MESH" );
- propertyMap.Insert( "objectUrl", TEST_OBJ_FILE_NAME );
- propertyMap.Insert( "materialUrl", "" );
- propertyMap.Insert( "texturesPath", "" );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
+ propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, "" );
+ propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, "" );
//Test to see if mesh loads correctly.
MeshVisualLoadsCorrectlyTest( propertyMap, application );
//Set up visual properties.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "MESH" );
- propertyMap.Insert( "objectUrl", TEST_OBJ_FILE_NAME );
- propertyMap.Insert( "materialUrl", TEST_MTL_FILE_NAME );
- propertyMap.Insert( "texturesPath", TEST_RESOURCE_DIR "/" );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
+ propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_DIR "/" );
//Test to see if mesh loads correctly.
MeshVisualLoadsCorrectlyTest( propertyMap, application );
//Set up visual properties.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "MESH" );
- propertyMap.Insert( "objectUrl", TEST_OBJ_FILE_NAME );
- propertyMap.Insert( "materialUrl", TEST_SIMPLE_MTL_FILE_NAME );
- propertyMap.Insert( "texturesPath", TEST_RESOURCE_DIR "/" );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
+ propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_SIMPLE_MTL_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_DIR "/" );
//Test to see if mesh loads correctly.
MeshVisualLoadsCorrectlyTest( propertyMap, application );
//Set up visual properties.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "MESH" );
- propertyMap.Insert( "objectUrl", TEST_OBJ_FILE_NAME );
- propertyMap.Insert( "materialUrl", TEST_MTL_FILE_NAME );
- propertyMap.Insert( "texturesPath", TEST_RESOURCE_DIR "/" );
- propertyMap.Insert( "shaderType", "DIFFUSE_TEXTURE" );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
+ propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_DIR "/" );
+ propertyMap.Insert( MeshVisual::Property::SHADING_MODE, MeshVisual::ShadingMode::TEXTURED_WITH_SPECULAR_LIGHTING );
//Test to see if mesh loads correctly.
MeshVisualLoadsCorrectlyTest( propertyMap, application );
//Set up visual properties.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "MESH" );
- propertyMap.Insert( "objectUrl", TEST_OBJ_FILE_NAME );
- propertyMap.Insert( "materialUrl", TEST_MTL_FILE_NAME );
- propertyMap.Insert( "texturesPath", TEST_RESOURCE_DIR "/" );
- propertyMap.Insert( "shaderType", "TEXTURELESS" );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
+ propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_DIR "/" );
+ propertyMap.Insert( MeshVisual::Property::SHADING_MODE, MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING );
//Test to see if mesh loads correctly.
MeshVisualLoadsCorrectlyTest( propertyMap, application );
//Set up visual properties.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "MESH" );
- propertyMap.Insert( "objectUrl", TEST_OBJ_FILE_NAME );
- propertyMap.Insert( "materialUrl", TEST_MTL_FILE_NAME );
- propertyMap.Insert( "texturesPath", TEST_RESOURCE_DIR "/" );
- propertyMap.Insert( "lightPosition", Vector3( 0.0, 1.0, 2.0 ) );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
+ propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_DIR "/" );
+ propertyMap.Insert( MeshVisual::Property::LIGHT_POSITION, Vector3( 0.0, 1.0, 2.0 ) );
//Test to see if mesh loads correctly.
MeshVisualLoadsCorrectlyTest( propertyMap, application );
//Set up visual properties.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "MESH" );
- propertyMap.Insert( "objectUrl", TEST_SIMPLE_OBJ_FILE_NAME );
- propertyMap.Insert( "materialUrl", TEST_MTL_FILE_NAME );
- propertyMap.Insert( "texturesPath", TEST_RESOURCE_DIR "/" );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
+ propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_SIMPLE_OBJ_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_DIR "/" );
//Test to see if mesh loads correctly.
MeshVisualLoadsCorrectlyTest( propertyMap, application );
//Set up visual properties.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "MESH" );
- propertyMap.Insert( "materialUrl", TEST_MTL_FILE_NAME );
- propertyMap.Insert( "texturesPath", TEST_RESOURCE_DIR "/" );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
+ propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_DIR "/" );
//Test to see if mesh doesn't load with these properties, as expected.
MeshVisualDoesNotLoadCorrectlyTest( propertyMap, application );
//Set up visual properties.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "MESH" );
- propertyMap.Insert( "objectUrl", TEST_OBJ_FILE_NAME );
- propertyMap.Insert( "materialUrl", "invalid" );
- propertyMap.Insert( "texturesPath", "also invalid" );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
+ propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, "invalid" );
+ propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, "also invalid" );
//Test to see if mesh doesn't load with these properties, as expected.
MeshVisualDoesNotLoadCorrectlyTest( propertyMap, application );
//Set up visual properties.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "MESH" );
- propertyMap.Insert( "objectUrl", "invalid" );
- propertyMap.Insert( "materialUrl", TEST_MTL_FILE_NAME );
- propertyMap.Insert( "texturesPath", TEST_RESOURCE_DIR "/" );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
+ propertyMap.Insert( MeshVisual::Property::OBJECT_URL, "invalid" );
+ propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_DIR "/" );
//Test to see if mesh doesn't load with these properties, as expected.
MeshVisualDoesNotLoadCorrectlyTest( propertyMap, application );
//Set up visual properties.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "PRIMITIVE" );
- propertyMap.Insert( "shape", "CUBE" );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+ propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::CUBE );
//Test to see if shape loads correctly.
TestPrimitiveVisualWithProperties( propertyMap, application );
//Set up visual properties.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "PRIMITIVE" );
- propertyMap.Insert( "shape", "CUBE" );
- propertyMap.Insert( "shapeColor", Vector4( 0.5, 0.5, 0.5, 1.0 ) );
- propertyMap.Insert( "slices", 10 );
- propertyMap.Insert( "stacks", 20 );
- propertyMap.Insert( "scaleTopRadius", 30.0f );
- propertyMap.Insert( "scaleBottomRadius", 40.0f );
- propertyMap.Insert( "scaleHeight", 50.0f );
- propertyMap.Insert( "scaleRadius", 60.0f );
- propertyMap.Insert( "bevelPercentage", 0.7f );
- propertyMap.Insert( "bevelSmoothness", 0.8f );
- propertyMap.Insert( "lightPosition", Vector3( 0.9, 1.0, 1.1 ) );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+ propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::CUBE );
+ propertyMap.Insert( PrimitiveVisual::Property::COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
+ propertyMap.Insert( PrimitiveVisual::Property::SLICES, 10 );
+ propertyMap.Insert( PrimitiveVisual::Property::STACKS, 20 );
+ propertyMap.Insert( PrimitiveVisual::Property::SCALE_TOP_RADIUS, 30.0f );
+ propertyMap.Insert( PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS, 40.0f );
+ propertyMap.Insert( PrimitiveVisual::Property::SCALE_HEIGHT, 50.0f );
+ propertyMap.Insert( PrimitiveVisual::Property::SCALE_RADIUS, 60.0f );
+ propertyMap.Insert( PrimitiveVisual::Property::BEVEL_PERCENTAGE, 0.7f );
+ propertyMap.Insert( PrimitiveVisual::Property::BEVEL_SMOOTHNESS, 0.8f );
+ propertyMap.Insert( MeshVisual::Property::LIGHT_POSITION, Vector3( 0.9, 1.0, 1.1 ) );
//Test to see if shape loads correctly.
TestPrimitiveVisualWithProperties( propertyMap, application );
//Set up visual properties.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "PRIMITIVE" );
- propertyMap.Insert( "shape", "SPHERE" );
- propertyMap.Insert( "shapeColor", Vector4( 0.5, 0.5, 0.5, 1.0 ) );
- propertyMap.Insert( "slices", 10 );
- propertyMap.Insert( "stacks", 20 );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+ propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+ propertyMap.Insert( PrimitiveVisual::Property::COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
+ propertyMap.Insert( PrimitiveVisual::Property::SLICES, 10 );
+ propertyMap.Insert( PrimitiveVisual::Property::STACKS, 20 );
//Test to see if shape loads correctly.
TestPrimitiveVisualWithProperties( propertyMap, application );
//Set up visual properties.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "PRIMITIVE" );
- propertyMap.Insert( "shape", "CONICAL_FRUSTRUM" );
- propertyMap.Insert( "shapeColor", Vector4( 0.5, 0.5, 0.5, 1.0 ) );
- propertyMap.Insert( "slices", 10 );
- propertyMap.Insert( "scaleTopRadius", 30.0f );
- propertyMap.Insert( "scaleBottomRadius", 40.0f );
- propertyMap.Insert( "scaleHeight", 50.0f );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+ propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::CONICAL_FRUSTRUM );
+ propertyMap.Insert( PrimitiveVisual::Property::COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
+ propertyMap.Insert( PrimitiveVisual::Property::SLICES, 10 );
+ propertyMap.Insert( PrimitiveVisual::Property::SCALE_TOP_RADIUS, 30.0f );
+ propertyMap.Insert( PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS, 40.0f );
+ propertyMap.Insert( PrimitiveVisual::Property::SCALE_HEIGHT, 50.0f );
//Test to see if shape loads correctly.
TestPrimitiveVisualWithProperties( propertyMap, application );
//Set up visual properties.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "PRIMITIVE" );
- propertyMap.Insert( "shape", "BEVELLED_CUBE" );
- propertyMap.Insert( "shapeColor", Vector4( 0.5, 0.5, 0.5, 1.0 ) );
- propertyMap.Insert( "bevelPercentage", 0.7f );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+ propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::BEVELLED_CUBE );
+ propertyMap.Insert( PrimitiveVisual::Property::COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
+ propertyMap.Insert( PrimitiveVisual::Property::BEVEL_PERCENTAGE, 0.7f );
//Test to see if shape loads correctly.
TestPrimitiveVisualWithProperties( propertyMap, application );
//Set up visual properties.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "PRIMITIVE" );
- propertyMap.Insert( "shape", "OCTAHEDRON" );
- propertyMap.Insert( "shapeColor", Vector4( 0.5, 0.5, 0.5, 1.0 ) );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+ propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::OCTAHEDRON );
+ propertyMap.Insert( PrimitiveVisual::Property::COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
//Test to see if shape loads correctly.
TestPrimitiveVisualWithProperties( propertyMap, application );
//Set up visual properties.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "PRIMITIVE" );
- propertyMap.Insert( "shape", "CONE" );
- propertyMap.Insert( "shapeColor", Vector4( 0.5, 0.5, 0.5, 1.0 ) );
- propertyMap.Insert( "slices", 10 );
- propertyMap.Insert( "scaleTopRadius", 30.0f );
- propertyMap.Insert( "scaleHeight", 50.0f );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+ propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::CONE );
+ propertyMap.Insert( PrimitiveVisual::Property::COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
+ propertyMap.Insert( PrimitiveVisual::Property::SLICES, 10 );
+ propertyMap.Insert( PrimitiveVisual::Property::SCALE_TOP_RADIUS, 30.0f );
+ propertyMap.Insert( PrimitiveVisual::Property::SCALE_HEIGHT, 50.0f );
//Test to see if shape loads correctly.
TestPrimitiveVisualWithProperties( propertyMap, application );
//Set up visual properties.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "PRIMITIVE" );
- propertyMap.Insert( "shape", "SPHERE" );
- propertyMap.Insert( "shapeColor", Vector4( 0.5, 0.5, 0.5, 1.0 ) );
- propertyMap.Insert( "lightPosition", Vector3( 0.0, 1.0, 2.0 ) );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+ propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+ propertyMap.Insert( PrimitiveVisual::Property::COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
+ propertyMap.Insert( MeshVisual::Property::LIGHT_POSITION, Vector3( 0.0, 1.0, 2.0 ) );
//Test to see if shape loads correctly.
TestPrimitiveVisualWithProperties( propertyMap, application );
//Set up visual properties, without supplying shape.
Property::Map propertyMap;
- propertyMap.Insert( "rendererType", "PRIMITIVE" );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
//Test to see if shape loads regardless of missing input.
TestPrimitiveVisualWithProperties( propertyMap, application );
#
-# Copyright (c) 2014 Samsung Electronics Co., Ltd.
+# Copyright (c) 2016 Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
develapivisualfactorydir = $(develapidir)/visual-factory
# devel headers
+develapi_HEADERS = $(devel_api_header_files)
develapicontrols_HEADERS = $(devel_api_controls_header_files)
develapibloomview_HEADERS = $(devel_api_bloom_view_header_files)
develapibubbleemitter_HEADERS = $(devel_api_bubble_emitter_header_files)
publicapifocusmanagerdir = $(publicapidir)/focus-manager
publicapirenderingbackenddir = $(publicapidir)/text
publicapisliderdir = $(publicapicontrolsdir)/slider
+publicapivisualsdir = $(publicapidir)/visuals
# public api headers
publicapi_HEADERS = $(public_api_header_files)
publicapifocusmanager_HEADERS = $(public_api_focus_manager_header_files)
publicapirenderingbackend_HEADERS = $(public_api_rendering_backend_header_files)
publicapislider_HEADERS = $(public_api_slider_header_files)
+publicapivisuals_HEADERS = $(public_api_visuals_header_files)
# package doxygen file (contains doxygen grouping information)
packagedoxydir = $(topleveldir)/doc
#define __DALI_TOOLKIT_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/dali.h>
-// Toolkit
#include <dali-toolkit/public-api/controls/alignment/alignment.h>
#include <dali-toolkit/public-api/controls/buttons/button.h>
#include <dali-toolkit/public-api/controls/buttons/check-box-button.h>
#include <dali-toolkit/public-api/controls/text-controls/text-field.h>
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
#include <dali-toolkit/public-api/controls/video-view/video-view.h>
+
#include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
+
#include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
+
#include <dali-toolkit/public-api/styling/style-manager.h>
+
#include <dali-toolkit/public-api/text/rendering-backend.h>
+
+#include <dali-toolkit/public-api/visuals/border-visual-properties.h>
+#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
+#include <dali-toolkit/public-api/visuals/gradient-visual-properties.h>
+#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
+#include <dali-toolkit/public-api/visuals/mesh-visual-properties.h>
+#include <dali-toolkit/public-api/visuals/primitive-visual-properties.h>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+
#include <dali-toolkit/public-api/dali-toolkit-version.h>
#include <dali-toolkit/public-api/enums.h>
+#include <dali-toolkit/public-api/toolkit-property-index-ranges.h>
#endif // __DALI_TOOLKIT_H__
#define __DALI_TOOLKIT_ALPHA_DISCARD_EFFECT_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/public-api/object/property-map.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
namespace Dali
{
Property::Map map;
Property::Map customShader;
- customShader[ "fragmentShader" ] = ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE;
+ customShader[ Visual::Shader::Property::FRAGMENT_SHADER ] = ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE;
- map[ "shader" ] = customShader;
- return map;}
+ map[ Visual::Property::SHADER ] = customShader;
+ return map;
+}
} // namespace Toolkit
#include <string.h>
#include <dali/public-api/rendering/shader.h>
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+
namespace Dali
{
vertexShaderString.append( vertexShader );
fragmentShaderString.append( fragmentShader );
- customShader[ "vertexShader" ] = vertexShaderString;
- customShader[ "fragmentShader" ] = fragmentShaderString;
+ customShader[ Visual::Shader::Property::VERTEX_SHADER ] = vertexShaderString;
+ customShader[ Visual::Shader::Property::FRAGMENT_SHADER ] = fragmentShaderString;
- customShader[ "subdivideGridX" ] = 20;
- customShader[ "subdivideGridY" ] = 20;
+ customShader[ Visual::Shader::Property::SUBDIVIDE_GRID_X ] = 20;
+ customShader[ Visual::Shader::Property::SUBDIVIDE_GRID_Y ] = 20;
- customShader[ "hints" ] = "outputIsTransparent";
+ customShader[ Visual::Shader::Property::HINTS ] = Shader::Hint::OUTPUT_IS_TRANSPARENT;
- map[ "shader" ] = customShader;
+ map[ Visual::Property::SHADER ] = customShader;
return map;
}
#define __DALI_TOOLKIT_SHADER_EFFECT_DISTANCEFIELD_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <string.h>
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/public-api/object/property-map.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
namespace Dali
{
fragmentShaderString.append( fragmentShaderPrefix );
fragmentShaderString.append( fragmentShader );
- customShader[ "fragmentShader" ] = fragmentShaderString;
- customShader[ "hints" ] = "outputIsTransparent";
+ customShader[ Visual::Shader::Property::FRAGMENT_SHADER ] = fragmentShaderString;
+ customShader[ Visual::Shader::Property::HINTS ] = Shader::Hint::OUTPUT_IS_TRANSPARENT;
- map[ "shader" ] = customShader;
+ map[ Visual::Property::SHADER ] = customShader;
return map;
}
#define __DALI_TOOLKIT_IMAGE_REGION_EFFECT_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <dali/public-api/object/property-map.h>
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+
namespace Dali
{
Property::Map map;
Property::Map customShader;
- customShader[ "vertexShader" ] = vertexShader;
+ customShader[ Visual::Shader::Property::VERTEX_SHADER ] = vertexShader;
- map[ "shader" ] = customShader;
+ map[ Visual::Property::SHADER ] = customShader;
return map;
}
#define __DALI_TOOLKIT_SHADER_EFFECT_MOTION_BLUR_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/animation/constraint.h>
+#include <dali/public-api/object/property-map.h>
+#include <dali/public-api/rendering/shader.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
namespace Dali
{
Property::Map map;
Property::Map customShader;
- customShader[ "vertexShader" ] = vertexSource;
- customShader[ "fragmentShader" ] = fragmentSource;
+ customShader[ Visual::Shader::Property::VERTEX_SHADER ] = vertexSource;
+ customShader[ Visual::Shader::Property::FRAGMENT_SHADER ] = fragmentSource;
- customShader[ "subdivideGridX" ] = 10;
- customShader[ "subdivideGridY" ] = 10;
+ customShader[ Visual::Shader::Property::SUBDIVIDE_GRID_X ] = 10;
+ customShader[ Visual::Shader::Property::SUBDIVIDE_GRID_Y ] = 10;
- // NOTE: we must turn on alpha blending for the actor (HINT_BLENDING)
- customShader[ "hints" ] = "outputIsTransparent";
+ customShader[ Visual::Shader::Property::HINTS ] = Shader::Hint::OUTPUT_IS_TRANSPARENT;
- map[ "shader" ] = customShader;
+ map[ Visual::Property::SHADER ] = customShader;
return map;
}
#define __DALI_TOOLKIT_SHADER_EFFECT_MOTION_STRETCH_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/animation/constraint.h>
+#include <dali/public-api/object/property-map.h>
+#include <dali/public-api/rendering/shader.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
namespace Dali
{
Property::Map map;
Property::Map customShader;
- customShader[ "vertexShader" ] = vertexSource;
- customShader[ "fragmentShader" ] = fragmentSource;
+ customShader[ Visual::Shader::Property::VERTEX_SHADER ] = vertexSource;
+ customShader[ Visual::Shader::Property::FRAGMENT_SHADER ] = fragmentSource;
- customShader[ "subdivideGridX" ] = 10;
- customShader[ "subdivideGridY" ] = 10;
+ customShader[ Visual::Shader::Property::SUBDIVIDE_GRID_X ] = 10;
+ customShader[ Visual::Shader::Property::SUBDIVIDE_GRID_Y ] = 10;
- // NOTE: we must turn on alpha blending for the actor (HINT_BLENDING)
- customShader[ "hints" ] = "outputIsTransparent";
+ customShader[ Visual::Shader::Property::HINTS ] = Shader::Hint::OUTPUT_IS_TRANSPARENT;
- map[ "shader" ] = customShader;
+ map[ Visual::Property::SHADER ] = customShader;
return map;
}
#ifndef DALI_TOOLKIT_VISUAL_BASE_H
#define DALI_TOOLKIT_VISUAL_BASE_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Visual
{
/**
- * @brief Visual provides renderer for rendering the controls. A control may have multiple ControlRenders.
+ * @brief Visual provides a renderer for rendering the controls. A control may have multiple visuals.
*
* Visuals reuses geometry, shader etc. across controls and manages the renderer and texture sets to exist only when control is on-stage.
* It also responds to actor size and color change, and provides the clipping at the renderer level.
- * Note: The control renderer responds to the the Actor::COLOR by blending it with the 'Multiply' operator.
+ * Note: The visual responds to the the Actor::COLOR by blending it with the 'Multiply' operator.
*/
class DALI_IMPORT_API Base : public BaseHandle
{
/**
* @brief Get the size of the painting area.
*
- * @return The size of the renderer's painting area.
+ * @return The size of the visual's painting area.
*/
const Vector2& GetSize() const;
/**
- * @brief Return the natural size of the renderer.
+ * @brief Return the natural size of the visual.
*
- * Deriving classes stipulate the natural size and by default a renderer has a ZERO natural size.
+ * Deriving classes stipulate the natural size and by default a visual has a ZERO natural size.
*
- * @param[out] naturalSize The renderer's natural size
+ * @param[out] naturalSize The visual's natural size
*/
void GetNaturalSize( Vector2& naturalSize ) const;
* @brief Set the depth index of this visual.
*
* Depth-index controls draw-order for overlapping visuals.
- * Renderer with higher depth indices are rendered in front of other renderer with smaller values
+ * Visuals with higher depth indices are rendered in front of other visual with smaller values
*
* @param[in] index The depth index of this visual.
*/
void SetDepthIndex( float index );
/**
- * @brief Get the depth index of this renderer
+ * @brief Get the depth index of this visual
*
- * @return The depth index of this renderer.
+ * @return The depth index of this visual.
*/
float GetDepthIndex() const;
/**
- * @brief Renderer only exists when control is on stage.
+ * @brief Visual needs to know when when the control is put on to the stage to add the renderer.
*
- * This function should be called when the control put on stage.
+ * This function should be called when the control is put on to the stage.
*
- * @param[in] actor The actor applying this renderer.
+ * @param[in] actor The actor using this visual.
* @post SetOffStage should be called with the same actor when the control is put off stage otherwise memory will be leaked
*/
void SetOnStage( Actor& actor );
/**
- * @brief Renderer is destroyed when control is off stage.
+ * @brief Visual needs to know when when the control is removed from the stage to remove the renderer.
*
- * This function should be called when the control removes from stage
+ * This function should be called when the control is removed from the stage
*
- * @param[in] actor The actor applying this renderer.
+ * @param[in] actor The actor using this visual.
*/
void SetOffStage( Actor& actor );
/**
- * @brief Remove the renderer from actor and reset the control renderer self.
+ * @brief Remove the renderer from the actor and reset the visual self.
*
- * This function can be called with an empty handle. If the control renderer is empty, do nothing.
+ * This function can be called with an empty handle. If the visual is empty, this is a no-op.
*
* @param[in] actor The actor to be set off stage.
*/
void RemoveAndReset( Actor& actor );
/**
- * @brief Create the property map representing this renderer.
+ * @brief Create the property map representing this visual.
*
- * @param[out] map The renderer property map.
+ * @param[out] map The visual property map.
*/
- void CreatePropertyMap( Property::Map& map ) const;
+ void CreatePropertyMap( Dali::Property::Map& map ) const;
public: // Not intended for application developers
-#ifndef __DALI_TOOLKIT_RENDERER_FACTORY_H__
-#define __DALI_TOOLKIT_RENDERER_FACTORY_H__
+#ifndef DALI_TOOLKIT_VISUAL_FACTORY_H
+#define DALI_TOOLKIT_VISUAL_FACTORY_H
+
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* The visual type is required in the property map for requesting a visual.
*
- * | %Property Name | Type |
- * |--------------------------|------------------|
- * | rendererType | STRING |
+ * | %Property Name | Type |
+ * |--------------------------|-------------------|
+ * | visualType | INTEGER or STRING |
+ * | shader | MAP |
*/
class DALI_IMPORT_API VisualFactory : public BaseHandle
{
/**
* @brief Request the visual
*
- * @param[in] propertyMap The map contains the properties required by the control renderer
- * Depends on the content of the map, different kind of renderer would be returned.
- * @return The pointer pointing to visual
+ * @param[in] propertyMap The map contains the properties required by the visual.
+ * The content of the map determines the type of visual that will be returned.
+ * @return The handle to the created visual
*/
Visual::Base CreateVisual( const Property::Map& propertyMap );
* @tparam ParameterType0 The type of first argument passed to the CreateVisual()
* @tparam ParameterType1 The type of second argument passed to the CreateVisual()
* @SINCE_1_0.39
- * @param[in] actor Actor for which the renderer will be replaced
+ * @param[in] actor Actor for which the visual will be replaced
* @param[in,out] visual The visual to be replaced
- * @param[in] param0 First template based argument passed to the renderer factory
- * @param[in] param1 Second template based argument passed to the renderer factory
+ * @param[in] param0 First template based argument passed to the visual factory
+ * @param[in] param1 Second template based argument passed to the visual factory
*/
template< class ParameterType0, class ParameterType1 >
void InitializeVisual( Actor& actor, Visual::Base& visual, ParameterType0& param0, ParameterType1& param1 )
*
* @tparam ParameterType The type of argument passed to the CreateVisual()
* @SINCE_1_0.39
- * @param[in] actor Actor for which the renderer will be replaced
+ * @param[in] actor Actor for which the visual will be replaced
* @param[in,out] visual The visual to be replaced
- * @param[in] param Template based argument passed to the renderer factory
+ * @param[in] param Template based argument passed to the visual factory
*/
template< class ParameterType >
void InitializeVisual( Actor& actor, Visual::Base& visual, ParameterType& param )
} // namespace Dali
-
-#endif /* __DALI_TOOLKIT_RENDERER_FACTORY_H__ */
+#endif // DALI_TOOLKIT_VISUAL_FACTORY_H
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/devel-api/controls/bloom-view/bloom-view.h>
-#include "../gaussian-blur-view/gaussian-blur-view-impl.h"
+#include <dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.h>
namespace Dali
{
mBloomExtractImageView.SetSize(mDownsampledWidth, mDownsampledHeight); // size needs to match render target
// Create shader used for extracting the bright parts of an image
Property::Map customShader;
- customShader[ "fragmentShader" ] = BLOOM_EXTRACT_FRAGMENT_SOURCE;
- Property::Map rendererMap;
- rendererMap.Insert( "shader", customShader );
- mBloomExtractImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, rendererMap );
+ customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = BLOOM_EXTRACT_FRAGMENT_SOURCE;
+ Property::Map visualMap;
+ visualMap.Insert( Toolkit::Visual::Property::SHADER, customShader );
+ mBloomExtractImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
// set GaussianBlurView to blur our extracted bloom
mGaussianBlurView.SetUserImageAndOutputRenderTarget(mBloomExtractTarget, mBlurExtractTarget);
// use the completed blur in the first buffer and composite with the original child actors render
mCompositeImageView.SetImage( mRenderTargetForRenderingChildren );
// Create shader used to composite bloom and original image to output render target
- customShader[ "fragmentShader" ] = COMPOSITE_FRAGMENT_SOURCE;
- rendererMap[ "shader" ] = customShader;
- mCompositeImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, rendererMap );
+ customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = COMPOSITE_FRAGMENT_SOURCE;
+ visualMap[ Toolkit::Visual::Property::SHADER ] = customShader;
+ mCompositeImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
TextureSet textureSet = mCompositeImageView.GetRendererAt(0).GetTextures();
TextureSetImage( textureSet, 1u, mBlurExtractTarget );
-#ifndef __DALI_TOOLKIT_INTERNAL_COLOR_ADJUSTER_H_
-#define __DALI_TOOLKIT_INTERNAL_COLOR_ADJUSTER_H_
+#ifndef DALI_TOOLKIT_INTERNAL_COLOR_ADJUSTER_H
+#define DALI_TOOLKIT_INTERNAL_COLOR_ADJUSTER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*
*/
+
+// EXTERNAL INCLUDES
#include <dali/public-api/math/vector3.h>
#include <dali/public-api/object/property-map.h>
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+
#define DALI_COMPOSE_SHADER(STR) #STR
namespace Dali
);
Property::Map customShader;
- customShader[ "fragmentShader" ] = fragmentShader;
+ customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = fragmentShader;
Property::Map map;
- map[ "shader" ] = customShader;
+ map[ Toolkit::Visual::Property::SHADER ] = customShader;
return map;
}
} // namespace Dali
-#endif /* __DALI_TOOLKIT_INTERNAL_COLOR_ADJUSTER_H_ */
+#endif // DALI_TOOLKIT_INTERNAL_COLOR_ADJUSTER_H
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
+#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+
/**
* Button states and contents
* (3) mSelectedContent
Toolkit::Visual::Base colorRenderer;
Property::Map map;
- map["rendererType"] = "COLOR";
- map["mixColor"] = color;
+ map[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::COLOR;
+ map[ Toolkit::ColorVisual::Property::MIX_COLOR ] = color;
colorRenderer = rendererFactory.CreateVisual( map );
colorRenderer.SetOnStage( placementActor );
#include <dali/devel-api/images/texture-set-image.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/internal/filters/blur-two-pass-filter.h>
RemoveFilters();
Actor self = Self();
- Property::Map rendererMap;
- rendererMap.Insert( "rendererType", "IMAGE" );
+ Property::Map visualMap;
+ visualMap.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE );
switch( type )
{
}
Property::Map customShader;
- customShader[ "vertexShader" ] = EFFECTS_VIEW_VERTEX_SOURCE;
- customShader[ "fragmentShader" ] = EFFECTS_VIEW_FRAGMENT_SOURCE;
- rendererMap[ "shader" ] = customShader;
- InitializeVisual( self, mVisualPostFilter, rendererMap );
+ customShader[ Toolkit::Visual::Shader::Property::VERTEX_SHADER ] = EFFECTS_VIEW_VERTEX_SOURCE;
+ customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = EFFECTS_VIEW_FRAGMENT_SOURCE;
+ visualMap[ Toolkit::Visual::Property::SHADER ] = customShader;
+ InitializeVisual( self, mVisualPostFilter, visualMap );
mEffectType = type;
}
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
// TODO:
// pixel format / size - set from JSON
horizFragmentShaderStringStream << "#define NUM_SAMPLES " << mNumSamples << "\n";
horizFragmentShaderStringStream << GAUSSIAN_BLUR_FRAGMENT_SOURCE;
Property::Map source;
- source[ "fragmentShader" ] = horizFragmentShaderStringStream.str();
- mCustomShader["shader"] = source;
+ source[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = horizFragmentShaderStringStream.str();
+ mCustomShader[ Toolkit::Visual::Property::SHADER ] = source;
//////////////////////////////////////////////////////
// Create actors
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+// Copyright (c) 2016 Samsung Electronics Co., Ltd.
// CLASS HEADER
#include "image-view-impl.h"
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
// if its not a string then get a Property::Map from the property if possible.
else if( value.Get( map ) )
{
- Property::Value* shaderValue = map.Find( "shader" );
+ Property::Value* shaderValue = map.Find( Toolkit::Visual::Property::SHADER, CUSTOM_SHADER );
// set image only if property map contains image information other than custom shader
if( map.Count() > 1u || !shaderValue )
{
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/object/property-map.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/border-visual-properties.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
-#include <dali-toolkit/internal/visuals/visual-string-constants.h>
namespace Dali
{
Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get();
Property::Map map;
- map[ RENDERER_TYPE ] = BORDER_RENDERER;
- map[ "borderColor" ] = Color::WHITE;
- map[ "borderSize" ] = IMAGE_BORDER_INDENT;
+ map[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::BORDER;
+ map[ Toolkit::BorderVisual::Property::COLOR ] = Color::WHITE;
+ map[ Toolkit::BorderVisual::Property::SIZE ] = IMAGE_BORDER_INDENT;
Toolkit::Visual::Base borderVisual = visualFactory.CreateVisual( map );
borderVisual.SetOnStage( mFrame );
-#ifndef __DALI_PAGE_TURN_BOOK_SPINE_EFFECT_H__
-#define __DALI_PAGE_TURN_BOOK_SPINE_EFFECT_H__
+#ifndef DALI_PAGE_TURN_BOOK_SPINE_EFFECT_H
+#define DALI_PAGE_TURN_BOOK_SPINE_EFFECT_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+
#define DALI_COMPOSE_SHADER(STR) #STR
namespace Dali
Property::Map customShader;
- customShader[ "vertexShader" ] = vertexSource;
- customShader[ "fragmentShader" ] = fragmentSource;
+ customShader[ Toolkit::Visual::Shader::Property::VERTEX_SHADER ] = vertexSource;
+ customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = fragmentSource;
- map[ "shader" ] = customShader;
+ map[ Toolkit::Visual::Property::SHADER ] = customShader;
return map;
}
} // namespace Dali
-#endif /* __DALI_PAGE_TURN_BOOK_SPINE_EFFECT_H__ */
+#endif // DALI_PAGE_TURN_BOOK_SPINE_EFFECT_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-//EXTERNAL INCLUDES
+// EXTERNAL INCLUDES
#include <string.h>
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/object/property-map.h>
-//INTERNAL INCLUDES
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/internal/controls/page-turn-view/page-turn-effect.h>
using namespace Dali;
Property::Map customShader;
- customShader[ "vertexShader" ] = vertexShader;
- customShader[ "fragmentShader" ] = fragmentShader;
- customShader[ "subdivideGridX" ] = 20;
- customShader[ "subdivideGridY" ] = 20;
+ customShader[ Toolkit::Visual::Shader::Property::VERTEX_SHADER ] = vertexShader;
+ customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = fragmentShader;
+ customShader[ Toolkit::Visual::Shader::Property::SUBDIVIDE_GRID_X ] = 20;
+ customShader[ Toolkit::Visual::Shader::Property::SUBDIVIDE_GRID_Y ] = 20;
- map[ "shader" ] = customShader;
+ map[ Toolkit::Visual::Property::SHADER ] = customShader;
return map;
}
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/internal/controls/page-turn-view/page-turn-effect.h>
#include <dali-toolkit/internal/controls/page-turn-view/page-turn-book-spine-effect.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
+#include <dali-toolkit/internal/visuals/visual-string-constants.h>
using namespace Dali;
// broken image is loaded if there is no valid image provided for the page
const char * const BROKEN_IMAGE_URL( DALI_IMAGE_DIR "broken.png");
-// names of shader property map
-const char * const CUSTOM_SHADER( "shader" );
-const char * const CUSTOM_VERTEX_SHADER( "vertexShader" );
-const char * const CUSTOM_FRAGMENT_SHADER( "fragmentShader" );
-
// properties set on shader, these properties have the constant value in regardless of the page status
const char * const PROPERTY_SPINE_SHADOW ( "uSpineShadowParameter" ); // uniform for both spine and turn effect
Shader PageTurnView::CreateShader( const Property::Map& shaderMap )
{
Shader shader;
- Property::Value* shaderValue = shaderMap.Find( CUSTOM_SHADER );
+ Property::Value* shaderValue = shaderMap.Find( Toolkit::Visual::Property::SHADER, CUSTOM_SHADER );
Property::Map shaderSource;
if( shaderValue && shaderValue->Get( shaderSource ) )
{
std::string vertexShader;
- Property::Value* vertexShaderValue = shaderSource.Find( CUSTOM_VERTEX_SHADER );
+ Property::Value* vertexShaderValue = shaderSource.Find( Toolkit::Visual::Shader::Property::VERTEX_SHADER, CUSTOM_VERTEX_SHADER );
if( !vertexShaderValue || !vertexShaderValue->Get( vertexShader ) )
{
DALI_LOG_ERROR("PageTurnView::CreateShader failed: vertex shader source is not available.\n");
}
std::string fragmentShader;
- Property::Value* fragmentShaderValue = shaderSource.Find( CUSTOM_FRAGMENT_SHADER );
+ Property::Value* fragmentShaderValue = shaderSource.Find( Toolkit::Visual::Shader::Property::FRAGMENT_SHADER, CUSTOM_FRAGMENT_SHADER );
if( !fragmentShaderValue || !fragmentShaderValue->Get( fragmentShader ) )
{
DALI_LOG_ERROR("PageTurnView::CreateShader failed: fragment shader source is not available.\n");
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/render-tasks/render-task-list.h>
+#include <dali/public-api/rendering/shader.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/internal/controls/shadow-view/shadow-view-impl.h>
#include <dali-toolkit/internal/filters/blur-two-pass-filter.h>
mShadowPlane.SetParentOrigin(ParentOrigin::CENTER);
mShadowPlane.SetAnchorPoint(AnchorPoint::CENTER);
- mShadowPlane.SetProperty( Toolkit::ImageView::Property::IMAGE, mShadowRenderShader );
+ mShadowPlane.SetProperty( Toolkit::ImageView::Property::IMAGE, mShadowVisualMap );
SetShaderConstants();
// Rather than parent the shadow plane drawable and have constraints to move it to the same
Property::Map customShader;
- customShader[ "vertexShader" ] = RENDER_SHADOW_VERTEX_SOURCE;
- customShader[ "fragmentShader" ] = RENDER_SHADOW_FRAGMENT_SOURCE;
+ customShader[ Toolkit::Visual::Shader::Property::VERTEX_SHADER ] = RENDER_SHADOW_VERTEX_SOURCE;
+ customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = RENDER_SHADOW_FRAGMENT_SOURCE;
- customShader[ "subdivideGridX" ] = 20;
- customShader[ "subdivideGridY" ] = 20;
+ customShader[ Toolkit::Visual::Shader::Property::SUBDIVIDE_GRID_X ] = 20;
+ customShader[ Toolkit::Visual::Shader::Property::SUBDIVIDE_GRID_Y ] = 20;
- customShader[ "hints" ] = "outputIsTransparent";
+ customShader[ Toolkit::Visual::Shader::Property::HINTS ] = Shader::Hint::OUTPUT_IS_TRANSPARENT;
- mShadowRenderShader[ "shader" ] = customShader;
+ mShadowVisualMap[ Toolkit::Visual::Property::SHADER ] = customShader;
// Create render targets needed for rendering from light's point of view
mSceneFromLightRenderTarget = FrameBufferImage::New( stageSize.width, stageSize.height, Pixel::RGBA8888 );
#define __DALI_TOOLKIT_INTERNAL_SHADOW_VIEW_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
CameraActor mCameraActor; // Constrained to same position as mPointLight and pointing at mShadowPlane
- Property::Map mShadowRenderShader;
+ Property::Map mShadowVisualMap;
BlurTwoPassFilter mBlurFilter;
Vector4 mCachedShadowColor; ///< Cached Shadow color.
#include <dali/public-api/rendering/renderer.h>
#include <dali/devel-api/images/texture-set-image.h>
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+
namespace Dali
{
fragmentSource << BLUR_TWO_PASS_FRAGMENT_SOURCE;
Property::Map customShader;
- customShader[ "fragmentShader" ] = fragmentSource.str();
- Property::Map rendererMap;
- rendererMap.Insert( "shader", customShader );
- mActorForInput.SetProperty( Toolkit::ImageView::Property::IMAGE, rendererMap );
- mActorForHorz.SetProperty( Toolkit::ImageView::Property::IMAGE, rendererMap );
+ customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = fragmentSource.str();
+ Property::Map visualMap;
+ visualMap.Insert( Toolkit::Visual::Property::SHADER, customShader );
+ mActorForInput.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
+ mActorForHorz.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
// Set up blend-two-image custom shader
- customShader[ "fragmentShader" ] = BLEND_TWO_IMAGES_FRAGMENT_SOURCE;
- rendererMap[ "shader"] = customShader;
- mActorForBlending.SetProperty( Toolkit::ImageView::Property::IMAGE, rendererMap );
+ customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = BLEND_TWO_IMAGES_FRAGMENT_SOURCE;
+ visualMap[ Toolkit::Visual::Property::SHADER ] = customShader;
+ mActorForBlending.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
mRootActor.Add( mActorForInput );
mRootActor.Add( mActorForHorz );
#include <dali/devel-api/images/texture-set-image.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
namespace Dali
mImageForEmboss2 = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Image::UNUSED );
Property::Map customShader;
- customShader[ "fragmentShader" ] = EMBOSS_FRAGMENT_SOURCE;
- Property::Map rendererMap;
- rendererMap.Insert( "shader", customShader );
+ customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = EMBOSS_FRAGMENT_SOURCE;
+ Property::Map visualMap;
+ visualMap.Insert( Toolkit::Visual::Property::SHADER, customShader );
// create actor to render input with applied emboss effect
mActorForInput1 = Toolkit::ImageView::New(mInputImage);
mActorForInput1.RegisterProperty( TEX_SCALE_UNIFORM_NAME, textureScale );
mActorForInput1.RegisterProperty( COEFFICIENT_UNIFORM_NAME, Vector3( 2.f, -1.f, -1.f ) );
// set EMBOSS custom shader
- mActorForInput1.SetProperty( Toolkit::ImageView::Property::IMAGE, rendererMap );
+ mActorForInput1.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
mRootActor.Add( mActorForInput1 );
mActorForInput2 = Toolkit::ImageView::New(mInputImage);
mActorForInput2.RegisterProperty( TEX_SCALE_UNIFORM_NAME, textureScale );
mActorForInput2.RegisterProperty( COEFFICIENT_UNIFORM_NAME, Vector3( -1.f, -1.f, 2.f ) );
// set EMBOSS custom shader
- mActorForInput2.SetProperty( Toolkit::ImageView::Property::IMAGE, rendererMap );
+ mActorForInput2.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
mRootActor.Add( mActorForInput2 );
mActorForComposite = Actor::New();
mActorForComposite.SetSize(mTargetSize);
mActorForComposite.SetColor( Color::BLACK );
- customShader[ "fragmentShader" ] = COMPOSITE_FRAGMENT_SOURCE;
- rendererMap[ "shader"] = customShader;
- rendererMap[ "rendererType"] = "IMAGE";
+ customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = COMPOSITE_FRAGMENT_SOURCE;
+ visualMap[ Toolkit::Visual::Property::SHADER ] = customShader;
+ visualMap[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::IMAGE;
mRootActor.Add( mActorForComposite );
- InitializeVisual( mActorForComposite, mVisualForEmboss1, rendererMap );
- InitializeVisual( mActorForComposite, mVisualForEmboss2, rendererMap );
+ InitializeVisual( mActorForComposite, mVisualForEmboss1, visualMap );
+ InitializeVisual( mActorForComposite, mVisualForEmboss2, visualMap );
TextureSet textureSet1 = TextureSet::New();
TextureSetImage( textureSet1, 0, mImageForEmboss1 );
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/render-tasks/render-task-list.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
namespace Dali
{
mActorForHorz.RegisterProperty( TEX_SCALE_UNIFORM_NAME, Vector2( 0.0f, 1.0f / mTargetSize.height ) );
Property::Map customShader;
- customShader[ "fragmentShader" ] = SPREAD_FRAGMENT_SOURCE;
- Property::Map rendererMap;
- rendererMap.Insert( "shader", customShader );
+ customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = SPREAD_FRAGMENT_SOURCE;
+ Property::Map visualMap;
+ visualMap.Insert( Toolkit::Visual::Property::SHADER, customShader );
// set SPREAD custom shader
- mActorForInput.SetProperty( Toolkit::ImageView::Property::IMAGE, rendererMap );
- mActorForHorz.SetProperty( Toolkit::ImageView::Property::IMAGE, rendererMap );
+ mActorForInput.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
+ mActorForHorz.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
mRootActor.Add( mActorForInput );
mRootActor.Add( mActorForHorz );
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <dali/integration-api/debug.h>
-//INTERNAL INCLUDES
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/border-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
void BorderVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
{
- Property::Value* color = propertyMap.Find( COLOR_NAME );
+ Property::Value* color = propertyMap.Find( Toolkit::BorderVisual::Property::COLOR, COLOR_NAME );
if( !( color && color->Get(mBorderColor) ) )
{
DALI_LOG_ERROR( "Fail to provide a border color to the BorderVisual object" );
}
- Property::Value* size = propertyMap.Find( SIZE_NAME );
+ Property::Value* size = propertyMap.Find( Toolkit::BorderVisual::Property::SIZE, SIZE_NAME );
if( !( size && size->Get(mBorderSize) ) )
{
DALI_LOG_ERROR( "Fail to provide a border size to the BorderVisual object" );
}
- Property::Value* antiAliasing = propertyMap.Find( ANTI_ALIASING );
+ Property::Value* antiAliasing = propertyMap.Find( Toolkit::BorderVisual::Property::ANTI_ALIASING, ANTI_ALIASING );
if( antiAliasing )
{
antiAliasing->Get( mAntiAliasing );
void BorderVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( RENDERER_TYPE, BORDER_RENDERER );
- map.Insert( COLOR_NAME, mBorderColor );
- map.Insert( SIZE_NAME, mBorderSize );
+ map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::BORDER );
+ map.Insert( Toolkit::BorderVisual::Property::COLOR, mBorderColor );
+ map.Insert( Toolkit::BorderVisual::Property::SIZE, mBorderSize );
+ map.Insert( Toolkit::BorderVisual::Property::ANTI_ALIASING, mAntiAliasing );
}
void BorderVisual::InitializeRenderer()
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/integration-api/debug.h>
//INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
void ColorVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
{
- Property::Value* color = propertyMap.Find( COLOR_NAME );
+ Property::Value* color = propertyMap.Find( Toolkit::ColorVisual::Property::MIX_COLOR, COLOR_NAME );
if( !( color && color->Get(mMixColor) ) )
{
DALI_LOG_ERROR( "Fail to provide a color to the ColorVisual object" );
void ColorVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( RENDERER_TYPE, COLOR_RENDERER );
- map.Insert( COLOR_NAME, mMixColor );
+ map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR );
+ map.Insert( Toolkit::ColorVisual::Property::MIX_COLOR, mMixColor );
}
void ColorVisual::InitializeRenderer()
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// CLASS HEADER
#include "debug-visual.h"
-//INTERNAL INCLUDES
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
void DebugVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( RENDERER_TYPE, DEBUG_RENDERER );
+ map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::DEBUG );
}
void DebugVisual::InitializeRenderer()
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/images/buffer-image.h>
#include <dali/public-api/object/property-array.h>
+#include <dali/devel-api/scripting/enum-helper.h>
+#include <dali/devel-api/scripting/scripting.h>
-//INTERNAL INCLUDES
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/gradient-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
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("USER_SPACE");
-const char * const UNIT_BOUNDING_BOX("OBJECT_BOUNDING_BOX");
-const char * const SPREAD_PAD("PAD");
-const char * const SPREAD_REFLECT("REFLECT");
-const char * const SPREAD_REPEAT("REPEAT");
+DALI_ENUM_TO_STRING_TABLE_BEGIN( UNITS )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::GradientVisual::Units, OBJECT_BOUNDING_BOX )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::GradientVisual::Units, USER_SPACE )
+DALI_ENUM_TO_STRING_TABLE_END( UNITS )
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN( SPREAD_METHOD )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::GradientVisual::SpreadMethod, PAD )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::GradientVisual::SpreadMethod, REFLECT )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::GradientVisual::SpreadMethod, REPEAT )
+DALI_ENUM_TO_STRING_TABLE_END( SPREAD_METHOD )
// uniform names
const char * const UNIFORM_ALIGNMENT_MATRIX_NAME( "uAlignmentMatrix" );
const unsigned int DEFAULT_OFFSET_MINIMUM = 0.0f;
const unsigned int DEFAULT_OFFSET_MAXIMUM = 1.0f;
-VisualFactoryCache::ShaderType GetShaderType( GradientVisual::Type type, Gradient::GradientUnits units)
+VisualFactoryCache::ShaderType GetShaderType( GradientVisual::Type type, Toolkit::GradientVisual::Units::Type units )
{
- if( type==GradientVisual::LINEAR )
+ if( type == GradientVisual::LINEAR )
{
- if( units == Gradient::USER_SPACE_ON_USE )
+ if( units == Toolkit::GradientVisual::Units::USER_SPACE )
{
return VisualFactoryCache::GRADIENT_SHADER_LINEAR_USER_SPACE;
}
return VisualFactoryCache::GRADIENT_SHADER_LINEAR_BOUNDING_BOX;
}
- else if( units == Gradient::USER_SPACE_ON_USE )
+ else if( units == Toolkit::GradientVisual::Units::USER_SPACE )
{
return VisualFactoryCache::GRADIENT_SHADER_RADIAL_USER_SPACE;
}
const char* VERTEX_SHADER[] =
{
-// vertex shader for gradient units as USER_SPACE_ON_USE
-DALI_COMPOSE_SHADER(
+// vertex shader for gradient units as OBJECT_BOUNDING_BOX
+ DALI_COMPOSE_SHADER(
attribute mediump vec2 aPosition;\n
uniform mediump mat4 uMvpMatrix;\n
uniform mediump vec3 uSize;\n
void main()\n
{\n
mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n
+ vTexCoord = (uAlignmentMatrix*vertexPosition.xyw).xy;\n
+ \n
vertexPosition.xyz *= uSize;\n
gl_Position = uMvpMatrix * vertexPosition;\n
- \n
- vTexCoord = (uAlignmentMatrix*vertexPosition.xyw).xy;\n
}\n
),
-// vertex shader for gradient units as OBJECT_BOUNDING_BOX
- DALI_COMPOSE_SHADER(
+// vertex shader for gradient units as USER_SPACE
+DALI_COMPOSE_SHADER(
attribute mediump vec2 aPosition;\n
uniform mediump mat4 uMvpMatrix;\n
uniform mediump vec3 uSize;\n
void main()\n
{\n
mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n
- vTexCoord = (uAlignmentMatrix*vertexPosition.xyw).xy;\n
- \n
vertexPosition.xyz *= uSize;\n
gl_Position = uMvpMatrix * vertexPosition;\n
+ \n
+ vTexCoord = (uAlignmentMatrix*vertexPosition.xyw).xy;\n
}\n
)
};
)
};
-Dali::WrapMode::Type GetWrapMode( Gradient::SpreadMethod spread )
+Dali::WrapMode::Type GetWrapMode( Toolkit::GradientVisual::SpreadMethod::Type spread )
{
switch(spread)
{
- case Gradient::REPEAT:
+ case Toolkit::GradientVisual::SpreadMethod::REPEAT:
{
return Dali::WrapMode::REPEAT;
}
- case Gradient::REFLECT:
+ case Toolkit::GradientVisual::SpreadMethod::REFLECT:
{
return Dali::WrapMode::MIRRORED_REPEAT;
}
- case Gradient::PAD:
+ case Toolkit::GradientVisual::SpreadMethod::PAD:
default:
{
return Dali::WrapMode::CLAMP_TO_EDGE;
}
}
-}
+} // unnamed namespace
GradientVisual::GradientVisual( VisualFactoryCache& factoryCache )
void GradientVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
{
- Gradient::GradientUnits gradientUnits = Gradient::OBJECT_BOUNDING_BOX;
- 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'
- if( unitsValue && unitsValue->Get( units ) && units == UNIT_USER_SPACE )
+ Toolkit::GradientVisual::Units::Type gradientUnits = Toolkit::GradientVisual::Units::OBJECT_BOUNDING_BOX;
+
+ Property::Value* unitsValue = propertyMap.Find( Toolkit::GradientVisual::Property::UNITS, UNITS_NAME );
+ if( unitsValue )
{
- gradientUnits = Gradient::USER_SPACE_ON_USE;
+ Scripting::GetEnumerationProperty( *unitsValue, UNITS_TABLE, UNITS_TABLE_COUNT, gradientUnits );
}
mGradientType = LINEAR;
- if( propertyMap.Find( RADIUS_NAME ))
+ if( propertyMap.Find( Toolkit::GradientVisual::Property::RADIUS, RADIUS_NAME ) )
{
mGradientType = RADIAL;
}
void GradientVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( RENDERER_TYPE, GRADIENT_RENDERER );
-
- Gradient::GradientUnits units = mGradient->GetGradientUnits();
- if( units == Gradient::USER_SPACE_ON_USE )
- {
- map.Insert( UNITS_NAME, UNIT_USER_SPACE );
- }
- else // if( units == Gradient::OBJECT_BOUNDING_BOX )
- {
- map.Insert( UNITS_NAME, UNIT_BOUNDING_BOX );
- }
-
- Gradient::SpreadMethod spread = mGradient->GetSpreadMethod();
- if( spread == Gradient::PAD )
- {
- map.Insert( SPREAD_METHOD_NAME, SPREAD_PAD );
- }
- else if( spread == Gradient::REFLECT )
- {
- map.Insert( SPREAD_METHOD_NAME, SPREAD_REFLECT );
- }
- else // if( units == Gradient::REPEAT )
- {
- map.Insert( SPREAD_METHOD_NAME, SPREAD_REPEAT );
- }
+ map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::GRADIENT );
+ map.Insert( Toolkit::GradientVisual::Property::UNITS, mGradient->GetGradientUnits() );
+ map.Insert( Toolkit::GradientVisual::Property::SPREAD_METHOD, mGradient->GetSpreadMethod() );
const Vector<Gradient::GradientStop>& stops( mGradient->GetStops() );
Property::Array offsets;
}
}
- map.Insert( STOP_OFFSET_NAME, offsets );
- map.Insert( STOP_COLOR_NAME, colors );
+ map.Insert( Toolkit::GradientVisual::Property::STOP_OFFSET, offsets );
+ map.Insert( Toolkit::GradientVisual::Property::STOP_COLOR, colors );
if( &typeid( *mGradient ) == &typeid(LinearGradient) )
{
LinearGradient* gradient = static_cast<LinearGradient*>( mGradient.Get() );
- map.Insert( START_POSITION_NAME, gradient->GetStartPosition() );
- map.Insert( END_POSITION_NAME, gradient->GetEndPosition() );
+ map.Insert( Toolkit::GradientVisual::Property::START_POSITION, gradient->GetStartPosition() );
+ map.Insert( Toolkit::GradientVisual::Property::END_POSITION, gradient->GetEndPosition() );
}
else // if( &typeid( *mGradient ) == &typeid(RadialGradient) )
{
RadialGradient* gradient = static_cast<RadialGradient*>( mGradient.Get() );
- map.Insert( CENTER_NAME, gradient->GetCenter() );
- map.Insert( RADIUS_NAME, gradient->GetRadius() );
+ map.Insert( Toolkit::GradientVisual::Property::CENTER, gradient->GetCenter() );
+ map.Insert( Toolkit::GradientVisual::Property::RADIUS, gradient->GetRadius() );
}
}
mFactoryCache.SaveGeometry( VisualFactoryCache::QUAD_GEOMETRY, geometry );
}
- Gradient::GradientUnits gradientUnits = mGradient->GetGradientUnits();
+ Toolkit::GradientVisual::Units::Type gradientUnits = mGradient->GetGradientUnits();
VisualFactoryCache::ShaderType shaderType = GetShaderType( mGradientType, gradientUnits );
Shader shader = mFactoryCache.GetShader( shaderType );
if( !shader )
bool GradientVisual::NewGradient(Type gradientType, const Property::Map& propertyMap)
{
- if( gradientType==LINEAR )
+ if( gradientType == LINEAR )
{
- Property::Value* startPositionValue = propertyMap.Find( START_POSITION_NAME );
- Property::Value* endPositionValue = propertyMap.Find( END_POSITION_NAME );
+ Property::Value* startPositionValue = propertyMap.Find( Toolkit::GradientVisual::Property::START_POSITION, START_POSITION_NAME );
+ Property::Value* endPositionValue = propertyMap.Find( Toolkit::GradientVisual::Property::END_POSITION, END_POSITION_NAME );
Vector2 startPosition;
Vector2 endPosition;
}
else // type==RADIAL
{
- Property::Value* centerValue = propertyMap.Find( CENTER_NAME );
- Property::Value* radiusValue = propertyMap.Find( RADIUS_NAME );
+ Property::Value* centerValue = propertyMap.Find( Toolkit::GradientVisual::Property::CENTER, CENTER_NAME );
+ Property::Value* radiusValue = propertyMap.Find( Toolkit::GradientVisual::Property::RADIUS, RADIUS_NAME );
Vector2 center;
float radius;
if( centerValue && centerValue->Get(center)
}
unsigned int numValidStop = 0u;
- Property::Value* stopOffsetValue = propertyMap.Find( STOP_OFFSET_NAME );
- Property::Value* stopColorValue = propertyMap.Find( STOP_COLOR_NAME );
+ Property::Value* stopOffsetValue = propertyMap.Find( Toolkit::GradientVisual::Property::STOP_OFFSET, STOP_OFFSET_NAME );
+ Property::Value* stopColorValue = propertyMap.Find( Toolkit::GradientVisual::Property::STOP_COLOR, STOP_COLOR_NAME );
if( stopColorValue )
{
Vector<float> offsetArray;
return false;
}
- 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"
- if( spread && spread->Get( stringValue ))
+ Property::Value* spread = propertyMap.Find( Toolkit::GradientVisual::Property::SPREAD_METHOD, SPREAD_METHOD_NAME );
+ // The default spread method is PAD. Only need to set new spread if it's anything else.
+ if( spread )
{
- if( stringValue == SPREAD_REFLECT )
- {
- mGradient->SetSpreadMethod( Gradient::REFLECT );
- }
- else if( stringValue == SPREAD_REPEAT )
+ Toolkit::GradientVisual::SpreadMethod::Type spreadMethod = Toolkit::GradientVisual::SpreadMethod::PAD;
+ if( Scripting::GetEnumerationProperty( *spread, SPREAD_METHOD_TABLE, SPREAD_METHOD_TABLE_COUNT, spreadMethod ) );
{
- mGradient->SetSpreadMethod( Gradient::REPEAT );
+ mGradient->SetSpreadMethod( spreadMethod );
}
}
{
Gradient::Gradient()
-: mGradientUnits( OBJECT_BOUNDING_BOX ),
- mSpreadMethod( PAD )
+: mGradientUnits( Toolkit::GradientVisual::Units::OBJECT_BOUNDING_BOX ),
+ mSpreadMethod( Toolkit::GradientVisual::SpreadMethod::PAD )
{}
Gradient::~Gradient()
return mGradientStops;
}
-void Gradient::SetGradientUnits( GradientUnits gradientUnits )
+void Gradient::SetGradientUnits( Toolkit::GradientVisual::Units::Type gradientUnits )
{
mGradientUnits = gradientUnits;
}
-Gradient::GradientUnits Gradient::GetGradientUnits() const
+Toolkit::GradientVisual::Units::Type Gradient::GetGradientUnits() const
{
return mGradientUnits;
}
-void Gradient::SetSpreadMethod( SpreadMethod spread )
+void Gradient::SetSpreadMethod( Toolkit::GradientVisual::SpreadMethod::Type spread )
{
mSpreadMethod = spread;
}
-Gradient::SpreadMethod Gradient::GetSpreadMethod() const
+Toolkit::GradientVisual::SpreadMethod::Type Gradient::GetSpreadMethod() const
{
return mSpreadMethod;
}
{
tempFirstStop = true;
Vector4 firstStopColor( mGradientStops[0].mStopColor ); // If spread method is PAD or REFLECT
- if( mSpreadMethod == REPEAT )
+ if( mSpreadMethod == Toolkit::GradientVisual::SpreadMethod::REPEAT )
{
firstStopColor = ( mGradientStops[0].mStopColor * (1.f-mGradientStops[numStops-1].mOffset)
+ mGradientStops[numStops-1].mStopColor * mGradientStops[0].mOffset )
{
tempLastStop = true;
Vector4 lastStopColor( mGradientStops[numStops-1].mStopColor ); // If spread method is PAD or REFLECT
- if( mSpreadMethod == REPEAT )
+ if( mSpreadMethod == Toolkit::GradientVisual::SpreadMethod::REPEAT )
{
lastStopColor = mGradientStops[0].mStopColor;
}
*
*/
-//EXTERNAL INCLUDES
+// EXTERNAL INCLUDES
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/images/buffer-image.h>
#include <dali/public-api/math/matrix3.h>
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/rendering/texture.h>
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/gradient-visual-properties.h>
+
namespace Dali
{
class Gradient : public RefObject
{
public:
- /**
- * Defines the coordinate system of the attributes
- * (start and end position for linear gradient, circle center and radius for radial gradient)
- */
- enum GradientUnits
- {
- USER_SPACE_ON_USE,
- OBJECT_BOUNDING_BOX
- };
-
- /**
- * Indicates what happens if the gradient starts or ends inside the bounds of the object being painted by the gradient.
- */
- enum SpreadMethod
- {
- PAD, // use the terminal colors of the gradient to fill the remainder of the target region
- REPEAT, // reflect the gradient pattern start-to-end, end-to-start, start-to-end, etc. continuously until the target rectangle is filled
- REFLECT // repeat the gradient pattern start-to-end, start-to-end, start-to-end, etc. continuously until the target region is filled
- };
/**
* The stop node tells the gradient what color it should be at certain position.
* Set the coordinate system used by the gradient attributes.
* @param[in] gradientUnits The the attributes are defined using the current user coordinate system or the bounding box of the shape.
*/
- void SetGradientUnits( GradientUnits gradientUnits );
+ void SetGradientUnits( Toolkit::GradientVisual::Units::Type gradientUnits );
/**
* Get the coordinate system used by the gradient attributes.
* @return USER_SPACE_ON_USE or OBJECT_BOUNDING_BOX
*/
- GradientUnits GetGradientUnits() const;
+ Toolkit::GradientVisual::Units::Type GetGradientUnits() const;
/**
* Indicates what happens if the gradient starts or ends inside the bounds of the target rectangle.
*
* @param[in] spread The method to fill the remainder of target region which is outside the gradient bounds
*/
- void SetSpreadMethod( SpreadMethod spread );
+ void SetSpreadMethod( Toolkit::GradientVisual::SpreadMethod::Type spread );
/**
* Get the filling method for the the remainder of target region which is outside the gradient boun.
* @return PAD, REFLECT or REPEAT
*/
- SpreadMethod GetSpreadMethod() const;
+ Toolkit::GradientVisual::SpreadMethod::Type GetSpreadMethod() const;
/**
* Get the transformation matrix to align the vertices with the gradient line/circle
protected:
- Vector<GradientStop> mGradientStops;
- Matrix3 mAlignmentTransform;
- GradientUnits mGradientUnits;
- SpreadMethod mSpreadMethod;
+ Vector<GradientStop> mGradientStops;
+ Matrix3 mAlignmentTransform;
+ Toolkit::GradientVisual::Units::Type mGradientUnits;
+ Toolkit::GradientVisual::SpreadMethod::Type mSpreadMethod;
};
#include <dali/devel-api/images/atlas.h>
#include <dali/devel-api/images/texture-set-image.h>
#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
+#include <dali/devel-api/scripting/enum-helper.h>
+#include <dali/devel-api/scripting/scripting.h>
#include <dali/integration-api/debug.h>
// INTERNAL HEADER
+#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
const char * const SYNCHRONOUS_LOADING( "synchronousLoading" );
// fitting modes
-const char * const SHRINK_TO_FIT("SHRINK_TO_FIT");
-const char * const SCALE_TO_FILL("SCALE_TO_FILL");
-const char * const FIT_WIDTH("FIT_WIDTH");
-const char * const FIT_HEIGHT("FIT_HEIGHT");
-const char * const DEFAULT("DEFAULT");
+DALI_ENUM_TO_STRING_TABLE_BEGIN( FITTING_MODE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::FittingMode, SHRINK_TO_FIT )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::FittingMode, SCALE_TO_FILL )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::FittingMode, FIT_WIDTH )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::FittingMode, FIT_HEIGHT )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::FittingMode, DEFAULT )
+DALI_ENUM_TO_STRING_TABLE_END( FITTING_MODE )
// sampling modes
-const char * const BOX("BOX");
-const char * const NEAREST("NEAREST");
-const char * const LINEAR("LINEAR");
-const char * const BOX_THEN_NEAREST("BOX_THEN_NEAREST");
-const char * const BOX_THEN_LINEAR("BOX_THEN_LINEAR");
-const char * const NO_FILTER("NO_FILTER");
-const char * const DONT_CARE("DONT_CARE");
+DALI_ENUM_TO_STRING_TABLE_BEGIN( SAMPLING_MODE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::SamplingMode, BOX )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::SamplingMode, NEAREST )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::SamplingMode, LINEAR )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::SamplingMode, BOX_THEN_NEAREST )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::SamplingMode, BOX_THEN_LINEAR )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::SamplingMode, NO_FILTER )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::SamplingMode, DONT_CARE )
+DALI_ENUM_TO_STRING_TABLE_END( SAMPLING_MODE )
const std::string PIXEL_AREA_UNIFORM_NAME = "pixelArea";
{
std::string oldImageUrl = mImageUrl;
- Property::Value* imageURLValue = propertyMap.Find( IMAGE_URL_NAME );
+ Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME );
if( imageURLValue )
{
imageURLValue->Get( mImageUrl );
mImage.Reset();
}
- Property::Value* fittingValue = propertyMap.Find( IMAGE_FITTING_MODE );
+ Property::Value* fittingValue = propertyMap.Find( Toolkit::ImageVisual::Property::FITTING_MODE, IMAGE_FITTING_MODE );
if( fittingValue )
{
- std::string fitting;
- fittingValue->Get( fitting );
-
- mFittingMode = FittingMode::DEFAULT;
- if( fitting == SHRINK_TO_FIT )
- {
- mFittingMode = FittingMode::SHRINK_TO_FIT;
- }
- else if( fitting == SCALE_TO_FILL )
- {
- mFittingMode = FittingMode::SCALE_TO_FILL;
- }
- else if( fitting == FIT_WIDTH )
- {
- mFittingMode = FittingMode::FIT_WIDTH;
- }
- else if( fitting == FIT_HEIGHT )
- {
- mFittingMode = FittingMode::FIT_HEIGHT;
- }
- else if( fitting == DEFAULT )
- {
- mFittingMode = FittingMode::DEFAULT;
- }
- else
- {
- DALI_ASSERT_ALWAYS("Unknown fitting mode");
- }
+ Scripting::GetEnumerationProperty( *fittingValue, FITTING_MODE_TABLE, FITTING_MODE_TABLE_COUNT, mFittingMode );
}
- Property::Value* samplingValue = propertyMap.Find( IMAGE_SAMPLING_MODE );
+ Property::Value* samplingValue = propertyMap.Find( Toolkit::ImageVisual::Property::SAMPLING_MODE, IMAGE_SAMPLING_MODE );
if( samplingValue )
{
- std::string sampling;
- samplingValue->Get( sampling );
-
- mSamplingMode = SamplingMode::DEFAULT;
- if( sampling == BOX )
- {
- mSamplingMode = SamplingMode::BOX;
- }
- else if( sampling == NEAREST )
- {
- mSamplingMode = SamplingMode::NEAREST;
- }
- else if( sampling == LINEAR )
- {
- mSamplingMode = SamplingMode::LINEAR;
- }
- else if( sampling == BOX_THEN_NEAREST )
- {
- mSamplingMode = SamplingMode::BOX_THEN_NEAREST;
- }
- else if( sampling == BOX_THEN_LINEAR )
- {
- mSamplingMode = SamplingMode::BOX_THEN_LINEAR;
- }
- else if( sampling == NO_FILTER )
- {
- mSamplingMode = SamplingMode::NO_FILTER;
- }
- else if( sampling == DONT_CARE )
- {
- mSamplingMode = SamplingMode::DONT_CARE;
- }
- else if( sampling == DEFAULT )
- {
- mSamplingMode = SamplingMode::DEFAULT;
- }
- else
- {
- DALI_ASSERT_ALWAYS("Unknown sampling mode");
- }
+ Scripting::GetEnumerationProperty( *samplingValue, SAMPLING_MODE_TABLE, SAMPLING_MODE_TABLE_COUNT, mSamplingMode );
}
int desiredWidth = 0;
- Property::Value* desiredWidthValue = propertyMap.Find( IMAGE_DESIRED_WIDTH );
+ Property::Value* desiredWidthValue = propertyMap.Find( Toolkit::ImageVisual::Property::DESIRED_WIDTH, IMAGE_DESIRED_WIDTH );
if( desiredWidthValue )
{
desiredWidthValue->Get( desiredWidth );
}
int desiredHeight = 0;
- Property::Value* desiredHeightValue = propertyMap.Find( IMAGE_DESIRED_HEIGHT );
+ Property::Value* desiredHeightValue = propertyMap.Find( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, IMAGE_DESIRED_HEIGHT );
if( desiredHeightValue )
{
desiredHeightValue->Get( desiredHeight );
}
mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
-
}
- Property::Value* syncLoading = propertyMap.Find( SYNCHRONOUS_LOADING );
+ Property::Value* syncLoading = propertyMap.Find( Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING, SYNCHRONOUS_LOADING );
if( syncLoading )
{
bool sync;
if( !mPixels )
{
// use broken image
- return VisualFactory::GetBrokenRendererImage();
+ return VisualFactory::GetBrokenVisualImage();
}
Atlas image = Atlas::New( mPixels.GetWidth(), mPixels.GetHeight(), mPixels.GetPixelFormat() );
image.Upload( mPixels, 0, 0 );
{
// use broken image
textureSet = TextureSet::New();
- TextureSetImage( textureSet, 0u, VisualFactory::GetBrokenRendererImage() );
+ TextureSetImage( textureSet, 0u, VisualFactory::GetBrokenVisualImage() );
}
else
{
void ImageVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( RENDERER_TYPE, IMAGE_RENDERER );
+ map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE );
bool sync = IsSynchronousResourceLoading();
map.Insert( SYNCHRONOUS_LOADING, sync );
if( !mImageUrl.empty() )
{
- map.Insert( IMAGE_URL_NAME, mImageUrl );
- map.Insert( IMAGE_DESIRED_WIDTH, mDesiredSize.GetWidth() );
- map.Insert( IMAGE_DESIRED_HEIGHT, mDesiredSize.GetHeight() );
+ map.Insert( Toolkit::ImageVisual::Property::URL, mImageUrl );
+ map.Insert( Toolkit::ImageVisual::Property::DESIRED_WIDTH, mDesiredSize.GetWidth() );
+ map.Insert( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, mDesiredSize.GetHeight() );
}
else if( mImage )
{
- map.Insert( IMAGE_DESIRED_WIDTH, static_cast<int>(mImage.GetWidth()) );
- map.Insert( IMAGE_DESIRED_HEIGHT, static_cast<int>(mImage.GetHeight()) );
+ map.Insert( Toolkit::ImageVisual::Property::DESIRED_WIDTH, static_cast<int>(mImage.GetWidth()) );
+ map.Insert( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, static_cast<int>(mImage.GetHeight()) );
ResourceImage resourceImage = ResourceImage::DownCast(mImage);
if( resourceImage )
{
- map.Insert( IMAGE_URL_NAME, resourceImage.GetUrl() );
- }
- }
-
- switch( mFittingMode )
- {
- case Dali::FittingMode::FIT_HEIGHT:
- {
- map.Insert( IMAGE_FITTING_MODE, FIT_HEIGHT );
- break;
- }
- case Dali::FittingMode::FIT_WIDTH:
- {
- map.Insert( IMAGE_FITTING_MODE, FIT_WIDTH );
- break;
- }
- case Dali::FittingMode::SCALE_TO_FILL:
- {
- map.Insert( IMAGE_FITTING_MODE, SCALE_TO_FILL );
- break;
- }
- case Dali::FittingMode::SHRINK_TO_FIT:
- {
- map.Insert( IMAGE_FITTING_MODE, SHRINK_TO_FIT );
- break;
- }
- default:
- {
- map.Insert( IMAGE_FITTING_MODE, DEFAULT );
- break;
+ map.Insert( Toolkit::ImageVisual::Property::URL, resourceImage.GetUrl() );
}
}
- switch( mSamplingMode )
- {
- case Dali::SamplingMode::BOX:
- {
- map.Insert( IMAGE_SAMPLING_MODE, BOX );
- break;
- }
- case Dali::SamplingMode::NEAREST:
- {
- map.Insert( IMAGE_SAMPLING_MODE, NEAREST );
- break;
- }
- case Dali::SamplingMode::LINEAR:
- {
- map.Insert( IMAGE_SAMPLING_MODE, LINEAR );
- break;
- }
- case Dali::SamplingMode::BOX_THEN_LINEAR:
- {
- map.Insert( IMAGE_SAMPLING_MODE, BOX_THEN_LINEAR );
- break;
- }
- case Dali::SamplingMode::BOX_THEN_NEAREST:
- {
- map.Insert( IMAGE_SAMPLING_MODE, BOX_THEN_NEAREST );
- break;
- }
- case Dali::SamplingMode::NO_FILTER:
- {
- map.Insert( IMAGE_SAMPLING_MODE, NO_FILTER );
- break;
- }
- case Dali::SamplingMode::DONT_CARE:
- {
- map.Insert( IMAGE_SAMPLING_MODE, DONT_CARE );
- break;
- }
- default:
- {
- map.Insert( IMAGE_SAMPLING_MODE, DEFAULT );
- break;
- }
- }
+ map.Insert( Toolkit::ImageVisual::Property::FITTING_MODE, mFittingMode );
+ map.Insert( Toolkit::ImageVisual::Property::SAMPLING_MODE, mSamplingMode );
}
Shader ImageVisual::GetImageShader( VisualFactoryCache& factoryCache )
{
if( image.GetLoadingState() == Dali::ResourceLoadingFailed )
{
- Image brokenImage = VisualFactory::GetBrokenRendererImage();
+ Image brokenImage = VisualFactory::GetBrokenVisualImage();
if( mImpl->mRenderer )
{
ApplyImageToSampler( brokenImage );
#include <dali/public-api/common/stage.h>
#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
#include <dali/devel-api/adaptor-framework/file-loader.h>
+#include <dali/devel-api/scripting/enum-helper.h>
+#include <dali/devel-api/scripting/scripting.h>
#include <fstream>
//INTERNAL INCLUDES
-#include <dali-toolkit/internal/visuals/visual-string-constants.h>
#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
namespace Dali
GLOSS_INDEX = 2u
};
+//Property names
+const char * const OBJECT_URL_NAME( "objectUrl" );
+const char * const MATERIAL_URL_NAME( "materialUrl" );
+const char * const TEXTURES_PATH_NAME( "texturesPath" );
+const char * const SHADING_MODE_NAME( "shadingMode" );
+const char * const USE_MIPMAPPING_NAME( "useMipmapping" );
+const char * const USE_SOFT_NORMALS_NAME( "useSoftNormals" );
+const char * const LIGHT_POSITION_NAME( "lightPosition" );
+
+//Shading mode
+DALI_ENUM_TO_STRING_TABLE_BEGIN( SHADING_MODE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::MeshVisual::ShadingMode, TEXTURELESS_WITH_DIFFUSE_LIGHTING )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::MeshVisual::ShadingMode, TEXTURED_WITH_SPECULAR_LIGHTING )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::MeshVisual::ShadingMode, TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING )
+DALI_ENUM_TO_STRING_TABLE_END( SHADING_MODE )
+
//Shader properties
const char * const OBJECT_MATRIX_UNIFORM_NAME( "uObjectMatrix" );
const char * const STAGE_OFFSET_UNIFORM_NAME( "uStageOffset" );
-const char * const SHADER_TYPE_TEXTURELESS( "TEXTURELESS" );
-const char * const SHADER_TYPE_DIFFUSE_TEXTURE( "DIFFUSE_TEXTURE" );
-const char * const SHADER_TYPE_ALL_TEXTURES( "ALL_TEXTURES" );
-
//Shaders
//If a shader requires certain textures, they must be listed in order,
//as detailed in the TextureIndex enum documentation.
MeshVisual::MeshVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
- mShaderType( ALL_TEXTURES ),
+ mShadingMode( Toolkit::MeshVisual::ShadingMode::TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING ),
mUseTexture( true ),
mUseMipmapping( true ),
mUseSoftNormals( true )
void MeshVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
{
- Property::Value* objectUrl = propertyMap.Find( OBJECT_URL );
+ Property::Value* objectUrl = propertyMap.Find( Toolkit::MeshVisual::Property::OBJECT_URL, OBJECT_URL_NAME );
if( !objectUrl || !objectUrl->Get( mObjectUrl ) )
{
DALI_LOG_ERROR( "Fail to provide object URL to the MeshVisual object.\n" );
}
- Property::Value* materialUrl = propertyMap.Find( MATERIAL_URL );
+ Property::Value* materialUrl = propertyMap.Find( Toolkit::MeshVisual::Property::MATERIAL_URL, MATERIAL_URL_NAME );
if( !materialUrl || !materialUrl->Get( mMaterialUrl ) || mMaterialUrl.empty() )
{
mUseTexture = false;
}
- Property::Value* imagesUrl = propertyMap.Find( TEXTURES_PATH );
+ Property::Value* imagesUrl = propertyMap.Find( Toolkit::MeshVisual::Property::TEXTURES_PATH, TEXTURES_PATH_NAME );
if( !imagesUrl || !imagesUrl->Get( mTexturesPath ) )
{
//Default behaviour is to assume files are in the same directory,
mTexturesPath.clear();
}
- Property::Value* shaderType = propertyMap.Find( SHADER_TYPE );
- if( shaderType )
+ Property::Value* shadingMode = propertyMap.Find( Toolkit::MeshVisual::Property::SHADING_MODE, SHADING_MODE_NAME );
+ if( shadingMode )
{
- std::string shaderTypeString;
- if( shaderType->Get( shaderTypeString ) )
- {
- if( shaderTypeString == SHADER_TYPE_TEXTURELESS )
- {
- mShaderType = TEXTURELESS;
- }
- else if( shaderTypeString == SHADER_TYPE_DIFFUSE_TEXTURE )
- {
- mShaderType = DIFFUSE_TEXTURE;
- }
- else if( shaderTypeString == SHADER_TYPE_ALL_TEXTURES )
- {
- mShaderType = ALL_TEXTURES;
- }
- else
- {
- DALI_LOG_ERROR( "Unknown shader type provided to the MeshVisual object.\n");
- }
- }
+ Scripting::GetEnumerationProperty( *shadingMode, SHADING_MODE_TABLE, SHADING_MODE_TABLE_COUNT, mShadingMode );
}
- Property::Value* useMipmapping = propertyMap.Find( USE_MIPMAPPING );
+ Property::Value* useMipmapping = propertyMap.Find( Toolkit::MeshVisual::Property::USE_MIPMAPPING, USE_MIPMAPPING_NAME );
if( useMipmapping )
{
useMipmapping->Get( mUseMipmapping );
}
- Property::Value* useSoftNormals = propertyMap.Find( USE_SOFT_NORMALS );
+ Property::Value* useSoftNormals = propertyMap.Find( Toolkit::MeshVisual::Property::USE_SOFT_NORMALS, USE_SOFT_NORMALS_NAME );
if( useSoftNormals )
{
useSoftNormals->Get( mUseSoftNormals );
}
- Property::Value* lightPosition = propertyMap.Find( LIGHT_POSITION_UNIFORM_NAME );
+ Property::Value* lightPosition = propertyMap.Find( Toolkit::MeshVisual::Property::LIGHT_POSITION, LIGHT_POSITION_NAME );
if( lightPosition )
{
if( !lightPosition->Get( mLightPosition ) )
void MeshVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( RENDERER_TYPE, MESH_RENDERER );
- map.Insert( OBJECT_URL, mObjectUrl );
- map.Insert( MATERIAL_URL, mMaterialUrl );
- map.Insert( TEXTURES_PATH, mTexturesPath );
-
- std::string shaderTypeString;
- switch( mShaderType )
- {
- case ALL_TEXTURES:
- {
- shaderTypeString = SHADER_TYPE_ALL_TEXTURES;
- break;
- }
-
- case DIFFUSE_TEXTURE:
- {
- shaderTypeString = SHADER_TYPE_DIFFUSE_TEXTURE;
- break;
- }
-
- case TEXTURELESS:
- {
- shaderTypeString = SHADER_TYPE_TEXTURELESS;
- break;
- }
- }
- map.Insert( SHADER_TYPE, shaderTypeString );
-
- map.Insert( USE_MIPMAPPING, mUseMipmapping );
- map.Insert( USE_SOFT_NORMALS, mUseSoftNormals );
- map.Insert( LIGHT_POSITION_UNIFORM_NAME, mLightPosition );
+ map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::MESH );
+ map.Insert( Toolkit::MeshVisual::Property::OBJECT_URL, mObjectUrl );
+ map.Insert( Toolkit::MeshVisual::Property::MATERIAL_URL, mMaterialUrl );
+ map.Insert( Toolkit::MeshVisual::Property::TEXTURES_PATH, mTexturesPath );
+ map.Insert( Toolkit::MeshVisual::Property::SHADING_MODE, mShadingMode );
+ map.Insert( Toolkit::MeshVisual::Property::USE_MIPMAPPING, mUseMipmapping );
+ map.Insert( Toolkit::MeshVisual::Property::USE_SOFT_NORMALS, mUseSoftNormals );
+ map.Insert( Toolkit::MeshVisual::Property::LIGHT_POSITION, mLightPosition );
}
void MeshVisual::InitializeRenderer()
scaleMatrix.SetIdentityAndScale( Vector3( 1.0, -1.0, 1.0 ) );
mShader.RegisterProperty( STAGE_OFFSET_UNIFORM_NAME, Vector2( width, height ) / 2.0f );
- mShader.RegisterProperty( LIGHT_POSITION_UNIFORM_NAME, mLightPosition );
+ mShader.RegisterProperty( LIGHT_POSITION_NAME, mLightPosition );
mShader.RegisterProperty( OBJECT_MATRIX_UNIFORM_NAME, scaleMatrix );
}
void MeshVisual::CreateShader()
{
- if( mShaderType == ALL_TEXTURES )
+ if( mShadingMode == Toolkit::MeshVisual::ShadingMode::TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING )
{
mShader = Shader::New( NORMAL_MAP_VERTEX_SHADER, NORMAL_MAP_FRAGMENT_SHADER );
}
- else if( mShaderType == DIFFUSE_TEXTURE )
+ else if( mShadingMode == Toolkit::MeshVisual::ShadingMode::TEXTURED_WITH_SPECULAR_LIGHTING )
{
mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
}
//Determine if we need to use a simpler shader to handle the provided data
if( !mUseTexture || !mObjLoader.IsDiffuseMapPresent() )
{
- mShaderType = TEXTURELESS;
+ mShadingMode = Toolkit::MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING;
}
- else if( mShaderType == ALL_TEXTURES && (!mObjLoader.IsNormalMapPresent() || !mObjLoader.IsSpecularMapPresent()) )
+ else if( mShadingMode == Toolkit::MeshVisual::ShadingMode::TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING && (!mObjLoader.IsNormalMapPresent() || !mObjLoader.IsSpecularMapPresent()) )
{
- mShaderType = DIFFUSE_TEXTURE;
+ mShadingMode = Toolkit::MeshVisual::ShadingMode::TEXTURED_WITH_SPECULAR_LIGHTING;
}
int objectProperties = 0;
- if( mShaderType == DIFFUSE_TEXTURE ||
- mShaderType == ALL_TEXTURES )
+ if( mShadingMode == Toolkit::MeshVisual::ShadingMode::TEXTURED_WITH_SPECULAR_LIGHTING ||
+ mShadingMode == Toolkit::MeshVisual::ShadingMode::TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING )
{
objectProperties |= ObjLoader::TEXTURE_COORDINATES;
}
- if( mShaderType == ALL_TEXTURES )
+ if( mShadingMode == Toolkit::MeshVisual::ShadingMode::TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING )
{
objectProperties |= ObjLoader::TANGENTS | ObjLoader::BINORMALS;
}
{
mTextureSet = TextureSet::New();
- if( mShaderType != TEXTURELESS )
+ if( mShadingMode != Toolkit::MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING )
{
Sampler sampler = Sampler::New();
if( mUseMipmapping )
}
}
- if( !mNormalTextureUrl.empty() && ( mShaderType == ALL_TEXTURES ) )
+ if( !mNormalTextureUrl.empty() && ( mShadingMode == Toolkit::MeshVisual::ShadingMode::TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING ) )
{
std::string imageUrl = mTexturesPath + mNormalTextureUrl;
}
}
- if( !mGlossTextureUrl.empty() && ( mShaderType == ALL_TEXTURES ) )
+ if( !mGlossTextureUrl.empty() && ( mShadingMode == Toolkit::MeshVisual::ShadingMode::TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING ) )
{
std::string imageUrl = mTexturesPath + mGlossTextureUrl;
#include <string.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/mesh-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/internal/controls/model3d-view/obj-loader.h>
* | objectUrl | STRING | A URL to the .obj file |
* | materialUrl | STRING | A URL to the .mtl file |
* | texturesPath | STRING | A URL of the path to the texture images |
- * | shaderType | STRING | An enum of shader types |
+ * | shadingMode | STRING | An enum of shading modes |
* | useMipmapping | BOOLEAN | If true, use mipmaps for textures. Default true. |
* | useSoftNormals | BOOLEAN | If true, average normals at points for smooth textures. Default true. |
* | lightPosition | VECTOR3 | The position (on stage) of the light |
private:
- //Corresponds to the shader that will be used by the mesh visual.
- enum ShaderType
- {
- TEXTURELESS,
- DIFFUSE_TEXTURE,
- ALL_TEXTURES
- };
-
/**
* @brief Provide an empty geometry for the visual to use.
* @details For use in error cases where the initialisation has failed for varying reasons.
Vector3 mSceneSize;
Vector3 mLightPosition;
- ShaderType mShaderType;
+ Toolkit::MeshVisual::ShadingMode::Value mShadingMode;
bool mUseTexture;
bool mUseMipmapping;
#include <dali/devel-api/images/texture-set-image.h>
// INTERNAL IINCLUDES
+#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
void NPatchVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
{
- Property::Value* imageURLValue = propertyMap.Find( IMAGE_URL_NAME );
+ Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME );
if( imageURLValue )
{
//Read the borderOnly property first since InitialiseFromImage relies on mBorderOnly to be properly set
- Property::Value* borderOnlyValue = propertyMap.Find( BORDER_ONLY );
+ Property::Value* borderOnlyValue = propertyMap.Find( Toolkit::ImageVisual::Property::BORDER_ONLY, BORDER_ONLY );
if( borderOnlyValue )
{
borderOnlyValue->Get( mBorderOnly );
void NPatchVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( RENDERER_TYPE, IMAGE_RENDERER );
+ map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE );
if( !mImageUrl.empty() )
{
- map.Insert( IMAGE_URL_NAME, mImageUrl );
+ map.Insert( Toolkit::ImageVisual::Property::URL, mImageUrl );
}
else if( mImage )
{
- map.Insert( IMAGE_URL_NAME, mImage.GetUrl() );
+ map.Insert( Toolkit::ImageVisual::Property::URL, mImage.GetUrl() );
}
- map.Insert( BORDER_ONLY, mBorderOnly );
+ map.Insert( Toolkit::ImageVisual::Property::BORDER_ONLY, mBorderOnly );
}
void NPatchVisual::ChangeRenderer( bool oldBorderOnly, size_t oldGridX, size_t oldGridY )
void NPatchVisual::InitializeFromBrokenImage()
{
- mCroppedImage = VisualFactory::GetBrokenRendererImage();
+ mCroppedImage = VisualFactory::GetBrokenVisualImage();
mImageSize = ImageDimensions( mCroppedImage.GetWidth(), mCroppedImage.GetHeight() );
mStretchPixelsX.Clear();
#include <dali/integration-api/debug.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/common/constants.h>
+#include <dali/devel-api/scripting/enum-helper.h>
+#include <dali/devel-api/scripting/scripting.h>
-//INTERNAL INCLUDES
-#include <dali-toolkit/internal/visuals/visual-string-constants.h>
+// INTERNAL INCLUDES
#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
namespace Dali
namespace
{
+// shapes
+DALI_ENUM_TO_STRING_TABLE_BEGIN( SHAPE_TYPE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::PrimitiveVisual::Shape, SPHERE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::PrimitiveVisual::Shape, CONICAL_FRUSTRUM )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::PrimitiveVisual::Shape, CONE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::PrimitiveVisual::Shape, CYLINDER )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::PrimitiveVisual::Shape, CUBE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::PrimitiveVisual::Shape, OCTAHEDRON )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::PrimitiveVisual::Shape, BEVELLED_CUBE )
+DALI_ENUM_TO_STRING_TABLE_END( SHAPE_TYPE )
+
+//Property names
+const char * const PRIMITIVE_SHAPE( "shape" );
+const char * const SHAPE_COLOR( "shapeColor" );
+const char * const SLICES( "slices" );
+const char * const STACKS( "stacks" );
+const char * const SCALE_TOP_RADIUS( "scaleTopRadius" );
+const char * const SCALE_BOTTOM_RADIUS( "scaleBottomRadius" );
+const char * const SCALE_HEIGHT( "scaleHeight" );
+const char * const SCALE_RADIUS( "scaleRadius" );
+const char * const SCALE_DIMENSIONS( "scaleDimensions" );
+const char * const BEVEL_PERCENTAGE( "bevelPercentage" );
+const char * const BEVEL_SMOOTHNESS( "bevelSmoothness" );
+const char * const LIGHT_POSITION_UNIFORM_NAME( "lightPosition" );
+
//Primitive property defaults
const int DEFAULT_SLICES = 128; ///< For spheres and conics
const int DEFAULT_STACKS = 128; ///< For spheres and conics
const float MIN_SMOOTHNESS = 0.0; ///< Minimum bevel smoothness for bevelled cubes
const float MAX_SMOOTHNESS = 1.0; ///< Maximum bevel smoothness for bevelled cubes
-const char * const RENDERER_TYPE_VALUE( "PRIMITIVE" );
-
//Specific shape labels.
const char * const SPHERE_LABEL( "SPHERE" );
const char * const CONE_LABEL( "CONE" );
mBevelSmoothness( DEFAULT_BEVEL_SMOOTHNESS ),
mSlices( DEFAULT_SLICES ),
mStacks( DEFAULT_STACKS ),
- mPrimitiveType( SPHERE )
+ mPrimitiveType( Toolkit::PrimitiveVisual::Shape::SPHERE )
{
}
void PrimitiveVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
{
//Find out which shape to renderer.
- Property::Value* primitiveType = propertyMap.Find( PRIMITIVE_SHAPE );
- if( primitiveType )
+ Property::Value* primitiveTypeValue = propertyMap.Find( Toolkit::PrimitiveVisual::Property::SHAPE, PRIMITIVE_SHAPE );
+ if( primitiveTypeValue )
{
- if( primitiveType->Get( mShape ) )
- {
- //Set property type as an enum.
- if( mShape == SPHERE_LABEL )
- {
- mPrimitiveType = SPHERE;
- }
- else if( mShape == CONE_LABEL )
- {
- mPrimitiveType = CONE;
- }
- else if( mShape == CONICAL_FRUSTRUM_LABEL )
- {
- mPrimitiveType = CONICAL_FRUSTRUM;
- }
- else if( mShape == CYLINDER_LABEL )
- {
- mPrimitiveType = CYLINDER;
- }
- else if( mShape == CUBE_LABEL )
- {
- mPrimitiveType = CUBE;
- }
- else if( mShape == OCTAHEDRON_LABEL )
- {
- mPrimitiveType = OCTAHEDRON;
- }
- else if( mShape == BEVELLED_CUBE_LABEL )
- {
- mPrimitiveType = BEVELLED_CUBE;
- }
- else
- {
- DALI_LOG_ERROR( "No known shape in PrimitiveVisual.\n" );
- }
- }
- else
- {
- DALI_LOG_ERROR( "Invalid type for shape in PrimitiveVisual.\n" );
- }
+ Scripting::GetEnumerationProperty( *primitiveTypeValue, SHAPE_TYPE_TABLE, SHAPE_TYPE_TABLE_COUNT, mPrimitiveType );
}
else
{
//Read in other potential properties.
- Property::Value* color = propertyMap.Find( SHAPE_COLOR );
+ Property::Value* color = propertyMap.Find( Toolkit::PrimitiveVisual::Property::COLOR, SHAPE_COLOR );
if( color && !color->Get( mColor ) )
{
DALI_LOG_ERROR( "Invalid type for color in PrimitiveVisual.\n" );
}
- Property::Value* slices = propertyMap.Find( SLICES );
+ Property::Value* slices = propertyMap.Find( Toolkit::PrimitiveVisual::Property::SLICES, SLICES );
if( slices )
{
if( slices->Get( mSlices ) )
}
}
- Property::Value* stacks = propertyMap.Find( STACKS );
+ Property::Value* stacks = propertyMap.Find( Toolkit::PrimitiveVisual::Property::STACKS, STACKS );
if( stacks )
{
if( stacks->Get( mStacks ) )
}
}
- Property::Value* scaleTop = propertyMap.Find( SCALE_TOP_RADIUS );
+ Property::Value* scaleTop = propertyMap.Find( Toolkit::PrimitiveVisual::Property::SCALE_TOP_RADIUS, SCALE_TOP_RADIUS );
if( scaleTop && !scaleTop->Get( mScaleTopRadius ) )
{
DALI_LOG_ERROR( "Invalid type for scale top radius in PrimitiveVisual.\n" );
}
- Property::Value* scaleBottom = propertyMap.Find( SCALE_BOTTOM_RADIUS );
+ Property::Value* scaleBottom = propertyMap.Find( Toolkit::PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS, SCALE_BOTTOM_RADIUS );
if( scaleBottom && !scaleBottom->Get( mScaleBottomRadius ) )
{
DALI_LOG_ERROR( "Invalid type for scale bottom radius in PrimitiveVisual.\n" );
}
- Property::Value* scaleHeight = propertyMap.Find( SCALE_HEIGHT );
+ Property::Value* scaleHeight = propertyMap.Find( Toolkit::PrimitiveVisual::Property::SCALE_HEIGHT, SCALE_HEIGHT );
if( scaleHeight && !scaleHeight->Get( mScaleHeight ) )
{
DALI_LOG_ERROR( "Invalid type for scale height in PrimitiveVisual.\n" );
}
- Property::Value* scaleRadius = propertyMap.Find( SCALE_RADIUS );
+ Property::Value* scaleRadius = propertyMap.Find( Toolkit::PrimitiveVisual::Property::SCALE_RADIUS, SCALE_RADIUS );
if( scaleRadius && !scaleRadius->Get( mScaleRadius ) )
{
DALI_LOG_ERROR( "Invalid type for scale radius in PrimitiveVisual.\n" );
}
- Property::Value* dimensions = propertyMap.Find( SCALE_DIMENSIONS );
+ Property::Value* dimensions = propertyMap.Find( Toolkit::PrimitiveVisual::Property::SCALE_DIMENSIONS, SCALE_DIMENSIONS );
if( dimensions )
{
if( dimensions->Get( mScaleDimensions ) )
}
}
- Property::Value* bevel = propertyMap.Find( BEVEL_PERCENTAGE );
+ Property::Value* bevel = propertyMap.Find( Toolkit::PrimitiveVisual::Property::BEVEL_PERCENTAGE, BEVEL_PERCENTAGE );
if( bevel )
{
if( bevel->Get( mBevelPercentage ) )
}
}
- Property::Value* smoothness = propertyMap.Find( BEVEL_SMOOTHNESS );
+ Property::Value* smoothness = propertyMap.Find( Toolkit::PrimitiveVisual::Property::BEVEL_SMOOTHNESS, BEVEL_SMOOTHNESS );
if( smoothness )
{
if( smoothness->Get( mBevelSmoothness ) )
}
//Read in light position.
- Property::Value* lightPosition = propertyMap.Find( LIGHT_POSITION_UNIFORM_NAME );
+ Property::Value* lightPosition = propertyMap.Find( Toolkit::PrimitiveVisual::Property::LIGHT_POSITION, LIGHT_POSITION_UNIFORM_NAME );
if( lightPosition )
{
if( !lightPosition->Get( mLightPosition ) )
void PrimitiveVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( RENDERER_TYPE, RENDERER_TYPE_VALUE );
- map.Insert( PRIMITIVE_SHAPE, mShape );
- map.Insert( SHAPE_COLOR, mColor );
- map.Insert( SLICES, mSlices );
- map.Insert( STACKS, mStacks );
- map.Insert( SCALE_TOP_RADIUS, mScaleTopRadius );
- map.Insert( SCALE_BOTTOM_RADIUS, mScaleBottomRadius );
- map.Insert( SCALE_HEIGHT, mScaleHeight );
- map.Insert( SCALE_RADIUS, mScaleRadius );
- map.Insert( SCALE_DIMENSIONS, mScaleDimensions );
- map.Insert( BEVEL_PERCENTAGE, mBevelPercentage );
- map.Insert( BEVEL_SMOOTHNESS, mBevelSmoothness );
- map.Insert( LIGHT_POSITION_UNIFORM_NAME, mLightPosition );
+ map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::PRIMITIVE );
+ map.Insert( Toolkit::PrimitiveVisual::Property::SHAPE, mPrimitiveType );
+ map.Insert( Toolkit::PrimitiveVisual::Property::COLOR, mColor );
+ map.Insert( Toolkit::PrimitiveVisual::Property::SLICES, mSlices );
+ map.Insert( Toolkit::PrimitiveVisual::Property::STACKS, mStacks );
+ map.Insert( Toolkit::PrimitiveVisual::Property::SCALE_TOP_RADIUS, mScaleTopRadius );
+ map.Insert( Toolkit::PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS, mScaleBottomRadius );
+ map.Insert( Toolkit::PrimitiveVisual::Property::SCALE_HEIGHT, mScaleHeight );
+ map.Insert( Toolkit::PrimitiveVisual::Property::SCALE_RADIUS, mScaleRadius );
+ map.Insert( Toolkit::PrimitiveVisual::Property::SCALE_DIMENSIONS, mScaleDimensions );
+ map.Insert( Toolkit::PrimitiveVisual::Property::BEVEL_PERCENTAGE, mBevelPercentage );
+ map.Insert( Toolkit::PrimitiveVisual::Property::BEVEL_SMOOTHNESS, mBevelSmoothness );
+ map.Insert( Toolkit::PrimitiveVisual::Property::LIGHT_POSITION, mLightPosition );
}
void PrimitiveVisual::InitializeRenderer()
switch( mPrimitiveType )
{
- case SPHERE:
+ case Toolkit::PrimitiveVisual::Shape::SPHERE:
{
CreateSphere( vertices, indices, mSlices, mStacks );
break;
}
- case CONE:
+ case Toolkit::PrimitiveVisual::Shape::CONE:
{
//Create a conic with zero top radius.
CreateConic( vertices, indices, 0, mScaleBottomRadius, mScaleHeight, mSlices );
break;
}
- case CONICAL_FRUSTRUM:
+ case Toolkit::PrimitiveVisual::Shape::CONICAL_FRUSTRUM:
{
CreateConic( vertices, indices, mScaleTopRadius, mScaleBottomRadius, mScaleHeight, mSlices );
break;
}
- case CYLINDER:
+ case Toolkit::PrimitiveVisual::Shape::CYLINDER:
{
//Create a conic with equal radii on the top and bottom.
CreateConic( vertices, indices, mScaleRadius, mScaleRadius, mScaleHeight, mSlices );
break;
}
- case CUBE:
+ case Toolkit::PrimitiveVisual::Shape::CUBE:
{
//Create a cube by creating a bevelled cube with minimum bevel.
CreateBevelledCube( vertices, indices, mScaleDimensions, 0.0, 0.0 );
break;
}
- case OCTAHEDRON:
+ case Toolkit::PrimitiveVisual::Shape::OCTAHEDRON:
{
//Create an octahedron by creating a bevelled cube with maximum bevel.
CreateBevelledCube( vertices, indices, mScaleDimensions, 1.0, mBevelSmoothness );
break;
}
- case BEVELLED_CUBE:
+ case Toolkit::PrimitiveVisual::Shape::BEVELLED_CUBE:
{
CreateBevelledCube( vertices, indices, mScaleDimensions, mBevelPercentage, mBevelSmoothness );
break;
// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/primitive-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
namespace Dali
private:
- enum PrimitiveType
- {
- SPHERE,
- CONE,
- CONICAL_FRUSTRUM,
- CYLINDER,
- CUBE,
- OCTAHEDRON,
- BEVELLED_CUBE
- };
-
//Simple struct to store the position and normal of a single vertex.
struct Vertex
{
Shader mShader;
Geometry mGeometry;
- std::string mShape; //Shape to render, as string.
Vector4 mColor; //Color of shape.
Vector3 mObjectDimensions; //Dimensions of shape, scaled to be between 0.0 and 1.0.
int mSlices; ///< Number of slices to use when creating certain objects.
int mStacks; ///< Number of stacks to use when creating certain objects.
- PrimitiveType mPrimitiveType; //Shape to render, as enum.
+ Toolkit::PrimitiveVisual::Shape::Type mPrimitiveType; //Shape to render, as enum.
};
} // namespace Internal
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
#include <dali-toolkit/third-party/nanosvg/nanosvg.h>
#include <dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h>
#include <dali-toolkit/internal/visuals/image/image-visual.h>
void SvgVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
{
- Property::Value* imageURLValue = propertyMap.Find( IMAGE_URL_NAME );
+ Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME );
if( imageURLValue )
{
std::string imageUrl;
void SvgVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( RENDERER_TYPE, IMAGE_RENDERER );
+ map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE );
if( !mImageUrl.empty() )
{
- map.Insert( IMAGE_URL_NAME, mImageUrl );
+ map.Insert( Toolkit::ImageVisual::Property::URL, mImageUrl );
}
}
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
+#include <dali/devel-api/scripting/enum-helper.h>
+#include <dali/devel-api/scripting/scripting.h>
#include <dali/integration-api/debug.h>
-#include <dali/public-api/object/property-array.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/internal/visuals/visual-string-constants.h>
namespace Dali
{
namespace
{
-//custom shader
-const char * const CUSTOM_SHADER( "shader" );
-const char * const CUSTOM_VERTEX_SHADER( "vertexShader" );
-const char * const CUSTOM_FRAGMENT_SHADER( "fragmentShader" );
-const char * const CUSTOM_SUBDIVIDE_GRID_X( "subdivideGridX" );
-const char * const CUSTOM_SUBDIVIDE_GRID_Y( "subdivideGridY" );
-const char * const CUSTOM_SHADER_HINTS( "hints" ); ///< type STRING for a hint from the below hint strings or an ARRAY of of hint strings
-
-/**
- * where hints should be contain strings of the following shader hints:
- * "none" | corresponds to Shader::Hint::NONE
- * "outputIsTransparent" | corresponds to Shader::Hint::OUTPUT_IS_TRANSPARENT
- * "modifiesGeometry" | corresponds to Shader::Hint::MODIFIES_GEOMETRY
- */
-Shader::Hint::Value HintFromString( std::string hintString )
-{
- if( hintString == "none" )
- {
- return Shader::Hint::NONE;
- }
- else if( hintString == "outputIsTransparent" )
- {
- return Shader::Hint::OUTPUT_IS_TRANSPARENT;
- }
- else if( hintString == "modifiesGeometry" )
- {
- return Shader::Hint::MODIFIES_GEOMETRY;
- }
- else
- {
- DALI_LOG_ERROR( "'%s' hint string is not recognised", hintString.c_str() );
- }
-
- return Shader::Hint::NONE;
-}
+DALI_ENUM_TO_STRING_TABLE_BEGIN( SHADER_HINT )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Shader::Hint, NONE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Shader::Hint, OUTPUT_IS_TRANSPARENT )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Shader::Hint, MODIFIES_GEOMETRY )
+DALI_ENUM_TO_STRING_TABLE_END( SHADER_HINT )
-}// unnamed namespace
+} // unnamed namespace
Internal::Visual::Base::Impl::Impl()
: mCustomShader(NULL),
mGridSize = ImageDimensions( 1, 1 );
mHints = Shader::Hint::NONE;
- Property::Value* vertexShaderValue = shaderMap.Find( CUSTOM_VERTEX_SHADER );
+ Property::Value* vertexShaderValue = shaderMap.Find( Toolkit::Visual::Shader::Property::VERTEX_SHADER, CUSTOM_VERTEX_SHADER );
if( vertexShaderValue )
{
if( !vertexShaderValue->Get( mVertexShader ) )
}
}
- Property::Value* fragmentShaderValue = shaderMap.Find( CUSTOM_FRAGMENT_SHADER );
+ Property::Value* fragmentShaderValue = shaderMap.Find( Toolkit::Visual::Shader::Property::FRAGMENT_SHADER, CUSTOM_FRAGMENT_SHADER );
if( fragmentShaderValue )
{
if( !fragmentShaderValue->Get( mFragmentShader ) )
}
}
- Property::Value* subdivideXValue = shaderMap.Find( CUSTOM_SUBDIVIDE_GRID_X );
+ Property::Value* subdivideXValue = shaderMap.Find( Toolkit::Visual::Shader::Property::SUBDIVIDE_GRID_X, CUSTOM_SUBDIVIDE_GRID_X );
if( subdivideXValue )
{
int subdivideX;
}
}
- Property::Value* subdivideYValue = shaderMap.Find( CUSTOM_SUBDIVIDE_GRID_Y );
+ Property::Value* subdivideYValue = shaderMap.Find( Toolkit::Visual::Shader::Property::SUBDIVIDE_GRID_Y, CUSTOM_SUBDIVIDE_GRID_Y );
if( subdivideYValue )
{
int subdivideY;
}
}
- Property::Value* hintsValue = shaderMap.Find( CUSTOM_SHADER_HINTS );
+ Property::Value* hintsValue = shaderMap.Find( Toolkit::Visual::Shader::Property::HINTS, CUSTOM_SHADER_HINTS );
if( hintsValue )
{
- std::string hintString;
- Property::Array hintsArray;
-
- if( hintsValue->Get( hintString ) )
- {
- mHints = HintFromString( hintString );
- }
- else if( hintsValue->Get( hintsArray ) )
- {
- int hints = Shader::Hint::NONE;
- for( Property::Array::SizeType i = 0; i < hintsArray.Count(); ++i)
- {
- Property::Value hintValue = hintsArray[ i ];
- if( hintValue.Get( hintString ) )
- {
- hints |= static_cast< int >( HintFromString( hintString ) );
- }
- else
- {
- DALI_LOG_ERROR( "'%s' parameter does not correctly specify an hint string at index %d", CUSTOM_SHADER_HINTS, i );
- }
-
- mHints = static_cast< Shader::Hint::Value >( hints );
- }
- }
- else
+ if ( ! Scripting::GetBitmaskEnumerationProperty( *hintsValue, SHADER_HINT_TABLE, SHADER_HINT_TABLE_COUNT, mHints ) )
{
- DALI_LOG_ERROR( "'%s' parameter does not correctly specify a hint string or an array of hint strings", CUSTOM_SHADER_HINTS );
+ DALI_LOG_ERROR( "'%s' parameter does not correctly specify a hint or an array of hint strings", CUSTOM_SHADER_HINTS );
}
}
}
Property::Map customShader;
if( !mVertexShader.empty() )
{
- customShader.Insert(CUSTOM_VERTEX_SHADER, mVertexShader );
+ customShader.Insert( Toolkit::Visual::Shader::Property::VERTEX_SHADER, mVertexShader );
}
if( !mFragmentShader.empty() )
{
- customShader.Insert(CUSTOM_FRAGMENT_SHADER, mFragmentShader );
+ customShader.Insert( Toolkit::Visual::Shader::Property::FRAGMENT_SHADER, mFragmentShader );
}
if( mGridSize.GetWidth() != 1 )
{
- customShader.Insert(CUSTOM_SUBDIVIDE_GRID_X, mGridSize.GetWidth() );
+ customShader.Insert( Toolkit::Visual::Shader::Property::SUBDIVIDE_GRID_X, mGridSize.GetWidth() );
}
if( mGridSize.GetHeight() != 1 )
{
- customShader.Insert(CUSTOM_SUBDIVIDE_GRID_Y, mGridSize.GetHeight() );
+ customShader.Insert( Toolkit::Visual::Shader::Property::SUBDIVIDE_GRID_Y, mGridSize.GetHeight() );
}
if( mHints != Dali::Shader::Hint::NONE )
{
- customShader.Insert(CUSTOM_SHADER_HINTS, static_cast< int >(mHints) );
+ customShader.Insert( Toolkit::Visual::Shader::Property::HINTS, static_cast< int >( mHints ) );
}
- map.Insert( CUSTOM_SHADER, customShader );
+ map.Insert( Toolkit::Visual::Property::SHADER, customShader );
}
}
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/integration-api/debug.h>
//INTERNAL HEARDER
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
-
-namespace
-{
-//custom shader
-const char * const CUSTOM_SHADER( "shader" );
-const char * const CUSTOM_VERTEX_SHADER( "vertexShader" );
-const char * const CUSTOM_FRAGMENT_SHADER( "fragmentShader" );
-const char * const CUSTOM_SUBDIVIDE_GRID_X( "subdivideGridX" );
-const char * const CUSTOM_SUBDIVIDE_GRID_Y( "subdivideGridY" );
-const char * const CUSTOM_SHADER_HINTS( "hints" ); ///< type INTEGER; (bitfield) values from enum Shader::Hint
-}
+#include <dali-toolkit/internal/visuals/visual-string-constants.h>
namespace Dali
{
void Base::Initialize( Actor& actor, const Property::Map& propertyMap )
{
- Property::Value* customShaderValue = propertyMap.Find( CUSTOM_SHADER );
+ Property::Value* customShaderValue = propertyMap.Find( Toolkit::Visual::Property::SHADER, CUSTOM_SHADER );
if( customShaderValue )
{
Property::Map shaderMap;
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/object/property-array.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
+#include <dali/devel-api/scripting/enum-helper.h>
+#include <dali/devel-api/scripting/scripting.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/internal/visuals/border/border-visual.h>
#include <dali-toolkit/internal/visuals/color/color-visual.h>
#include <dali-toolkit/internal/visuals/debug/debug-visual.h>
namespace
{
-const char * const BROKEN_RENDERER_IMAGE_URL( DALI_IMAGE_DIR "broken.png");
+const char * const BROKEN_VISUAL_IMAGE_URL( DALI_IMAGE_DIR "broken.png");
}
namespace Dali
namespace
{
+DALI_ENUM_TO_STRING_TABLE_BEGIN( VISUAL_TYPE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, BORDER )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, COLOR )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, GRADIENT )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, IMAGE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, MESH )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, PRIMITIVE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, DEBUG )
+DALI_ENUM_TO_STRING_TABLE_END( VISUAL_TYPE )
+
+const char * const VISUAL_TYPE( "visualType" );
+
BaseHandle Create()
{
BaseHandle handle = Toolkit::VisualFactory::Get();
{
}
-VisualFactory::RendererType VisualFactory::GetRendererType( const Property::Map& propertyMap )
+Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& propertyMap )
{
- RendererType rendererType = UNDEFINED;
-
- Property::Value* type = propertyMap.Find( RENDERER_TYPE );
- std::string typeValue ;
- if( type && type->Get( typeValue ))
+ // Create factory cache if it hasn't already been
+ if( !mFactoryCache )
{
- if( typeValue == COLOR_RENDERER )
- {
- rendererType = COLOR;
- }
- else if( typeValue == BORDER_RENDERER )
- {
- rendererType = BORDER;
- }
- else if( typeValue == GRADIENT_RENDERER )
- {
- rendererType = GRADIENT;
- }
- else if( typeValue == IMAGE_RENDERER )
- {
- rendererType = IMAGE;
- }
- else if( typeValue == MESH_RENDERER )
- {
- rendererType = MESH;
- }
- else if( typeValue == PRIMITIVE_RENDERER )
- {
- rendererType = PRIMITIVE;
- }
+ mFactoryCache = new VisualFactoryCache();
}
- // check the url if exist, to decide the renderer type
- if( rendererType == IMAGE || rendererType == UNDEFINED )
+ // Return a new DebugVisual if we have debug enabled
+ if( mDebugEnabled )
{
- Property::Value* imageURLValue = propertyMap.Find( IMAGE_URL_NAME );
- std::string imageUrl;
- if( imageURLValue && imageURLValue->Get( imageUrl ))
- {
- if( NinePatchImage::IsNinePatchUrl( imageUrl ) )
- {
- rendererType = N_PATCH;
- }
- else if( SvgVisual::IsSvgUrl( imageUrl ) )
- {
- rendererType = SVG;
- }
- else
- {
- rendererType = IMAGE;
- }
- }
+ return Toolkit::Visual::Base( new DebugVisual( *( mFactoryCache.Get() ) ) );
}
- return rendererType;
-}
-
-Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& propertyMap )
-{
- Visual::Base* rendererPtr = NULL;
+ Visual::Base* visualPtr = NULL;
- RendererType type = GetRendererType( propertyMap );
- if( type != UNDEFINED)
+ Property::Value* typeValue = propertyMap.Find( Toolkit::Visual::Property::TYPE, VISUAL_TYPE );
+ Toolkit::Visual::Type visualType = Toolkit::Visual::IMAGE; // Default to IMAGE type
+ if( typeValue )
{
- if( !mFactoryCache )
- {
- mFactoryCache = new VisualFactoryCache();
- }
-
- if( mDebugEnabled )
- {
- return Toolkit::Visual::Base( new DebugVisual( *( mFactoryCache.Get() ) ) );
- }
+ Scripting::GetEnumerationProperty( *typeValue, VISUAL_TYPE_TABLE, VISUAL_TYPE_TABLE_COUNT, visualType );
}
- switch( type )
+ switch( visualType )
{
- case COLOR:
+ case Toolkit::Visual::BORDER:
{
- rendererPtr = new ColorVisual( *( mFactoryCache.Get() ) );
+ visualPtr = new BorderVisual( *( mFactoryCache.Get() ) );
break;
}
- case GRADIENT:
- {
- rendererPtr = new GradientVisual( *( mFactoryCache.Get() ) );
- break;
- }
- case BORDER:
- {
- rendererPtr = new BorderVisual( *( mFactoryCache.Get() ) );
- break;
- }
- case IMAGE:
+
+ case Toolkit::Visual::COLOR:
{
- CreateAtlasManager();
- rendererPtr = new ImageVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
+ visualPtr = new ColorVisual( *( mFactoryCache.Get() ) );
break;
}
- case N_PATCH:
+
+ case Toolkit::Visual::GRADIENT:
{
- rendererPtr = new NPatchVisual( *( mFactoryCache.Get() ) );
+ visualPtr = new GradientVisual( *( mFactoryCache.Get() ) );
break;
}
- case SVG:
+
+ default: // Default to Image type if unknown (check if there is a URL)
+ case Toolkit::Visual::IMAGE:
{
- CreateAtlasManager();
- rendererPtr = new SvgVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
+ Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME );
+ std::string imageUrl;
+ if( imageURLValue && imageURLValue->Get( imageUrl ) )
+ {
+ if( NinePatchImage::IsNinePatchUrl( imageUrl ) )
+ {
+ visualPtr = new NPatchVisual( *( mFactoryCache.Get() ) );
+ }
+ else
+ {
+ CreateAtlasManager();
+
+ if( SvgVisual::IsSvgUrl( imageUrl ) )
+ {
+ visualPtr = new SvgVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
+ }
+ else
+ {
+ visualPtr = new ImageVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
+ }
+ }
+ }
+ else if( propertyMap.Find( Toolkit::Visual::Property::SHADER, CUSTOM_SHADER ) )
+ {
+ // Create Image Visual if it has a shader
+ // TODO: This is required because of EffectsView which should be fixed
+ CreateAtlasManager();
+ visualPtr = new ImageVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
+ }
break;
}
- case MESH:
+
+ case Toolkit::Visual::MESH:
{
- rendererPtr = new MeshVisual( *( mFactoryCache.Get() ) );
+ visualPtr = new MeshVisual( *( mFactoryCache.Get() ) );
break;
}
- case PRIMITIVE:
+
+ case Toolkit::Visual::PRIMITIVE:
{
- rendererPtr = new PrimitiveVisual( *( mFactoryCache.Get() ) );
+ visualPtr = new PrimitiveVisual( *( mFactoryCache.Get() ) );
break;
}
- case UNDEFINED:
- default:
+
+ case Toolkit::Visual::DEBUG:
{
+ visualPtr = new DebugVisual( *( mFactoryCache.Get() ) );
break;
}
}
- if( rendererPtr )
+ if( visualPtr )
{
Actor actor;
- rendererPtr->Initialize( actor, propertyMap );
+ visualPtr->Initialize( actor, propertyMap );
}
else
{
DALI_LOG_ERROR( "Renderer type unknown" );
}
- return Toolkit::Visual::Base( rendererPtr );
+ return Toolkit::Visual::Base( visualPtr );
}
Toolkit::Visual::Base VisualFactory::CreateVisual( const Image& image )
NinePatchImage npatchImage = NinePatchImage::DownCast( image );
if( npatchImage )
{
- NPatchVisual* rendererPtr = new NPatchVisual( *( mFactoryCache.Get() ) );
- rendererPtr->SetImage( npatchImage );
+ NPatchVisual* visualPtr = new NPatchVisual( *( mFactoryCache.Get() ) );
+ visualPtr->SetImage( npatchImage );
- return Toolkit::Visual::Base( rendererPtr );
+ return Toolkit::Visual::Base( visualPtr );
}
else
{
CreateAtlasManager();
- ImageVisual* rendererPtr = new ImageVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
+ ImageVisual* visualPtr = new ImageVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
Actor actor;
- rendererPtr->SetImage( actor, image );
+ visualPtr->SetImage( actor, image );
- return Toolkit::Visual::Base( rendererPtr );
+ return Toolkit::Visual::Base( visualPtr );
}
}
if( NinePatchImage::IsNinePatchUrl( url ) )
{
- NPatchVisual* rendererPtr = new NPatchVisual( *( mFactoryCache.Get() ) );
- rendererPtr->SetImage( url );
+ NPatchVisual* visualPtr = new NPatchVisual( *( mFactoryCache.Get() ) );
+ visualPtr->SetImage( url );
- return Toolkit::Visual::Base( rendererPtr );
+ return Toolkit::Visual::Base( visualPtr );
}
else if( SvgVisual::IsSvgUrl( url ) )
{
CreateAtlasManager();
- SvgVisual* rendererPtr = new SvgVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
- rendererPtr->SetImage( url, size );
- return Toolkit::Visual::Base( rendererPtr );
+ SvgVisual* visualPtr = new SvgVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
+ visualPtr->SetImage( url, size );
+ return Toolkit::Visual::Base( visualPtr );
}
else
{
CreateAtlasManager();
- ImageVisual* rendererPtr = new ImageVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
+ ImageVisual* visualPtr = new ImageVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
Actor actor;
- rendererPtr->SetImage( actor, url, size );
+ visualPtr->SetImage( actor, url, size );
- return Toolkit::Visual::Base( rendererPtr );
+ return Toolkit::Visual::Base( visualPtr );
}
}
-Image VisualFactory::GetBrokenRendererImage()
+Image VisualFactory::GetBrokenVisualImage()
{
- return ResourceImage::New( BROKEN_RENDERER_IMAGE_URL );
+ return ResourceImage::New( BROKEN_VISUAL_IMAGE_URL );
}
void VisualFactory::CreateAtlasManager()
{
Shader shader = ImageVisual::GetImageShader( *( mFactoryCache.Get() ) );
mAtlasManager = new ImageAtlasManager();
- mAtlasManager->SetBrokenImage( BROKEN_RENDERER_IMAGE_URL );
+ mAtlasManager->SetBrokenImage( BROKEN_VISUAL_IMAGE_URL );
}
}
#define DALI_TOOLKIT_VISUAL_FACTORY_IMPL_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
public:
- enum RendererType
- {
- COLOR,
- BORDER,
- GRADIENT,
- IMAGE,
- N_PATCH,
- SVG,
- MESH,
- PRIMITIVE,
- UNDEFINED
- };
-
/**
* @brief Constructor
*
public:
/**
- * @brief Returns an image to be used when a renderer has failed to correctly render
+ * @brief Returns an image to be used when a visual has failed to correctly render
*/
- static Image GetBrokenRendererImage();
+ static Image GetBrokenVisualImage();
protected:
private:
/**
- * Get the visual type from the property map.
- *
- * @param[in] propertyMap The map contains the properties of the visual
- * @return The rendererType
- */
- RendererType GetRendererType( const Property::Map& propertyMap );
-
- /**
* Prepare the atlas manager
*/
void CreateAtlasManager();
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Internal
{
-const char * const RENDERER_TYPE("rendererType");
-const char * const COLOR_RENDERER("COLOR");
-const char * const BORDER_RENDERER("BORDER");
-const char * const GRADIENT_RENDERER("GRADIENT");
-const char * const IMAGE_RENDERER("IMAGE");
-const char * const MESH_RENDERER("MESH");
-const char * const PRIMITIVE_RENDERER( "PRIMITIVE" );
-const char * const DEBUG_RENDERER("DEBUG");
+// Custom shader
+const char * const CUSTOM_SHADER( "shader" );
+const char * const CUSTOM_VERTEX_SHADER( "vertexShader" );
+const char * const CUSTOM_FRAGMENT_SHADER( "fragmentShader" );
+const char * const CUSTOM_SUBDIVIDE_GRID_X( "subdivideGridX" );
+const char * const CUSTOM_SUBDIVIDE_GRID_Y( "subdivideGridY" );
+const char * const CUSTOM_SHADER_HINTS( "hints" );
+// Image visual
const char * const IMAGE_URL_NAME("url");
const char * const ATLAS_RECT_UNIFORM_NAME ( "uAtlasRect" );
-const char * const LIGHT_POSITION_UNIFORM_NAME( "lightPosition" );
-
-//Mesh properties
-const char * const OBJECT_URL( "objectUrl" );
-const char * const MATERIAL_URL( "materialUrl" );
-const char * const TEXTURES_PATH( "texturesPath" );
-const char * const SHADER_TYPE( "shaderType" );
-const char * const USE_MIPMAPPING( "useMipmapping" );
-const char * const USE_SOFT_NORMALS( "useSoftNormals" );
-
-//Primitive shape properties
-const char * const PRIMITIVE_SHAPE( "shape" );
-const char * const SHAPE_COLOR( "shapeColor" );
-const char * const SLICES( "slices" );
-const char * const STACKS( "stacks" );
-const char * const SCALE_TOP_RADIUS( "scaleTopRadius" );
-const char * const SCALE_BOTTOM_RADIUS( "scaleBottomRadius" );
-const char * const SCALE_HEIGHT( "scaleHeight" );
-const char * const SCALE_RADIUS( "scaleRadius" );
-const char * const SCALE_DIMENSIONS( "scaleDimensions" );
-const char * const BEVEL_PERCENTAGE( "bevelPercentage" );
-const char * const BEVEL_SMOOTHNESS( "bevelSmoothness" );
} // namespace Internal
namespace Internal
{
-extern const char * const RENDERER_TYPE;
-extern const char * const COLOR_RENDERER;
-extern const char * const BORDER_RENDERER;
-extern const char * const GRADIENT_RENDERER;
-extern const char * const IMAGE_RENDERER;
-extern const char * const MESH_RENDERER;
-extern const char * const PRIMITIVE_RENDERER;
-extern const char * const DEBUG_RENDERER;
-
+// Custom shader
+extern const char * const CUSTOM_SHADER;
+extern const char * const CUSTOM_VERTEX_SHADER;
+extern const char * const CUSTOM_FRAGMENT_SHADER;
+extern const char * const CUSTOM_SUBDIVIDE_GRID_X;
+extern const char * const CUSTOM_SUBDIVIDE_GRID_Y;
+extern const char * const CUSTOM_SHADER_HINTS;
+
+// Image visual
extern const char * const IMAGE_URL_NAME;
extern const char * const ATLAS_RECT_UNIFORM_NAME;
-extern const char * const LIGHT_POSITION_UNIFORM_NAME;
-
-//Mesh properties
-extern const char * const OBJECT_URL;
-extern const char * const MATERIAL_URL;
-extern const char * const TEXTURES_PATH;
-extern const char * const SHADER_TYPE;
-extern const char * const USE_MIPMAPPING;
-extern const char * const USE_SOFT_NORMALS;
-
-//Primitive shape properties
-extern const char * const PRIMITIVE_SHAPE;
-extern const char * const SHAPE_COLOR;
-extern const char * const SLICES;
-extern const char * const STACKS;
-extern const char * const SCALE_TOP_RADIUS;
-extern const char * const SCALE_BOTTOM_RADIUS;
-extern const char * const SCALE_HEIGHT;
-extern const char * const SCALE_RADIUS;
-extern const char * const SCALE_DIMENSIONS;
-extern const char * const BEVEL_PERCENTAGE;
-extern const char * const BEVEL_SMOOTHNESS;
} // namespace Internal
#include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
#include <dali-toolkit/public-api/controls/control.h>
#include <dali-toolkit/public-api/styling/style-manager.h>
+#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
#include <dali-toolkit/internal/styling/style-manager-impl.h>
#include <dali-toolkit/internal/visuals/color/color-visual.h>
-#include <dali-toolkit/internal/visuals/visual-string-constants.h>
namespace Dali
{
Impl(Control& controlImpl)
: mControlImpl( controlImpl ),
mStyleName(""),
- mBackgroundRenderer(),
+ mBackgroundVisual(),
mBackgroundColor(Color::TRANSPARENT),
mStartingPinchScale( NULL ),
mKeyEventSignal(),
{
DALI_LOG_WARNING( "BACKGROUND_IMAGE property is deprecated. Use BACKGROUND property instead\n" );
Property::Map map;
- if( controlImpl.mImpl->mBackgroundRenderer )
+ if( controlImpl.mImpl->mBackgroundVisual )
{
- controlImpl.mImpl->mBackgroundRenderer.CreatePropertyMap( map );
+ controlImpl.mImpl->mBackgroundVisual.CreatePropertyMap( map );
}
value = map;
break;
case Toolkit::Control::Property::BACKGROUND:
{
Property::Map map;
- if( controlImpl.mImpl->mBackgroundRenderer )
+ if( controlImpl.mImpl->mBackgroundVisual )
{
- (controlImpl.mImpl->mBackgroundRenderer).CreatePropertyMap( map );
+ (controlImpl.mImpl->mBackgroundVisual).CreatePropertyMap( map );
}
value = map;
Control& mControlImpl;
std::string mStyleName;
- Toolkit::Visual::Base mBackgroundRenderer; ///< The control renderer to render the background
- Vector4 mBackgroundColor; ///< The color of the background renderer
+ Toolkit::Visual::Base mBackgroundVisual; ///< The visual to render the background
+ Vector4 mBackgroundColor; ///< The color of the background visual
Vector3* mStartingPinchScale; ///< The scale when a pinch gesture starts, TODO: consider removing this
Toolkit::Control::KeyEventSignalType mKeyEventSignal;
Toolkit::Control::KeyInputFocusSignalType mKeyInputFocusGainedSignal;
Actor self( Self() );
mImpl->mBackgroundColor = color;
Property::Map map;
- map[ RENDERER_TYPE ] = COLOR_RENDERER;
- map[ "mixColor" ] = color;
- InitializeVisual( self, mImpl->mBackgroundRenderer, map );
- if( mImpl->mBackgroundRenderer )
+ map[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::COLOR;
+ map[ Toolkit::ColorVisual::Property::MIX_COLOR ] = color;
+ InitializeVisual( self, mImpl->mBackgroundVisual, map );
+ if( mImpl->mBackgroundVisual )
{
- mImpl->mBackgroundRenderer.SetDepthIndex( DepthIndex::BACKGROUND );
+ mImpl->mBackgroundVisual.SetDepthIndex( DepthIndex::BACKGROUND );
}
}
void Control::SetBackground( const Property::Map& map )
{
Actor self( Self() );
- InitializeVisual( self, mImpl->mBackgroundRenderer, map );
- if( mImpl->mBackgroundRenderer )
+ InitializeVisual( self, mImpl->mBackgroundVisual, map );
+ if( mImpl->mBackgroundVisual )
{
- mImpl->mBackgroundRenderer.SetDepthIndex( DepthIndex::BACKGROUND );
+ mImpl->mBackgroundVisual.SetDepthIndex( DepthIndex::BACKGROUND );
}
}
void Control::SetBackgroundImage( Image image )
{
Actor self( Self() );
- InitializeVisual( self, mImpl->mBackgroundRenderer, image );
- if( mImpl->mBackgroundRenderer )
+ InitializeVisual( self, mImpl->mBackgroundVisual, image );
+ if( mImpl->mBackgroundVisual )
{
- mImpl->mBackgroundRenderer.SetDepthIndex( DepthIndex::BACKGROUND );
+ mImpl->mBackgroundVisual.SetDepthIndex( DepthIndex::BACKGROUND );
}
}
void Control::ClearBackground()
{
Actor self( Self() );
- mImpl->mBackgroundRenderer.RemoveAndReset( self );
+ mImpl->mBackgroundVisual.RemoveAndReset( self );
}
void Control::EnableGestureDetection(Gesture::Type type)
void Control::OnStageConnection( int depth )
{
- if( mImpl->mBackgroundRenderer)
+ if( mImpl->mBackgroundVisual)
{
Actor self( Self() );
- mImpl->mBackgroundRenderer.SetOnStage( self );
+ mImpl->mBackgroundVisual.SetOnStage( self );
}
}
void Control::OnStageDisconnection()
{
- if( mImpl->mBackgroundRenderer )
+ if( mImpl->mBackgroundVisual )
{
Actor self( Self() );
- mImpl->mBackgroundRenderer.SetOffStage( self );
+ mImpl->mBackgroundVisual.SetOffStage( self );
}
}
void Control::OnSizeSet(const Vector3& targetSize)
{
- if( mImpl->mBackgroundRenderer )
+ if( mImpl->mBackgroundVisual )
{
Vector2 size( targetSize );
- mImpl->mBackgroundRenderer.SetSize( size );
+ mImpl->mBackgroundVisual.SetSize( size );
}
}
Vector3 Control::GetNaturalSize()
{
- if( mImpl->mBackgroundRenderer )
+ if( mImpl->mBackgroundVisual )
{
Vector2 naturalSize;
- mImpl->mBackgroundRenderer.GetNaturalSize(naturalSize);
+ mImpl->mBackgroundVisual.GetNaturalSize(naturalSize);
return Vector3(naturalSize);
}
return Vector3::ZERO;
public_api_header_files = \
$(public_api_src_dir)/dali-toolkit-version.h \
- $(public_api_src_dir)/enums.h
+ $(public_api_src_dir)/enums.h \
+ $(public_api_src_dir)/toolkit-property-index-ranges.h
public_api_controls_header_files = \
$(public_api_src_dir)/controls/control-impl.h \
public_api_video_view_header_files = \
$(public_api_src_dir)/controls/video-view/video-view.h
+
+public_api_visuals_header_files = \
+ $(public_api_src_dir)/visuals/border-visual-properties.h \
+ $(public_api_src_dir)/visuals/color-visual-properties.h \
+ $(public_api_src_dir)/visuals/gradient-visual-properties.h \
+ $(public_api_src_dir)/visuals/image-visual-properties.h \
+ $(public_api_src_dir)/visuals/mesh-visual-properties.h \
+ $(public_api_src_dir)/visuals/primitive-visual-properties.h \
+ $(public_api_src_dir)/visuals/visual-properties.h
--- /dev/null
+#ifndef DALI_TOOLKIT_PROPERTY_INDEX_RANGES_H
+#define DALI_TOOLKIT_PROPERTY_INDEX_RANGES_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/property-index-ranges.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+enum PropertyRanges
+{
+ VISUAL_PROPERTY_BASE_START_INDEX = CORE_PROPERTY_MAX_INDEX + 1, ///< Visual Property Base Start Index. @SINCE_1_1.45
+ VISUAL_PROPERTY_BASE_END_INDEX = VISUAL_PROPERTY_BASE_START_INDEX + 100, ///< Visual Property Base End Index. @SINCE_1_1.45
+ VISUAL_PROPERTY_START_INDEX = VISUAL_PROPERTY_BASE_END_INDEX + 1, ///< Visual Property Start Index. @SINCE_1_1.45
+ VISUAL_PROPERTY_END_INDEX = VISUAL_PROPERTY_START_INDEX + 100000, ///< Visual Property End Index. @SINCE_1_1.45
+};
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_PROPERTY_INDEX_RANGES_H
--- /dev/null
+#ifndef DALI_TOOLKIT_BORDER_VISUAL_PROPERTIES_H
+#define DALI_TOOLKIT_BORDER_VISUAL_PROPERTIES_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace BorderVisual
+{
+
+namespace Property
+{
+
+enum
+{
+ /**
+ * @brief The color of the border.
+ * @details Name "borderColor", type Property::VECTOR4.
+ * @SINCE_1_1.45
+ * @note Mandatory.
+ */
+ COLOR = VISUAL_PROPERTY_START_INDEX,
+
+ /**
+ * @brief The width of the border (in pixels).
+ * @details Name "borderSize", type Property::FLOAT.
+ * @SINCE_1_1.45
+ * @note Mandatory.
+ */
+ SIZE,
+
+ /**
+ * @brief Whether anti-aliasing of the border is required.
+ * @details Name "antiAliasing", type Property::BOOLEAN.
+ * @SINCE_1_1.45
+ * @note Optional. If not supplied, default is false.
+ */
+ ANTI_ALIASING,
+};
+
+} // namespace Property
+
+} // namespace BorderVisual
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_BORDER_VISUAL_PROPERTIES_H
--- /dev/null
+#ifndef DALI_TOOLKIT_COLOR_VISUAL_PROPERTIES_H
+#define DALI_TOOLKIT_COLOR_VISUAL_PROPERTIES_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace ColorVisual
+{
+
+namespace Property
+{
+
+enum
+{
+ /**
+ * @brief The solid color required.
+ * @details Name "mixColor", type Property::VECTOR4.
+ * @SINCE_1_1.45
+ * @note Mandatory.
+ */
+ MIX_COLOR = VISUAL_PROPERTY_START_INDEX,
+};
+
+} // namespace Property
+
+} // namespace ColorVisual
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_COLOR_VISUAL_PROPERTIES_H
--- /dev/null
+#ifndef DALI_TOOLKIT_GRADIENT_VISUAL_PROPERTIES_H
+#define DALI_TOOLKIT_GRADIENT_VISUAL_PROPERTIES_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace GradientVisual
+{
+
+namespace Property
+{
+
+enum
+{
+ /**
+ * @brief The start position of a linear gradient.
+ * @details Name "startPosition", type Property::VECTOR2.
+ * @SINCE_1_1.45
+ * @note Mandatory for Linear.
+ */
+ START_POSITION = VISUAL_PROPERTY_START_INDEX,
+
+ /**
+ * @brief The end position of a linear gradient.
+ * @details Name "endPosition", type Property::VECTOR2.
+ * @SINCE_1_1.45
+ * @note Mandatory for Linear.
+ */
+ END_POSITION,
+
+ /**
+ * @brief The center point of a radial gradient.
+ * @details Name "center", type Property::VECTOR2.
+ * @SINCE_1_1.45
+ * @note Mandatory for Radial.
+ */
+ CENTER,
+
+ /**
+ * @brief The size of the radius of a radial gradient.
+ * @details Name "radius", type Property::FLOAT.
+ * @SINCE_1_1.45
+ * @note Mandatory for Radial.
+ */
+ RADIUS,
+
+ /**
+ * @brief All the stop offsets.
+ * @details Name "stopOffset", type Property::ARRAY of Property::FLOAT.
+ * @SINCE_1_1.45
+ * @note Optional. If not supplied, default is 0.0 and 1.0.
+ */
+ STOP_OFFSET,
+
+ /**
+ * @brief The color at the stop offsets.
+ * @details Name "stopColor", type Property::ARRAY of Property::VECTOR4.
+ * @SINCE_1_1.45
+ * @note Mandatory. At least 2 values required to show a gradient.
+ */
+ STOP_COLOR,
+
+ /**
+ * @brief Defines the coordinate system for certain attributes of the points in a gradient.
+ * @details Name "units", type Units::Type (Property::INTEGER) or Property::STRING.
+ * @SINCE_1_1.45
+ * @note Optional. If not supplied, default is Units::OBJECT_BOUNDING_BOX.
+ * @see Units::Type
+ */
+ UNITS,
+
+ /**
+ * @brief Indicates what happens if the gradient starts or ends inside the bounds of the target rectangle.
+ * @details Name "spreadMethod", type SpreadMethod::Type (Property::INTEGER) or Property::STRING.
+ * @SINCE_1_1.45
+ * @note Optional. If not supplied, default is SpreadMethod::PAD.
+ * @see SpreadMethod::Type
+ */
+ SPREAD_METHOD
+};
+
+} // namespace Property
+
+namespace Units
+{
+
+/**
+ * @brief The type of coordinate system for certain attributes of the points in a gradient.
+ *
+ * This applies to the:
+ * - Start (x1, y1) and End (x2 and y2) points of a line if using a linear gradient.
+ * - Center point (cx, cy) and radius (r) of a circle if using a radial gradient.
+ */
+enum Type
+{
+ OBJECT_BOUNDING_BOX, ///< Uses the normals for the start, end & center points, i.e. top-left is (-0.5, -0.5) and bottom-right is (0.5, 0.5). @SINCE_1_1.45
+ USER_SPACE ///< Uses the user coordinates for the start, end & center points, i.e. in a 200 by 200 control, top-left is (0, 0) and bottom-right is (200, 200). @SINCE_1_1.45
+};
+
+} // namespace Units
+
+namespace SpreadMethod
+{
+
+/**
+ * @brief Policies that define what happens if the gradient starts or ends inside the bounds of the target rectangle.
+ */
+enum Type
+{
+ PAD, ///< Uses the terminal colors of the gradient to fill the remainder of the quad. @SINCE_1_1.45
+ REFLECT, ///< Reflect the gradient pattern start-to-end, end-to-start, start-to-end etc. until the quad is filled. @SINCE_1_1.45
+ REPEAT ///< Repeat the gradient pattern start-to-end, start-to-end, start-to-end etc. until the quad is filled. @SINCE_1_1.45
+};
+
+} // namespace SpreadMethod
+
+} // namespace GradientVisual
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_GRADIENT_VISUAL_PROPERTIES_H
--- /dev/null
+#ifndef DALI_TOOLKIT_IMAGE_VISUAL_PROPERTIES_H
+#define DALI_TOOLKIT_IMAGE_VISUAL_PROPERTIES_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace ImageVisual
+{
+
+namespace Property
+{
+
+enum
+{
+ /**
+ * @brief The URL of the image.
+ * @details Name "url", type Property::STRING.
+ * @SINCE_1_1.45
+ * @note Mandatory.
+ */
+ URL = VISUAL_PROPERTY_START_INDEX,
+
+ /**
+ * @brief Fitting options, used when resizing images to fit desired dimensions.
+ * @details Name "fittingMode", type Dali::FittingMode (Property::INTEGER) or Property::STRING.
+ * @SINCE_1_1.45
+ * @note Optional. If not supplied, default is FittingMode::SHRINK_TO_FIT.
+ * @note For Normal Quad images only.
+ * @see Dali::FittingMode
+ */
+ FITTING_MODE,
+
+ /**
+ * @brief Filtering options, used when resizing images to sample original pixels.
+ * @details Name "samplingMode", type Dali::SamplingMode (Property::INTEGER) or Property::STRING.
+ * @SINCE_1_1.45
+ * @note Optional. If not supplied, default is SamplingMode::BOX.
+ * @note For Normal Quad images only.
+ * @see Dali::SamplingMode
+ */
+ SAMPLING_MODE,
+
+ /**
+ * @brief The desired image width.
+ * @details Name "desiredWidth", type Property::INTEGER.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, the actual image width is used.
+ * @note For Normal Quad images only.
+ */
+ DESIRED_WIDTH,
+
+ /**
+ * @brief The desired image height.
+ * @details Name "desiredHeight", type Property::INTEGER.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, the actual image height is used.
+ * @note For Normal Quad images only.
+ */
+ DESIRED_HEIGHT,
+
+ /**
+ * @brief Whether to load the image synchronously.
+ * @details Name "synchronousLoading", type Property::BOOLEAN.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, the default is false, i.e. the image is loaded asynchronously.
+ * @note For Normal Quad images only.
+ */
+ SYNCHRONOUS_LOADING,
+
+ /**
+ * @brief If true, only draws the borders.
+ * @details Name "borderOnly", type Property::BOOLEAN.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, the default is false.
+ * @note For N-Patch images only.
+ */
+ BORDER_ONLY,
+};
+
+} // namespace Property
+
+} // namespace ImageVisual
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_IMAGE_VISUAL_PROPERTIES_H
--- /dev/null
+#ifndef DALI_TOOLKIT_MESH_VISUAL_PROPERTIES_H
+#define DALI_TOOLKIT_MESH_VISUAL_PROPERTIES_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace MeshVisual
+{
+
+namespace Property
+{
+
+enum
+{
+ /**
+ * @brief The location of the ".obj" file.
+ * @details Name "objectUrl", type Property::STRING.
+ * @SINCE_1_1.45
+ * @note Mandatory.
+ */
+ OBJECT_URL = VISUAL_PROPERTY_START_INDEX,
+
+ /**
+ * @brief The location of the ".mtl" file.
+ * @details Name "materialUrl", type Property::STRING.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, then a textureless object is assumed.
+ */
+ MATERIAL_URL,
+
+ /**
+ * @brief Path to the directory the textures (including gloss and normal) are stored in.
+ * @details Name "texturesPath", type Property::STRING.
+ * @SINCE_1_1.45
+ * @note Mandatory if using material.
+ */
+ TEXTURES_PATH,
+
+ /**
+ * @brief Sets the type of shading mode that the mesh will use.
+ * @details Name "shadingMode", type ShadingMode::Value (Property::INTEGER) or Property::STRING.
+ * If anything the specified shading mode requires is missing, a simpler mode that can be handled with what has been supplied will be used instead.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, it will use the best it can support (will try ShadingMode::TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING first).
+ * @see ShadingMode::Value
+ */
+ SHADING_MODE,
+
+ /**
+ * @brief Whether to use mipmaps for textures or not.
+ * @details Name "useMipmapping", type Property::BOOLEAN.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, the default is true.
+ */
+ USE_MIPMAPPING,
+
+ /**
+ * @brief Whether to average normals at each point to smooth textures or not.
+ * @details Name "useSoftNormals", type Property::BOOLEAN.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, the default is true.
+ */
+ USE_SOFT_NORMALS,
+
+ /**
+ * @brief The position, in stage space, of the point light that applies lighting to the model.
+ * @details Name "lightPosition", type Property::VECTOR3.
+ * This is based off the stage's dimensions, so using the width and height of the stage halved will correspond to the center,
+ * and using all zeroes will place the light at the top left corner.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, the default is an offset outwards from the center of the screen.
+ */
+ LIGHT_POSITION,
+};
+
+} // namespace Property
+
+namespace ShadingMode
+{
+
+enum Value
+{
+ TEXTURELESS_WITH_DIFFUSE_LIGHTING, ///< *Simplest*. One color that is lit by ambient and diffuse lighting. @SINCE_1_1.45
+ TEXTURED_WITH_SPECULAR_LIGHTING, ///< Uses only the visual image textures provided with specular lighting in addition to ambient and diffuse lighting. @SINCE_1_1.45
+ TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING ///< Uses all textures provided including a gloss, normal and texture map along with specular, ambient and diffuse lighting. @SINCE_1_1.45
+};
+
+} // namespace ShadingMode
+
+} // namespace MeshVisual
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_MESH_VISUAL_PROPERTIES_H
--- /dev/null
+#ifndef DALI_TOOLKIT_PRIMITIVE_VISUAL_PROPERTIES_H
+#define DALI_TOOLKIT_PRIMITIVE_VISUAL_PROPERTIES_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace PrimitiveVisual
+{
+
+namespace Property
+{
+
+enum
+{
+ /**
+ * @brief The specific shape to render.
+ * @details Name "shape", type Shape::Type (Property::INTEGER) or Property::STRING.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, the default is Shape::SPHERE.
+ * @see Shape::Type
+ */
+ SHAPE = VISUAL_PROPERTY_START_INDEX,
+
+ /**
+ * @brief The color of the shape.
+ * @details Name "shapeColor", type Property::VECTOR4.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, the default is Vector4(0.5, 0.5, 0.5, 1.0).
+ * @note Applies to ALL shapes.
+ */
+ COLOR,
+
+ /**
+ * @brief The number of slices as you go around the shape.
+ * @details Name "slices", type Property::INTEGER.
+ * For spheres and conical frustrums, this determines how many divisions there are as you go around the object.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, the default is 128.
+ * @note Applies to:
+ * - Shape::SPHERE
+ * - Shape::CONICAL_FRUSTRUM
+ * - Shape::CONE
+ * - Shape::CYLINDER
+ * @note The range is from 1 to 255.
+ */
+ SLICES,
+
+ /**
+ * @brief The number of stacks as you go down the shape.
+ * @details Name "stacks", type Property::INTEGER.
+ * For spheres, 'stacks' determines how many layers there are as you go down the object.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, the default is 128.
+ * @note Applies to:
+ * - Shape::SPHERE
+ * @note The range is from 1 to 255.
+ */
+ STACKS,
+
+ /**
+ * @brief The scale of the radius of the top circle of a conical frustrum.
+ * @details Name "scaleTopRadius", type Property::FLOAT.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, the default is 1.0f.
+ * @note Applies to:
+ * - Shape::CONICAL_FRUSTRUM
+ * @note Only values greater than or equal to 0.0f are accepted.
+ */
+ SCALE_TOP_RADIUS,
+
+ /**
+ * @brief The scale of the radius of the bottom circle of a conical frustrum.
+ * @details Name "scaleBottomRadius", type Property::FLOAT.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, the default is 1.5f.
+ * @note Applies to:
+ * - Shape::CONICAL_FRUSTRUM
+ * - Shape::CONE
+ * @note Only values greater than or equal to 0.0f are accepted.
+ */
+ SCALE_BOTTOM_RADIUS,
+
+ /**
+ * @brief The scale of the height of a conic.
+ * @details Name "scaleHeight", type Property::FLOAT.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, the default is 3.0f.
+ * @note Applies to:
+ * - Shape::CONICAL_FRUSTRUM
+ * - Shape::CONE
+ * - Shape::CYLINDER
+ * @note Only values greater than or equal to 0.0f are accepted.
+ */
+ SCALE_HEIGHT,
+
+ /**
+ * @brief The scale of the radius of a cylinder.
+ * @details Name "scaleRadius", type Property::FLOAT.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, the default is 1.0f.
+ * @note Applies to:
+ * - Shape::CYLINDER
+ * @note Only values greater than or equal to 0.0f are accepted.
+ */
+ SCALE_RADIUS,
+
+ /**
+ * @brief The dimensions of a cuboid. Scales in the same fashion as a 9-patch image.
+ * @details Name "scaleDimensions", type Property::VECTOR3.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, the default is Vector3::ONE.
+ * @note Applies to:
+ * - Shape::CUBE
+ * - Shape::OCTAHEDRON
+ * - Shape::BEVELLED_CUBE
+ * @note Each vector3 parameter should be greater than or equal to 0.0f.
+ */
+ SCALE_DIMENSIONS,
+
+ /**
+ * @brief Determines how bevelled the cuboid should be, based off the smallest dimension.
+ * @details Name "bevelPercentage", type Property::FLOAT.
+ * Bevel percentage ranges from 0.0 to 1.0. It affects the ratio of the outer face widths to the width of the overall cube.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, the default is 0.0f (no bevel).
+ * @note Applies to:
+ * - Shape::BEVELLED_CUBE
+ * @note The range is from 0.0f to 1.0f.
+ */
+ BEVEL_PERCENTAGE,
+
+ /**
+ * @brief Defines how smooth the bevelled edges should be.
+ * @details Name "bevelSmoothness", type Property::FLOAT.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, the default is 0.0f (sharp edges).
+ * @note Applies to:
+ * - Shape::BEVELLED_CUBE
+ * @note The range is from 0.0f to 1.0f.
+ */
+ BEVEL_SMOOTHNESS,
+
+ /**
+ * @brief The position, in stage space, of the point light that applies lighting to the model.
+ * @details Name "lightPosition", type Property::VECTOR3.
+ * This is based off the stage's dimensions, so using the width and height of the stage halved will correspond to the center,
+ * and using all zeroes will place the light at the top left corner.
+ * @SINCE_1_1.45
+ * @note Optional. If not specified, the default is an offset outwards from the center of the screen.
+ * @note Applies to ALL shapes.
+ */
+ LIGHT_POSITION,
+};
+
+} // namespace Property
+
+namespace Shape
+{
+
+/**
+ * @brief The primitive shape to render.
+ */
+enum Type
+{
+ SPHERE, ///< A perfectly round geometrical object in three-dimensional space. @SINCE_1_1.45
+ CONICAL_FRUSTRUM, ///< The area bound between two circles, i.e. a cone with the tip removed. @SINCE_1_1.45
+ CONE, ///< Equivalent to a conical frustrum with top radius of zero. @SINCE_1_1.45
+ CYLINDER, ///< Equivalent to a conical frustrum with equal radii for the top and bottom circles. @SINCE_1_1.45
+ CUBE, ///< Equivalent to a bevelled cube with a bevel percentage of zero. @SINCE_1_1.45
+ OCTAHEDRON, ///< Equivalent to a bevelled cube with a bevel percentage of one. @SINCE_1_1.45
+ BEVELLED_CUBE, ///< A cube/cuboid with all edges flattened to some degree. @SINCE_1_1.45
+};
+}
+
+} // namespace PrimitiveVisual
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_PRIMITIVE_VISUAL_PROPERTIES_H
--- /dev/null
+#ifndef DALI_TOOLKIT_VISUAL_PROPERTIES_H
+#define DALI_TOOLKIT_VISUAL_PROPERTIES_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/toolkit-property-index-ranges.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Visual
+{
+
+/**
+ * @brief All the visual types.
+ * @SINCE_1_1.45
+ */
+enum Type
+{
+ BORDER, ///< Renders a solid color as an internal border to the control's quad. @SINCE_1_1.45
+ COLOR, ///< Renders a solid color to the control's quad. @SINCE_1_1.45
+ GRADIENT, ///< Renders a smooth transition of colors to the control's quad. @SINCE_1_1.45
+ IMAGE, ///< Renders an image into the control's quad. @SINCE_1_1.45
+ MESH, ///< Renders a mesh using an "obj" file, optionally with textures provided by an "mtl" file. @SINCE_1_1.45
+ PRIMITIVE, ///< Renders a simple 3D shape, such as a cube or sphere. @SINCE_1_1.45
+ DEBUG, ///< Renders a simple wire-frame outlining a quad. @SINCE_1_1.45
+};
+
+namespace Property
+{
+
+enum
+{
+ /**
+ * @brief The index for the visual type.
+ * @details Name "visualType", type [Type](@ref Dali::Toolkit::Visual::Type) (Property::INTEGER) or Property::STRING.
+ * @SINCE_1_1.45
+ * @note Mandatory.
+ * @see Type
+ */
+ TYPE = VISUAL_PROPERTY_BASE_START_INDEX,
+
+ /**
+ * @brief The shader to use in the visual.
+ * @details Name "shader", type Property::Map.
+ * @SINCE_1_1.45
+ * @note Optional.
+ * @note Will override the existing shaders.
+ * @see Shader::Property
+ */
+ SHADER
+};
+
+} // namespace Property
+
+namespace Shader
+{
+
+namespace Property
+{
+
+enum
+{
+ /**
+ * @brief The vertex shader.
+ * @details Name "vertexShader", type Property::STRING.
+ * @SINCE_1_1.45
+ * @note Optional
+ * @note If not supplied, the visual's already set vertex shader is used.
+ */
+ VERTEX_SHADER,
+
+ /**
+ * @brief The fragment shader.
+ * @details Name "fragmentShader", type Property::STRING.
+ * @SINCE_1_1.45
+ * @note Optional
+ * @note If not supplied, the visual's already set fragment shader is used.
+ */
+ FRAGMENT_SHADER,
+
+ /**
+ * @brief How to subdivide the grid along the X-Axis.
+ * @details Name "subdivideGridX", type Property::INTEGER.
+ * @SINCE_1_1.45
+ * @note Optional
+ * @note If not supplied, the default is 1.
+ * @note Value should be greater than or equal to 1.
+ */
+ SUBDIVIDE_GRID_X,
+
+ /**
+ * @brief How to subdivide the grid along the Y-Axis.
+ * @details Name "subdivideGridY", type Property::INTEGER.
+ * @SINCE_1_1.45
+ * @note Optional
+ * @note If not supplied, the default is 1.
+ * @note Value should be greater than or equal to 1.
+ */
+ SUBDIVIDE_GRID_Y,
+
+ /**
+ * @brief Hints for rendering.
+ * @details Name "hints", type Dali::Shader::Hint (Property::INTEGER), Property::STRING or Property::ARRAY of Property::STRING.
+ * @SINCE_1_1.45
+ * @note Optional
+ * @note If not supplied, the default is Dali::Shader::Hint::NONE.
+ */
+ HINTS,
+};
+
+} // namespace Property
+
+} // namespace Shader
+
+} // namespace Visual
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_VISUAL_PROPERTIES_H
"popupIconColor":[1.0,1.0,1.0,1.0],
"popupPressedColor":[0.24,0.72,0.8,0.11],
"background": {
- "rendererType": "IMAGE",
+ "visualType": "IMAGE",
"url": "{DALI_IMAGE_DIR}selection-popup-bg.9.png"
},
"popupFadeInDuration":0.25,
"popupIconColor":[1.0,1.0,1.0,1.0],
"popupPressedColor":[0.24,0.72,0.8,0.11],
"background": {
- "rendererType": "IMAGE",
+ "visualType": "IMAGE",
"url": "{DALI_IMAGE_DIR}selection-popup-bg.9.png"
},
"popupFadeInDuration":0.25,
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// Set another property to set the image-map
Property::Map imageMap;
- imageMap[ "rendererType" ] = "IMAGE";
- imageMap[ "url" ] = IMAGE_CARDS;
- imageMap[ "desiredWidth" ] = 100;
- imageMap[ "desiredHeight" ] = 100;
+ imageMap[ Visual::Property::TYPE ] = Visual::IMAGE;
+ imageMap[ ImageVisual::Property::URL ] = IMAGE_CARDS;
+ imageMap[ ImageVisual::Property::DESIRED_WIDTH ] = 100;
+ imageMap[ ImageVisual::Property::DESIRED_HEIGHT ] = 100;
mImageView.SetProperty( ImageView::Property::IMAGE, imageMap );
// Add the image view to the stage
The background can be set to use a specified visual, e.g the border visual
@code
Property::Map visual;
-visual.Insert("rendererType","BORDER");
-visual.Insert("borderColor",COLOR::RED);
-visual.Insert("borderSize",20.f);
+visual.Insert( Visual::Property::Type,Visual::BORDER );
+visual.Insert( BorderVisual::Property::COLOR, COLOR::RED );
+visual.Insert( BorderVisual::Property::SIZE, 20.f );
control.SetProperty( Control::Property::BACKGROUND, visual);
@endcode
* @endcode
*
* <h3 class="pg">The IMAGE property</h3>
- * the IMAGE property allows you to change many aspects of the image that is renderered.
+ * the IMAGE property allows you to change many aspects of the image that is rendered.
* This property can either be a string for a image url path or a Property::Map that specifies
* the image in more detail.
*
- * <h3 class="pg">Renderers</h3>
+ * <h3 class="pg">Visuals</h3>
* You can specify a specific visual instead of using the default Image Visual, e.g to use the Border Visual.
*
* @code
* Property::Map visual;
- * visual.Insert("rendererType","BORDER");
- * visual.Insert("borderColor",COLOR::RED);
- * visual.Insert("borderSize",20.f);
+ * visual.Insert( Visual::Property::Type,Visual::BORDER );
+ * visual.Insert( BorderVisual::Property::COLOR, COLOR::RED );
+ * visual.Insert( BorderVisual::Property::SIZE, 20.f );
*
* Dali::Toolkit::ImageView myImageView = Dali::Toolkit::ImageView::New();
- * myImageView.SetProperty( Control::Property::IMAGE, visual);
+ * myImageView.SetProperty( Control::Property::IMAGE, visual );
* @endcode
* <h3 class="pg">Resizing at Load Time</h3>
// Set an image view property
imageView.image = {
- "rendererType" : "IMAGE",
+ "visualType" : "IMAGE",
"url": "images/icon-0.png",
"desiredWidth" : 100,
"desiredHeight" : 100
"position": [0, 0, 0],
"image":
{
- "rendererType" : "IMAGE",
+ "visualType" : "IMAGE",
"url" : "images/icon-0.png",
"desiredWidth" : 100,
"desiredHeight" : 100
To render content, the required actors can be created and added to the control itself as its children.
However, this solution is not fully optimised and means extra actors will be added, and thus, need to be processed by DALi.
-Controls should be as generic as possible so the recommendation is to re-use control renderers to create the content required as described in the [Visuals](@ref visuals) section.
+Controls should be as generic as possible so the recommendation is to re-use visuals to create the content required as described in the [Visuals](@ref visuals) section.
Currently, this is devel-api though, so is subject to change.
![ ](../assets/img/creating-custom-controls/rendering.png)
// C++
void MyUIControlImpl::OnInitialize()
{
- // Create renderers, register events etc.
+ // Create visuals, register events etc.
}
~~~
___________________________________________________________________________________________________
<!--
/**-->
-# Debug Renderer {#debugvisual}
+# Debug Visual {#debugvisual}
## Enable debug rendering
-Setting DALI_DEBUG_RENDERING environment variable will enable the renderer debuging.
+Setting DALI_DEBUG_RENDERING environment variable will enable the visual debuging.
Then, every concrete visual ( ColorVisual, BorderVisual, ImageVisual, GradientVisual, etc. ) is replaced with a DebugVisual object.
Debug visual renders a simple quad wireframe, so that the control layout and scene structure is clearly displayed.
+ [Mesh](@ref mesh-visual)
+ [Primitive](@ref primitive-visual)
-Controls can provide properties that allow users to specify the visual type ( rendererType ).
+Controls can provide properties that allow users to specify the visual type ( visualType ).
Setting visual properties are done via a property map.
-The **rendererType** field in the property map specifies the visual to use/create.
+The **visualType** field in the property map specifies the visual to use/create.
This is required to avoid ambiguity as multiple visuals may be capable of rendering the same contents.
___________________________________________________________________________________________________
### Properties Supported
-**RendererType:** "COLOR"
+**VisualType:** Dali::Toolkit::Visual::COLOR, "COLOR"
-| Property Name | Type | Required | Description |
-|---------------|:-------:|:--------:|---------------------------|
-| mixColor | VECTOR4 | Yes | The solid color required. |
+| Property | String | Type | Required | Description |
+|-------------------------------------------------|----------|:-------:|:--------:|---------------------------|
+| Dali::Toolkit::ColorVisual::Property::MIX_COLOR | mixColor | VECTOR4 | Yes | The solid color required. |
### Usage
Dali::Toolkit::Control control = Dali::Toolkit::Control::New();
Dali::Property::Map map;
-map[ "rendererType" ] = "COLOR";
-map[ "mixColor" ] = Color::RED;
+map[ Visual::Property::TYPE ] = Dali::Toolkit::Visual::COLOR;
+map[ ColorVisual::Property::MIX_COLOR ] = Color::RED;
-control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
+control.SetProperty( Control::Property::BACKGROUND, map );
~~~
~~~{.js}
control.background =
{
- rendererType : "COLOR",
+ visualType : "COLOR",
mixColor : dali.COLOR_RED
};
~~~
### Properties Supported
-**RendererType:** "GRADIENT"
+**VisualType:** Dali::Toolkit::Visual::GRADIENT, "GRADIENT"
-| 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. |
-| [units](@ref gradient-visual-units) | STRING | No | *OBJECT_BOUNDING_BOX* or *USER_SPACE*. Default: *OBJECT_BOUNDING_BOX*. |
-| [spreadMethod](@ref gradient-visual-spread-method) | STRING | No | *PAD*, *REFLECT* or *REPEAT*. Default: *PAD*. |
+| Property | String | Type | Required | Description |
+|---------------------------------------------------------|---------------|:-----------------:|:----------:|------------------------------------------------------------------------------------------------------------------|
+| Dali::Toolkit::GradientVisual::Property::START_POSITION | startPosition | VECTOR2 | For Linear | The start position of the linear gradient. |
+| Dali::Toolkit::GradientVisual::Property::END_POSITION | endPosition | VECTOR2 | For Linear | The end position of the linear gradient. |
+| Dali::Toolkit::GradientVisual::Property::CENTER | center | VECTOR2 | For Radial | The center point of the gradient. |
+| Dali::Toolkit::GradientVisual::Property::RADIUS | radius | FLOAT | For Radial | The size of the radius. |
+| Dali::Toolkit::GradientVisual::Property::STOP_OFFSET | stopOffset | ARRAY of FLOAT | No | All the stop offsets. If not supplied default is 0.0 and 1.0. |
+| Dali::Toolkit::GradientVisual::Property::STOP_COLOR | stopColor | ARRAY of VECTOR4 | Yes | The color at those stop offsets. At least 2 required to show a gradient. |
+| Dali::Toolkit::GradientVisual::Property::UNITS | units | INTEGER or STRING | No | Defines the coordinate system. [More info](@ref gradient-visual-units) |
+| Dali::Toolkit::GradientVisual::Property::SPREAD_METHOD | spreadMethod | INTEGER or STRING | No | Indicates what happens if gradient starts or ends inside bounds. [More info](@ref gradient-visual-spread-method) |
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.
+ Start (x1, y1) and End (x2 and y2) points of a line if using a linear gradient.
+ Center point (cx, cy) and radius (r) of a circle if using a radial gradient.
-| Value | Description |
-|---------------------|------------------------------------------------------------------------------------------------------------------------------------------------|
-| OBJECT_BOUNDING_BOX | *Default*. Uses the normals for the start, end & center points, i.e. top-left is (-0.5, -0.5) and bottom-right is (0.5, 0.5). |
-| USER_SPACE | Uses the user coordinates for the start, end & center points, i.e. in a 200 by 200 control, top-left is (0, 0) and bottom-right is (200, 200). |
+| Enumeration | String | Description |
+|-----------------------------------------------------------|---------------------|------------------------------------------------------------------------------------------------------------------------------------------------|
+| Dali::Toolkit::GradientVisual::Units::OBJECT_BOUNDING_BOX | OBJECT_BOUNDING_BOX | *Default*. Uses the normals for the start, end & center points, i.e. top-left is (-0.5, -0.5) and bottom-right is (0.5, 0.5). |
+| Dali::Toolkit::GradientVisual::Units::USER_SPACE | USER_SPACE | Uses the user coordinates for the start, end & center points, i.e. in a 200 by 200 control, top-left is (0, 0) and bottom-right is (200, 200). |
### Spread Method {#gradient-visual-spread-method}
Indicates what happens if the gradient starts or ends inside the bounds of the target rectangle.
-| Value | Description |
-|---------|------------------------------------------------------------------------------------------------------|
-| PAD | *Default*. Uses the terminal colors of the gradient to fill the remainder of the quad. |
-| REFLECT | Reflect the gradient pattern start-to-end, end-to-start, start-to-end etc. until the quad is filled. |
-| REPEAT | Repeat the gradient pattern start-to-end, start-to-end, start-to-end etc. until the quad is filled. |
+| Enumeration | String | Description |
+|------------------------------------------------------|---------|------------------------------------------------------------------------------------------------------|
+| Dali::Toolkit::GradientVisual::SpreadMethod::PAD | PAD | *Default*. Uses the terminal colors of the gradient to fill the remainder of the quad. |
+| Dali::Toolkit::GradientVisual::SpreadMethod::REFLECT | REFLECT | Reflect the gradient pattern start-to-end, end-to-start, start-to-end etc. until the quad is filled. |
+| Dali::Toolkit::GradientVisual::SpreadMethod::REPEAT | REPEAT | Repeat the gradient pattern start-to-end, start-to-end, start-to-end etc. until the quad is filled. |
### Usage
Dali::Toolkit::Control control = Dali::Toolkit::Control::New();
Dali::Property::Map map;
-map[ "rendererType" ] = "GRADIENT";
-map[ "startPosition" ] = Vector2( 0.5f, 0.5f );
-map[ "endPosition" ] = Vector2( -0.5f, -0.5f );
+map[ Visual::Property::TYPE ] = Dali::Toolkit::Visual::GRADIENT;
+map[ GradientVisual::Property::START_POSITION ] = Vector2( 0.5f, 0.5f );
+map[ GradientVisual::Property::END_POSITION ] = 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[ "stopOffset" ] = stopOffsets;
+map[ GradientVisual::Property::STOP_OFFSET ] = 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[ "stopColor" ] = stopColors;
+map[ GradientVisual::Property::STOP_COLOR ] = stopColors;
-control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
+control.SetProperty( Control::Property::BACKGROUND, map );
~~~
~~~{.js}
control.background =
{
- rendererType : "GRADIENT",
+ visualType : "GRADIENT",
startPosition : [ 0.5, 0.5 ],
endPosition : [ -0.5, -0.5 ],
stopOffset : [ 0.0, 0.3, 0.6, 0.8, 1.0 ],
Dali::Toolkit::Control control = Dali::Toolkit::Control::New();
Dali::Property::Map map;
-map[ "rendererType" ] = "GRADIENT";
-map[ "center" ] = Vector2( 0.5f, 0.5f );
-map[ "radius" ] = 1.414f;
+map[ Visual::Property::TYPE ] = Dali::Toolkit::Visual::GRADIENT;
+map[ GradientVisual::Property::CENTER ] = Vector2( 0.5f, 0.5f );
+map[ GradientVisual::Property::RADIUS ] = 1.414f;
Dali::Property::Array stopOffsets;
stopOffsets.PushBack( 0.0f );
stopOffsets.PushBack( 0.6f );
stopOffsets.PushBack( 0.8f );
stopOffsets.PushBack( 1.f );
-map[ "stopOffset" ] = stopOffsets;
+map[ GradientVisual::Property::STOP_OFFSET ] = 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[ "stopColor" ] = stopColors;
+map[ GradientVisual::Property::STOP_COLOR ] = stopColors;
-control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
+control.SetProperty( Control::Property::BACKGROUND, map );
~~~
~~~{.js}
control.background =
{
- rendererType : "GRADIENT",
+ visualType : "GRADIENT",
center : [ 0.5, 0.5 ],
radius : 1.414,
stopOffset : [ 0.0, 0.3, 0.6, 0.8, 1.0 ],
Depending on the extension of the image, a different visual is provided to render the image onto the screen.
- + [Normal](@ref image-visual)
+ + [Normal (Quad)](@ref image-visual)
+ [N-Patch](@ref n-patch-visual)
+ [SVG](@ref svg-visual)
#### Properties Supported
-**RendererType:** "IMAGE"
+**VisualType:** Dali::Toolkit::Visual::IMAGE, "IMAGE"
-| Property Name | Type | Required | Description |
-|------------------------------------------------------|:--------:|:--------:|----------------------------------------------------------------------------------------------------------------|
-| url | STRING | Yes | The URL of the image. |
-| [fittingMode](@ref resourceimagescaling-fittingmode) | STRING | No | *SHRINK_TO_FIT*, *SCALE_TO_FILL*, *FIT_WIDTH* or *FIT_HEIGHT*. Default: *SHRINK_TO_FIT*. |
-| [samplingMode](@ref resourceimagescaling-scaling) | STRING | No | *BOX*, *NEAREST*, *LINEAR*, *BOX_THEN_NEAREST*, *BOX_THEN_LINEAR*, *NO_FILTER* or *DONT_CARE*. Default: *BOX*. |
-| desiredWidth | INT | No | The desired image width. Will use actual image width if not specified. |
-| desiredHeight | INT | No | The desired image height. Will use actual image height if not specified. |
+| Property | String | Type | Required | Description |
+|------------------------------------------------------|---------------|:-----------------:|:--------:|--------------------------------------------------------------------------------------------------------------------------|
+| Dali::Toolkit::ImageVisual::Property::URL | url | STRING | Yes | The URL of the image. |
+| Dali::Toolkit::ImageVisual::Property::FITTING_MODE | fittingMode | INTEGER or STRING | No | Fitting options, used when resizing images to fit desired dimensions. [More info](@ref resourceimagescaling-fittingmode) |
+| Dali::Toolkit::ImageVisual::Property::SAMPLING_MODE | samplingMode | INTEGER or STRING | No | Filtering options, used when resizing images to sample original pixels. [More info](@ref resourceimagescaling-scaling) |
+| Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH | desiredWidth | INT | No | The desired image width. Will use actual image width if not specified. |
+| Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT | desiredHeight | INT | No | The desired image height. Will use actual image height if not specified. |
#### Usage
Dali::Toolkit::Control control = Dali::Toolkit::Control::New();
Dali::Property::Map map;
-map[ "rendererType" ] = "IMAGE";
-map[ "url" ] = "path-to-image.jpg";
+map[ Visual::Property::TYPE ] = Dali::Toolkit::Visual::IMAGE;
+map[ ImageVisual::Property::URL ] = "path-to-image.jpg";
-control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
+control.SetProperty( Control::Property::BACKGROUND, map );
~~~
~~~{.js}
control.background =
{
- rendererType : "IMAGE",
+ visualType : "IMAGE",
url : "path-to-image.jpg"
};
~~~
#### Properties Supported
-**RendererType:** "IMAGE"
+**VisualType:** Dali::Toolkit::Visual::IMAGE, "IMAGE"
-| Property Name | Type | Required | Description |
-|---------------|:-------:|:--------:|----------------------------------|
-| url | STRING | Yes | The URL of the n-patch image. |
-| borderOnly | BOOLEAN | No | If true, only draws the borders. |
+| Property | String | Type | Required | Description |
+|---------------------------------------------------|---------------|:-------:|:--------:|----------------------------------|
+| Dali::Toolkit::ImageVisual::Property::URL | url | STRING | Yes | The URL of the n-patch image. |
+| Dali::Toolkit::ImageVisual::Property::BORDER_ONLY | borderOnly | BOOLEAN | No | If true, only draws the borders. |
#### Usage
Dali::Property::Map map;
-map[ "rendererType" ] = "IMAGE";
-map[ "url" ] = "path-to-image.9.png";
+map[ Visual::Property::TYPE ] = Dali::Toolkit::Visual::IMAGE;
+map[ Dali::Toolkit::ImageVisual::Property::URL ] = "path-to-image.9.png";
-control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
+control.SetProperty( Control::Property::BACKGROUND, map );
~~~
~~~{.js}
control.background =
{
- rendererType : "IMAGE",
+ visualType : "IMAGE",
url : "path-to-image.9.png"
};
~~~
#### Properties Supported
-**RendererType:** "IMAGE"
+**VisualType:** Dali::Toolkit::Visual::IMAGE, "IMAGE"
-| Property Name | Type | Required | Description |
-|---------------|:-------:|:--------:|----------------------------------|
-| url | STRING | Yes | The URL of the SVG image. |
+| Property | String | Type | Required | Description |
+|-------------------------------------------|--------|:-------:|:--------:|----------------------------------|
+| Dali::Toolkit::ImageVisual::Property::URL | url | STRING | Yes | The URL of the SVG image. |
#### Usage
Dali::Property::Map map;
-map[ "rendererType" ] = "IMAGE";
-map[ "url" ] = "path-to-image.svg";
+map[ Visual::Property::TYPE ] = Dali::Toolkit::Visual::IMAGE;
+map[ Dali::Toolkit::ImageVisual::Property::URL ] = "path-to-image.svg";
control.SetSize( 200.f, 200.f );
-control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
+control.SetProperty( Control::Property::BACKGROUND, map );
~~~
~~~{.js}
control.background =
{
- rendererType : "IMAGE",
+ visualType : "IMAGE",
url : "path-to-image.svg"
};
~~~
### Properties Supported
-**RendererType:** "BORDER"
+**VisualType:** Dali::Toolkit::Visual::BORDER, "BORDER"
-| Property Name | Type | Required | Description |
-|---------------|:-------:|:--------:|--------------------------------------------------|
-| borderColor | VECTOR4 | Yes | The color of the border. |
-| borderSize | FLOAT | Yes | The width of the border (in pixels). |
-| antiAliasing | BOOLEAN | No | Whether anti-aliasing of the border is required. |
+| Property | String | Type | Required | Description |
+|------------------------------------------------------|---------------|:-------:|:--------:|--------------------------------------------------|
+| Dali::Toolkit::BorderVisual::Property::COLOR | borderColor | VECTOR4 | Yes | The color of the border. |
+| Dali::Toolkit::BorderVisual::Property::SIZE | borderSize | FLOAT | Yes | The width of the border (in pixels). |
+| Dali::Toolkit::BorderVisual::Property::ANTI_ALIASING | antiAliasing | BOOLEAN | No | Whether anti-aliasing of the border is required. |
### Usage
Dali::Property::Map map;
-map[ "rendererType" ] = "BORDER";
-map[ "borderColor" ] = Color::BLUE;
-map[ "borderSize" ] = 5.0f;
+map[ Visual::Property::TYPE ] = Dali::Toolkit::Visual::BORDER;
+map[ BorderVisual::Property::COLOR ] = Color::BLUE;
+map[ BorderVisual::Property::SIZE ] = 5.0f;
-control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
+control.SetProperty( Control::Property::BACKGROUND, map );
~~~
~~~{.js}
control.background =
{
- rendererType : "BORDER",
+ visualType : "BORDER",
borderColor : dali.COLOR_BLUE,
borderSize = 5
};
## Mesh Visual {#mesh-visual}
Renders a mesh using a .obj file, optionally with textures provided by a mtl file. Scaled to fit the control.
-
+
![ ](../assets/img/visuals/mesh-visual.png)
![ ](visuals/mesh-visual.png)
-
+
### Properties Supported
+
+**VisualType:** Dali::Toolkit::Visual::MESH, "MESH"
+
+| Property | String | Type | Required | Description |
+|-------------------------------------------------------|----------------|:------------------:|:-----------------:|--------------------------------------------------------------------------------------------------|
+| Dali::Toolkit::MeshVisual::Property::OBJECT_URL | objectUrl | STRING | Yes | The location of the ".obj" file. |
+| Dali::Toolkit::MeshVisual::Property::MATERIAL_URL | materialUrl | STRING | No | The location of the ".mtl" file. Leave blank for a textureless object. |
+| Dali::Toolkit::MeshVisual::Property::TEXTURES_PATH | texturesPath | STRING | If using material | Path to the directory the textures (including gloss and normal) are stored in. |
+| Dali::Toolkit::MeshVisual::Property::SHADING_MODE | shadingMode | INTEGER or STRING | No | Sets the type of shading mode that the mesh will use. [More info](@ref mesh-visual-shading-mode) |
+| Dali::Toolkit::MeshVisual::Property::USE_MIPMAPPING | useMipmapping | BOOLEAN | No | Flag for whether to use mipmaps for textures or not. Default true. |
+| Dali::Toolkit::MeshVisual::Property::USE_SOFT_NORMALS | useSoftNormals | BOOLEAN | No | Flag for whether to average normals at each point to smooth textures or not. Default true. |
+| Dali::Toolkit::MeshVisual::Property::LIGHT_POSITION | lightPosition | VECTOR3 | No | The position, in stage space, of the point light that applies lighting to the model. |
+
+### Shading Mode {#mesh-visual-shading-mode}
-**RendererType** "MESH"
-
-| Property Name | Type | Required | Description |
-|----------------------------------------------|:-------:|:------------------:|--------------------------------------------------------------------------------------------|
-| objectUrl | STRING | Yes | The location of the ".obj" file. |
-| materialUrl | STRING | No | The location of the ".mtl" file. Leave blank for a textureless object. |
-| texturesPath | STRING | If using material | Path to the directory the textures (including gloss and normal) are stored in. |
-| [shaderType](@ref mesh-visual-shader-type) | STRING | No | Sets the type of shader to be used with the mesh. |
-| useMipmapping | BOOLEAN | No | Flag for whether to use mipmaps for textures or not. Default true. |
-| useSoftNormals | BOOLEAN | No | Flag for whether to average normals at each point to smooth textures or not. Default true. |
-| lightPosition | VECTOR3 | No | The position, in stage space, of the point light that applies lighting to the model. This is based off the stage's dimensions, so using the width and height of the stage halved will correspond to the center, and using all zeroes will place the light at the top left. Note that this corresponds to a shader property, so it can be registered and set in the actor as well. |
-
-
-### Shader Type {#mesh-visual-shader-type}
-
-When specifying the shader type, if anything the shader requires is missing, a simpler type that can be handled with what has been supplied will be used instead.
+When specifying the shading mode, if anything the mode requires is missing, a simpler mode that can be handled with what has been supplied will be used instead.
**Possible values:**
-| String Value | Description |
-|-----------------|------------------------------------------------|
-| TEXTURELESS | *Simplest*. A flat color with shading is used. |
-| DIFFUSE_TEXTURE | Textured. |
-| ALL_TEXTURES | Has a gloss, normal map and texture map. |
+| Enumeration | String | Description |
+|---------------------------------------------------------------------------------|------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|
+| Dali::Toolkit::MeshVisual::ShaderType::TEXTURELESS_WITH_DIFFUSE_LIGHTING | TEXTURELESS_WITH_DIFFUSE_LIGHTING | *Simplest*. One color that is lit by ambient and diffuse lighting. |
+| Dali::Toolkit::MeshVisual::ShaderType::TEXTURED_WITH_SPECULAR_LIGHTING | TEXTURED_WITH_SPECULAR_LIGHTING | Uses only the visual image textures provided with specular lighting in addition to ambient and diffuse lighting. |
+| Dali::Toolkit::MeshVisual::ShaderType::TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING | TEXTURED_WITH_DETAILED_SPECULAR_LIGHTING | Uses all textures provided including a gloss, normal and texture map along with specular, ambient and diffuse lighting. |
### Usage
Dali::Property::Map map;
-map[ "rendererType" ] = "MESH";
-map[ "objectUrl" ] = "home/models/Dino.obj";
-map[ "materialUrl" ] = "home/models/Dino.mtl";
-map[ "texturesPath" ] = "home/images/";
+map[ Visual::Property::TYPE ] = Dali::Toolkit::Visual::MESH;
+map[ MeshVisual::Property::OBJECT_URL ] = "home/models/Dino.obj";
+map[ MeshVisual::Property::MATERIAL_URL ] = "home/models/Dino.mtl";
+map[ MeshVisual::Property::TEXTURES_PATH ] = "home/images/";
-control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
+control.SetProperty( Control::Property::BACKGROUND, map );
~~~
___________________________________________________________________________________________________
![ ](../assets/img/visuals/cube.png)
![ ](visuals/cube.png)
-
+
### Properties Supported
-**RendererType** "PRIMITIVE"
-
-| Property Name | Type | Description | Default Value | Range |
-|---------------------------------------|:-------:|---------------------------------------------------------------------------------|:--------------------:|:------------------------------:|
-| [shape](@ref shape-details) | STRING | The specific shape to render. | "SPHERE" | [See list](@ref shape-details) |
-| shapeColor | VECTOR4 | The color of the shape. | (0.5, 0.5, 0.5, 1.0) | 0.0 - 1.0 for each |
-| [slices](@ref slices-details) | INT | The number of slices as you go around the shape. | 128 | 1 - 255 |
-| [stacks](@ref stacks-details) | INT | The number of stacks as you go down the shape. | 128 | 1 - 255 |
-| scaleTopRadius | FLOAT | The scale of the radius of the top circle of a conical frustrum. | 1.0 | ≥ 0.0 |
-| scaleBottomRadius | FLOAT | The scale of the radius of the bottom circle of a conical frustrum. | 1.5 | ≥ 0.0 |
-| scaleHeight | FLOAT | The scale of the height of a conic. | 3.0 | > 0.0 |
-| scaleRadius | FLOAT | The scale of the radius of a cylinder. | 1.0 | > 0.0 |
-| scaleDimensions | VECTOR3 | The dimensions of a cuboid. Scales in the same fashion as a 9-patch image. | (1.0, 1.0, 1.0) | > 0.0 for each |
-| [bevelPercentage](@ref bevel-details) | FLOAT | Determines how bevelled the cuboid should be, based off the smallest dimension. | 0.0 (no bevel) | 0.0 - 1.0 |
-| bevelSmoothness | FLOAT | Defines how smooth the bevelled edges should be. | 0.0 (sharp edges) | 0.0 - 1.0 |
-| lightPosition | VECTOR3 | The position, in stage space, of the point light that applies lighting to the model. This is based off the stage's dimensions, so using the width and height of the stage halved will correspond to the center, and using all zeroes will place the light at the top left. Note that this corresponds to a shader property, so it can be registered and set in the actor as well. | (Offset outwards from the center of the screen.) | Unlimited |
+**VisualType:** Dali::Toolkit::Visual::PRIMITIVE, "PRIMITIVE"
+
+| Property | String | Type | Description | Default Value | Range |
+|---------------------------------------------------------------|-------------------|:------------------:|-----------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------:|:------------------------------:|
+| Dali::Toolkit::PrimitiveVisual::Property::SHAPE | shape | INTEGER or STRING | The specific shape to render. [More info](@ref shape-details) | Dali::Toolkit::PrimitiveVisual::Shape::SPHERE, "SPHERE" | [See list](@ref shape-details) |
+| Dali::Toolkit::PrimitiveVisual::Property::COLOR | shapeColor | VECTOR4 | The color of the shape. | (0.5, 0.5, 0.5, 1.0) | 0.0 - 1.0 for each |
+| Dali::Toolkit::PrimitiveVisual::Property::SLICES | slices | INTEGER | The number of slices as you go around the shape. [More info](@ref slices-details) | 128 | 1 - 255 |
+| Dali::Toolkit::PrimitiveVisual::Property::STACKS | stacks | INTEGER | The number of stacks as you go down the shape. [More info](@ref stacks-details) | 128 | 1 - 255 |
+| Dali::Toolkit::PrimitiveVisual::Property::SCALE_TOP_RADIUS | scaleTopRadius | FLOAT | The scale of the radius of the top circle of a conical frustrum. | 1.0 | ≥ 0.0 |
+| Dali::Toolkit::PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS | scaleBottomRadius | FLOAT | The scale of the radius of the bottom circle of a conical frustrum. | 1.5 | ≥ 0.0 |
+| Dali::Toolkit::PrimitiveVisual::Property::SCALE_HEIGHT | scaleHeight | FLOAT | The scale of the height of a conic. | 3.0 | > 0.0 |
+| Dali::Toolkit::PrimitiveVisual::Property::SCALE_RADIUS | scaleRadius | FLOAT | The scale of the radius of a cylinder. | 1.0 | > 0.0 |
+| Dali::Toolkit::PrimitiveVisual::Property::SCALE_DIMENSIONS | scaleDimensions | VECTOR3 | The dimensions of a cuboid. Scales in the same fashion as a 9-patch image. | Vector3::ONE | > 0.0 for each |
+| Dali::Toolkit::PrimitiveVisual::Property::BEVEL_PERCENTAGE | bevelPercentage | FLOAT | Determines how bevelled the cuboid should be, based off the smallest dimension. [More info](@ref bevel-details) | 0.0 (no bevel) | 0.0 - 1.0 |
+| Dali::Toolkit::PrimitiveVisual::Property::BEVEL_SMOOTHNESS | bevelSmoothness | FLOAT | Defines how smooth the bevelled edges should be. | 0.0 (sharp edges) | 0.0 - 1.0 |
+| Dali::Toolkit::PrimitiveVisual::Property::LIGHT_POSITION | lightPosition | VECTOR3 | The position, in stage space, of the point light that applies lighting to the model. | (Offset outwards from the center of the screen.) | Unlimited |
### Shapes {#shape-details}
There are six shapes that can be chosen, some of which are simplified specialisations of another.
-| Value | Description | Parameters |
-|------------------|-----------------------------------------------------------------------------------|---------------------------------------------------------------|
-| SPHERE | *Default*. | color, slices, stacks |
-| CONICAL_FRUSTRUM | The area bound between two circles, i.e. a cone with the tip removed. | color, scaleTopRadius, scaleBottomRadius, scaleHeight, slices |
-| CONE | Equivalent to a conical frustrum with top radius of zero. | color, scaleBottomRadius, scaleHeight, slices |
-| CYLINDER | Equivalent to a conical frustrum with equal radii for the top and bottom circles. | color, scaleRadius, scaleHeight, slices |
-| CUBE | Equivalent to a bevelled cube with a bevel percentage of zero. | color, scaleDimensions |
-| OCTAHEDRON | Equivalent to a bevelled cube with a bevel percentage of one. | color, scaleDimensions |
-| BEVELLED_CUBE | A cube/cuboid with all edges flattened to some degree. | color, scaleDimensions, bevelPercentage, bevelSmoothness |
+| Enumeration | String | Description | Parameters |
+|---------------------------------------------------------|------------------|-----------------------------------------------------------------------------------|---------------------------------------------------------------|
+| Dali::Toolkit::PrimitiveVisual::Shape::SPHERE | SPHERE | *Default*. | color, slices, stacks |
+| Dali::Toolkit::PrimitiveVisual::Shape::CONICAL_FRUSTRUM | CONICAL_FRUSTRUM | The area bound between two circles, i.e. a cone with the tip removed. | color, scaleTopRadius, scaleBottomRadius, scaleHeight, slices |
+| Dali::Toolkit::PrimitiveVisual::Shape::CONE | CONE | Equivalent to a conical frustrum with top radius of zero. | color, scaleBottomRadius, scaleHeight, slices |
+| Dali::Toolkit::PrimitiveVisual::Shape::CYLINDER | CYLINDER | Equivalent to a conical frustrum with equal radii for the top and bottom circles. | color, scaleRadius, scaleHeight, slices |
+| Dali::Toolkit::PrimitiveVisual::Shape::CUBE | CUBE | Equivalent to a bevelled cube with a bevel percentage of zero. | color, scaleDimensions |
+| Dali::Toolkit::PrimitiveVisual::Shape::OCTAHEDRON | OCTAHEDRON | Equivalent to a bevelled cube with a bevel percentage of one. | color, scaleDimensions |
+| Dali::Toolkit::PrimitiveVisual::Shape::BEVELLED_CUBE | BEVELLED_CUBE | A cube/cuboid with all edges flattened to some degree. | color, scaleDimensions, bevelPercentage, bevelSmoothness |
-Examples below:
+#### Examples below:
**sphere:**
-
+
![ ](../assets/img/visuals/sphere.png)
![ ](visuals/sphere.png)
-
+
**conics:**
-
+
| Frustrum | Cone | Cylinder |
|----------|------|----------|
| ![ ](../assets/img/visuals/conical-frustrum.png) ![ ](visuals/conical-frustrum.png) | ![ ](../assets/img/visuals/cone.png) ![ ](visuals/cone.png) | ![ ](../assets/img/visuals/cylinder.png) ![ ](visuals/cylinder.png) |
-
+
### Bevel {#bevel-details}
-
+
Bevel percentage ranges from 0.0 to 1.0. It affects the ratio of the outer face widths to the width of the overall cube, as shown:
-
+
| 0.0 ( cube) | 0.3 | 0.7 | 1.0 (octahedron) |
|-------------|-----|-----|------------------|
| ![ ](../assets/img/visuals/cube.png) ![ ](visuals/cube.png) | ![ ](../assets/img/visuals/bevelled-cube-low.png) ![ ](visuals/bevelled-cube-low.png) | ![ ](../assets/img/visuals/bevelled-cube-high.png) ![ ](visuals/bevelled-cube-high.png) | ![ ](../assets/img/visuals/octahedron.png) ![ ](visuals/octahedron.png) |
-
+
### Slices {#slices-details}
-
+
For spheres and conical frustrums, 'slices' determines how many divisions there are as you go around the object.
-
+
![ ](../assets/img/visuals/slices.png)
![ ](visuals/slices.png)
-
+
### Stacks {#stacks-details}
-
+
For spheres, 'stacks' determines how many layers there are as you go down the object.
-
+
![ ](../assets/img/visuals/stacks.png)
![ ](visuals/stacks.png)
-
+
### Usage
-
+
**sphere**
-
+
~~~{.cpp}
// C++
Dali::Toolkit::Control control = Dali::Toolkit::Control::New();
Dali::Property::Map map;
-map[ "rendererType" ] = "PRIMITIVE";
-map[ "shape" ] = "SPHERE";
-map[ "shapeColor" ] = Vector4( 1.0, 0.5, 0.0, 1.0 );
+map[ Visual::Property::TYPE ] = Dali::Toolkit::Visual::PRIMITIVE;
+map[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::SPHERE;
+map[ PrimitiveVisual::Property::COLOR ] = Vector4( 1.0, 0.5, 0.0, 1.0 );
-control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
+control.SetProperty( Control::Property::BACKGROUND, map );
~~~
**conical frustrum**
Dali::Property::Map map;
-map[ "rendererType" ] = "PRIMITIVE";
-map[ "shape" ] = "CONICAL_FRUSTRUM";
-map[ "shapeColor" ] = Vector4( 1.0, 0.5, 0.0, 1.0 );
-map[ "scaleTopRadius" ] = 1.0f;
-map[ "scaleBottomRadius" ] = 1.5f;
-map[ "scaleHeight" ] = 3.0f;
+map[ Visual::Property::TYPE ] = Dali::Toolkit::Visual::PRIMITIVE;
+map[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::CONICAL_FRUSTRUM;
+map[ PrimitiveVisual::Property::COLOR ] = Vector4( 1.0, 0.5, 0.0, 1.0 );
+map[ PrimitiveVisual::Property::SCALE_TOP_RADIUS ] = 1.0f;
+map[ PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS ] = 1.5f;
+map[ PrimitiveVisual::Property::SCALE_HEIGHT ] = 3.0f;
-control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
+control.SetProperty( Control::Property::BACKGROUND, map );
~~~
**bevelled cube**
Dali::Property::Map map;
-map[ "rendererType" ] = "PRIMITIVE";
-map[ "shape" ] = "BEVELLED_CUBE";
-map[ "shapeColor" ] = Vector4( 1.0, 0.5, 0.0, 1.0 );
-map[ "bevelPercentage" ] = 0.4f;
+map[ Visual::Property::TYPE ] = Dali::Toolkit::Visual::PRIMITIVE;
+map[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::BEVELLED_CUBE;
+map[ PrimitiveVisual::Property::COLOR ] = Vector4( 1.0, 0.5, 0.0, 1.0 );
+map[ PrimitiveVisual::Property::BEVEL_PERCENTAGE ] = 0.4f;
-control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
+control.SetProperty( Control::Property::BACKGROUND, map );
~~~
@class _Guide_Control_Visuals
"type":"ImageView",
"image":
{
- "rendererType" : "IMAGE",
+ "visualType" : "IMAGE",
"url": "{icon_path}"
},
"position":[20.0, 0.0, 0.0],
"type":"ImageView",
"image":
{
- "rendererType" : "IMAGE",
+ "visualType" : "IMAGE",
"url": "{icon_path}"
},
"position":[0.0, -10.0, 0.0],
"type":"ImageView",
"image":
{
- "rendererType" : "IMAGE",
+ "visualType" : "IMAGE",
"url": "{icon_path}"
},
"position":[20.0, 0.0, 0.0],
"type":"ImageView",
"image":
{
- "rendererType" : "IMAGE",
+ "visualType" : "IMAGE",
"url": "{icon_path}"
},
"position":[0.0, -10.0, 0.0],
// vertexShader = ""; // vertex shader ( optional)
// fragmentShader = ""; // fragment shader ( optional)
// hints = // shader hints ( optional)
- // [ "requiresSelfDepthTest", // Expects depth testing enabled
- // "outputIsTransparent", // Might generate transparent alpha from opaque inputs
- // "outputIsOpaque", // Outputs opaque colors even if the inputs are transparent
- // "modifiesGeometry" ]; // Might change position of vertices, this option disables any culling optimizations
+ // [ "OUTPUT_IS_TRANSPARENT", // Might generate transparent alpha from opaque inputs
+ // "MODIFIES_GEOMETRY" ]; // Might change position of vertices, this option disables any culling optimizations
var shader = {
"fragmentShader": fragShader,
- "hints" : "outputIsTransparent"
+ "hints" : "OUTPUT_IS_TRANSPARENT"
};
return shader;
var shader = createColorShiftAndZoomEffect();
var image = {
- "rendererType" : "IMAGE",
+ "visualType" : "IMAGE",
"url" : getImageDirectory()+"gallery-medium-50.jpg",
"shader" : shader
};
// vertexShader = ""; // vertex shader ( optional)
// fragmentShader = ""; // fragment shader ( optional)
// hints = // shader hints ( optional)
-// [ "requiresSelfDepthTest", // Expects depth testing enabled
-// "outputIsTransparent", // Might generate transparent alpha from opaque inputs
-// "outputIsOpaque", // Outputs opaque colors even if the inputs are transparent
-// "modifiesGeometry" ]; // Might change position of vertices, this option disables any culling optimizations
+// [ "OUTPUT_IS_TRANSPARENT", // Might generate transparent alpha from opaque inputs
+// "MODIFIES_GEOMETRY" ]; // Might change position of vertices, this option disables any culling optimizations
var shader = {
"vertexShader": myVertexShader,
dali.stage.add( imageView );
var image = {
- "rendererType" : "IMAGE",
+ "visualType" : "IMAGE",
"url" : "myImage.jpg",
"desiredWidth" : desiredWidth, // The desired image width while loading (optional but preferable to set for efficiency)
"desiredHeight" : desiredHeight, // The desired image height while loading (optional but preferable to set for efficiency)
"type":"ImageView",
"image":
{
- "rendererType" : "IMAGE",
+ "visualType" : "IMAGE",
"url": "{icon_path}"
},
"position":[20.0, 0.0, 0.0],