[3.0] Clipping API feature in Actor
[platform/core/uifw/dali-core.git] / dali / internal / event / rendering / renderer-impl.cpp
index 0bd59c7..c430a5b 100644 (file)
@@ -19,6 +19,7 @@
 #include <dali/internal/event/rendering/renderer-impl.h> // Dali::Internal::Renderer
 
 // INTERNAL INCLUDES
+#include <dali/devel-api/scripting/scripting.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/internal/event/common/object-impl-helper.h> // Dali::Internal::ObjectHelper
 #include <dali/internal/event/common/property-helper.h>    // DALI_PROPERTY_TABLE_BEGIN, DALI_PROPERTY, DALI_PROPERTY_TABLE_END
@@ -36,7 +37,7 @@ namespace
 {
 
 /**
- *            |name                              |type     |writable|animatable|constraint-input|enum for index-checking|
+ * Properties: |name                              |type     |writable|animatable|constraint-input|enum for index-checking|
  */
 DALI_PROPERTY_TABLE_BEGIN
 DALI_PROPERTY( "depthIndex",                      INTEGER,   true, false,  false, Dali::Renderer::Property::DEPTH_INDEX )
@@ -55,17 +56,108 @@ DALI_PROPERTY( "indexRangeCount",                 INTEGER,   true, false,  false
 DALI_PROPERTY( "depthWriteMode",                  INTEGER,   true, false,  false, Dali::Renderer::Property::DEPTH_WRITE_MODE )
 DALI_PROPERTY( "depthFunction",                   INTEGER,   true, false,  false, Dali::Renderer::Property::DEPTH_FUNCTION )
 DALI_PROPERTY( "depthTestMode",                   INTEGER,   true, false,  false, Dali::Renderer::Property::DEPTH_TEST_MODE )
+DALI_PROPERTY( "renderMode",                      INTEGER,   true, false,  false, Dali::Renderer::Property::RENDER_MODE )
 DALI_PROPERTY( "stencilFunction",                 INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_FUNCTION )
 DALI_PROPERTY( "stencilFunctionMask",             INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_FUNCTION_MASK )
 DALI_PROPERTY( "stencilFunctionReference",        INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE )
 DALI_PROPERTY( "stencilMask",                     INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_MASK )
-DALI_PROPERTY( "stencilMode",                     INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_MODE )
 DALI_PROPERTY( "stencilOperationOnFail",          INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL )
 DALI_PROPERTY( "stencilOperationOnZFail",         INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL )
 DALI_PROPERTY( "stencilOperationOnZPass",         INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS )
-DALI_PROPERTY( "writeToColorBuffer",              BOOLEAN,   true, false,  false, Dali::Renderer::Property::WRITE_TO_COLOR_BUFFER )
 DALI_PROPERTY_TABLE_END( DEFAULT_RENDERER_PROPERTY_START_INDEX )
 
+// Property string to enumeration tables:
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN( FACE_CULLING_MODE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( FaceCullingMode, NONE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( FaceCullingMode, FRONT )
+DALI_ENUM_TO_STRING_WITH_SCOPE( FaceCullingMode, BACK )
+DALI_ENUM_TO_STRING_WITH_SCOPE( FaceCullingMode, FRONT_AND_BACK )
+DALI_ENUM_TO_STRING_TABLE_END( FACE_CULLING_MODE )
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN( BLEND_MODE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendMode, OFF )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendMode, AUTO )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendMode, ON )
+DALI_ENUM_TO_STRING_TABLE_END( BLEND_MODE )
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN( BLEND_EQUATION )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendEquation, ADD )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendEquation, SUBTRACT )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendEquation, REVERSE_SUBTRACT )
+DALI_ENUM_TO_STRING_TABLE_END( BLEND_EQUATION )
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN( BLEND_FACTOR )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ZERO )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, SRC_COLOR )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_SRC_COLOR )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, SRC_ALPHA )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_SRC_ALPHA )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, DST_ALPHA )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_DST_ALPHA )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, DST_COLOR )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_DST_COLOR )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, SRC_ALPHA_SATURATE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, CONSTANT_COLOR )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_CONSTANT_COLOR )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, CONSTANT_ALPHA )
+DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_CONSTANT_ALPHA )
+DALI_ENUM_TO_STRING_TABLE_END( BLEND_FACTOR )
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN( DEPTH_WRITE_MODE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DepthWriteMode, OFF )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DepthWriteMode, AUTO )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DepthWriteMode, ON )
+DALI_ENUM_TO_STRING_TABLE_END( DEPTH_WRITE_MODE )
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN( DEPTH_TEST_MODE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DepthTestMode, OFF )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DepthTestMode, AUTO )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DepthTestMode, ON )
+DALI_ENUM_TO_STRING_TABLE_END( DEPTH_TEST_MODE )
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN( DEPTH_FUNCTION )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, NEVER )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, ALWAYS )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, LESS )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, GREATER )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, EQUAL )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, NOT_EQUAL )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, LESS_EQUAL )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, GREATER_EQUAL )
+DALI_ENUM_TO_STRING_TABLE_END( DEPTH_FUNCTION )
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN( STENCIL_FUNCTION )
+DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, NEVER )
+DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, LESS )
+DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, EQUAL )
+DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, LESS_EQUAL )
+DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, GREATER )
+DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, NOT_EQUAL )
+DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, GREATER_EQUAL )
+DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, ALWAYS )
+DALI_ENUM_TO_STRING_TABLE_END( STENCIL_FUNCTION )
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN( RENDER_MODE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, NONE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, AUTO )
+DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, COLOR )
+DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, STENCIL )
+DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, COLOR_STENCIL )
+DALI_ENUM_TO_STRING_TABLE_END( RENDER_MODE )
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN( STENCIL_OPERATION )
+DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, ZERO )
+DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, KEEP )
+DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, REPLACE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, INCREMENT )
+DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, DECREMENT )
+DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, INVERT )
+DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, INCREMENT_WRAP )
+DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, DECREMENT_WRAP )
+DALI_ENUM_TO_STRING_TABLE_END( STENCIL_OPERATION )
+
 const ObjectImplHelper<DEFAULT_PROPERTY_COUNT> RENDERER_IMPL = { DEFAULT_PROPERTY_DETAILS };
 
 BaseHandle Create()
@@ -135,21 +227,6 @@ int Renderer::GetDepthIndex() const
   return mDepthIndex;
 }
 
-void Renderer::SetFaceCullingMode( FaceCullingMode::Type cullingMode )
-{
-  if( mFaceCullingMode != cullingMode )
-  {
-    mFaceCullingMode = cullingMode;
-
-    SetFaceCullingModeMessage( GetEventThreadServices(), *mSceneObject, mFaceCullingMode );
-  }
-}
-
-FaceCullingMode::Type Renderer::GetFaceCullingMode()
-{
-  return mFaceCullingMode;
-}
-
 void Renderer::SetBlendMode( BlendMode::Type mode )
 {
   if( mBlendMode != mode )
@@ -328,109 +405,88 @@ void Renderer::SetDefaultProperty( Property::Index index,
     }
     case Dali::Renderer::Property::FACE_CULLING_MODE:
     {
-      int faceCullingMode;
-      if( propertyValue.Get( faceCullingMode ) )
+      FaceCullingMode::Type convertedValue = mFaceCullingMode;
+      if( Scripting::GetEnumerationProperty< FaceCullingMode::Type >( propertyValue, FACE_CULLING_MODE_TABLE, FACE_CULLING_MODE_TABLE_COUNT, convertedValue ) )
       {
-        SetFaceCullingMode( FaceCullingMode::Type( faceCullingMode ) );
+        mFaceCullingMode = convertedValue;
+        SetFaceCullingModeMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
       }
       break;
     }
     case Dali::Renderer::Property::BLEND_MODE:
     {
-      int blendingMode;
-      if( propertyValue.Get( blendingMode ) )
+      BlendMode::Type convertedValue = mBlendMode;
+      if( Scripting::GetEnumerationProperty< BlendMode::Type >( propertyValue, BLEND_MODE_TABLE, BLEND_MODE_TABLE_COUNT, convertedValue ) )
       {
-        SetBlendMode( BlendMode::Type( blendingMode ) );
+        SetBlendMode( convertedValue );
       }
       break;
     }
     case Dali::Renderer::Property::BLEND_EQUATION_RGB:
     {
-      int blendingEquation;
-      if( propertyValue.Get( blendingEquation ) )
+      BlendEquation::Type convertedValue = mBlendingOptions.GetBlendEquationRgb();
+
+      if( Scripting::GetEnumerationProperty< BlendEquation::Type >( propertyValue, BLEND_EQUATION_TABLE, BLEND_EQUATION_TABLE_COUNT, convertedValue ) )
       {
         BlendEquation::Type alphaEquation = mBlendingOptions.GetBlendEquationAlpha();
-        mBlendingOptions.SetBlendEquation( static_cast<BlendEquation::Type>( blendingEquation ), alphaEquation );
+        mBlendingOptions.SetBlendEquation( convertedValue, alphaEquation );
         SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
       }
       break;
     }
     case Dali::Renderer::Property::BLEND_EQUATION_ALPHA:
     {
-      int blendingEquation;
-      if( propertyValue.Get( blendingEquation ) )
+      BlendEquation::Type convertedValue = mBlendingOptions.GetBlendEquationAlpha();
+
+      if( Scripting::GetEnumerationProperty< BlendEquation::Type >( propertyValue, BLEND_EQUATION_TABLE, BLEND_EQUATION_TABLE_COUNT, convertedValue ) )
       {
         BlendEquation::Type rgbEquation = mBlendingOptions.GetBlendEquationRgb();
-        mBlendingOptions.SetBlendEquation( rgbEquation, static_cast<BlendEquation::Type>( blendingEquation ) );
+        mBlendingOptions.SetBlendEquation( rgbEquation, convertedValue );
         SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
       }
       break;
     }
     case Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB:
     {
-      int blendingFactor;
-      if( propertyValue.Get( blendingFactor ) )
+      BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha;
+      GetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
+
+      if( Scripting::GetEnumerationProperty< BlendFactor::Type >( propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, sourceFactorRgb ) )
       {
-        BlendFactor::Type srcFactorRgb;
-        BlendFactor::Type destFactorRgb;
-        BlendFactor::Type srcFactorAlpha;
-        BlendFactor::Type destFactorAlpha;
-        GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
-        SetBlendFunc( static_cast<BlendFactor::Type>( blendingFactor ),
-            destFactorRgb,
-            srcFactorAlpha,
-            destFactorAlpha );
+        SetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
       }
       break;
     }
     case Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB:
     {
-      int blendingFactor;
-      if( propertyValue.Get( blendingFactor ) )
+      BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha;
+      GetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
+
+      if( Scripting::GetEnumerationProperty< BlendFactor::Type >( propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, destinationFactorRgb ) )
       {
-        BlendFactor::Type srcFactorRgb;
-        BlendFactor::Type destFactorRgb;
-        BlendFactor::Type srcFactorAlpha;
-        BlendFactor::Type destFactorAlpha;
-        GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
-        SetBlendFunc( srcFactorRgb,
-            static_cast<BlendFactor::Type>( blendingFactor ),
-            srcFactorAlpha,
-            destFactorAlpha );
+        SetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
       }
       break;
     }
     case Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA:
     {
-      int blendingFactor;
-      if( propertyValue.Get( blendingFactor ) )
+      BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha;
+      GetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
+
+      if( Scripting::GetEnumerationProperty< BlendFactor::Type >( propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, sourceFactorAlpha ) )
       {
-        BlendFactor::Type srcFactorRgb;
-        BlendFactor::Type destFactorRgb;
-        BlendFactor::Type srcFactorAlpha;
-        BlendFactor::Type destFactorAlpha;
-        GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
-        SetBlendFunc( srcFactorRgb,
-            destFactorRgb,
-            static_cast<BlendFactor::Type>( blendingFactor ),
-            destFactorAlpha );
+        SetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
       }
       break;
     }
     case Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA:
     {
-      int blendingFactor;
-      if( propertyValue.Get( blendingFactor ) )
+      BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha;
+      GetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
+
+      if( Scripting::GetEnumerationProperty< BlendFactor::Type >( propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, destinationFactorAlpha ) )
       {
-        BlendFactor::Type srcFactorRgb;
-        BlendFactor::Type destFactorRgb;
-        BlendFactor::Type srcFactorAlpha;
-        BlendFactor::Type destFactorAlpha;
-        GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
-        SetBlendFunc( srcFactorRgb,
-            destFactorRgb,
-            srcFactorAlpha,
-            static_cast<BlendFactor::Type>( blendingFactor ) );
+        SetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
       }
       break;
     }
@@ -472,61 +528,51 @@ void Renderer::SetDefaultProperty( Property::Index index,
     }
     case Dali::Renderer::Property::DEPTH_WRITE_MODE:
     {
-      int value;
-      propertyValue.Get( value );
-      DepthWriteMode::Type mode = static_cast<DepthWriteMode::Type>(value);
-      if( mode != mDepthWriteMode )
+      DepthWriteMode::Type convertedValue = mDepthWriteMode;
+      if( Scripting::GetEnumerationProperty< DepthWriteMode::Type >( propertyValue, DEPTH_WRITE_MODE_TABLE, DEPTH_WRITE_MODE_TABLE_COUNT, convertedValue ) )
       {
-        mDepthWriteMode = mode;
-        SetDepthWriteModeMessage( GetEventThreadServices(), *mSceneObject, mode );
+        mDepthWriteMode = convertedValue;
+        SetDepthWriteModeMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
       }
       break;
     }
     case Dali::Renderer::Property::DEPTH_FUNCTION:
     {
-      int value;
-      propertyValue.Get( value );
-      DepthFunction::Type depthFunction = static_cast<DepthFunction::Type>(value);
-      if( depthFunction != mDepthFunction )
+      DepthFunction::Type convertedValue = mDepthFunction;
+      if( Scripting::GetEnumerationProperty< DepthFunction::Type >( propertyValue, DEPTH_FUNCTION_TABLE, DEPTH_FUNCTION_TABLE_COUNT, convertedValue ) )
       {
-        mDepthFunction = depthFunction;
-        SetDepthFunctionMessage( GetEventThreadServices(), *mSceneObject, depthFunction );
+        mDepthFunction = convertedValue;
+        SetDepthFunctionMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
       }
       break;
     }
     case Dali::Renderer::Property::DEPTH_TEST_MODE:
     {
-      int value;
-      propertyValue.Get( value );
-      DepthTestMode::Type mode = static_cast<DepthTestMode::Type>(value);
-      if( mode != mDepthTestMode )
+      DepthTestMode::Type convertedValue = mDepthTestMode;
+      if( Scripting::GetEnumerationProperty< DepthTestMode::Type >( propertyValue, DEPTH_TEST_MODE_TABLE, DEPTH_TEST_MODE_TABLE_COUNT, convertedValue ) )
       {
-        mDepthTestMode = mode;
-        SetDepthTestModeMessage( GetEventThreadServices(), *mSceneObject, mode );
+        mDepthTestMode = convertedValue;
+        SetDepthTestModeMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
       }
       break;
     }
-    case Dali::Renderer::Property::STENCIL_MODE:
+    case Dali::Renderer::Property::RENDER_MODE:
     {
-      int value;
-      propertyValue.Get( value );
-      StencilMode::Type stencilMode = static_cast<StencilMode::Type>( value );
-      if( stencilMode != mStencilParameters.stencilMode )
+      RenderMode::Type convertedValue = mStencilParameters.renderMode;
+      if( Scripting::GetEnumerationProperty< RenderMode::Type >( propertyValue, RENDER_MODE_TABLE, RENDER_MODE_TABLE_COUNT, convertedValue ) )
       {
-        mStencilParameters.stencilMode = stencilMode;
-        SetStencilModeMessage( GetEventThreadServices(), *mSceneObject, stencilMode );
+        mStencilParameters.renderMode = convertedValue;
+        SetRenderModeMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
       }
       break;
     }
     case Dali::Renderer::Property::STENCIL_FUNCTION:
     {
-      int value;
-      propertyValue.Get( value );
-      StencilFunction::Type stencilFunction = static_cast<StencilFunction::Type>( value );
-      if( stencilFunction != mStencilParameters.stencilFunction )
+      StencilFunction::Type convertedValue = mStencilParameters.stencilFunction;
+      if( Scripting::GetEnumerationProperty< StencilFunction::Type >( propertyValue, STENCIL_FUNCTION_TABLE, STENCIL_FUNCTION_TABLE_COUNT, convertedValue ) )
       {
-        mStencilParameters.stencilFunction = stencilFunction;
-        SetStencilFunctionMessage( GetEventThreadServices(), *mSceneObject, stencilFunction );
+        mStencilParameters.stencilFunction = convertedValue;
+        SetStencilFunctionMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
       }
       break;
     }
@@ -571,50 +617,31 @@ void Renderer::SetDefaultProperty( Property::Index index,
     }
     case Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL:
     {
-      int value;
-      propertyValue.Get( value );
-      StencilOperation::Type stencilOperation = static_cast<StencilOperation::Type>( value );
-      if( stencilOperation != mStencilParameters.stencilOperationOnFail )
+      StencilOperation::Type convertedValue = mStencilParameters.stencilOperationOnFail;
+      if( Scripting::GetEnumerationProperty< StencilOperation::Type >( propertyValue, STENCIL_OPERATION_TABLE, STENCIL_OPERATION_TABLE_COUNT, convertedValue ) )
       {
-        mStencilParameters.stencilOperationOnFail = stencilOperation;
-        SetStencilOperationOnFailMessage( GetEventThreadServices(), *mSceneObject, stencilOperation );
+        mStencilParameters.stencilOperationOnFail = convertedValue;
+        SetStencilOperationOnFailMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
       }
       break;
     }
     case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL:
     {
-      int value;
-      propertyValue.Get( value );
-      StencilOperation::Type stencilOperation = static_cast<StencilOperation::Type>( value );
-      if( stencilOperation != mStencilParameters.stencilOperationOnZFail )
+      StencilOperation::Type convertedValue = mStencilParameters.stencilOperationOnZFail;
+      if( Scripting::GetEnumerationProperty< StencilOperation::Type >( propertyValue, STENCIL_OPERATION_TABLE, STENCIL_OPERATION_TABLE_COUNT, convertedValue ) )
       {
-        mStencilParameters.stencilOperationOnZFail = stencilOperation;
-        SetStencilOperationOnZFailMessage( GetEventThreadServices(), *mSceneObject, stencilOperation );
+        mStencilParameters.stencilOperationOnZFail = convertedValue;
+        SetStencilOperationOnZFailMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
       }
       break;
     }
     case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS:
     {
-      int value;
-      propertyValue.Get( value );
-      StencilOperation::Type stencilOperation = static_cast<StencilOperation::Type>( value );
-      if( stencilOperation != mStencilParameters.stencilOperationOnZPass )
+      StencilOperation::Type convertedValue = mStencilParameters.stencilOperationOnZPass;
+      if( Scripting::GetEnumerationProperty< StencilOperation::Type >( propertyValue, STENCIL_OPERATION_TABLE, STENCIL_OPERATION_TABLE_COUNT, convertedValue ) )
       {
-        mStencilParameters.stencilOperationOnZPass = stencilOperation;
-        SetStencilOperationOnZPassMessage( GetEventThreadServices(), *mSceneObject, stencilOperation );
-      }
-      break;
-    }
-    case Dali::Renderer::Property::WRITE_TO_COLOR_BUFFER:
-    {
-      bool writeToColorBuffer;
-      if( propertyValue.Get( writeToColorBuffer ) )
-      {
-        if( mWriteToColorBuffer != writeToColorBuffer )
-        {
-          mWriteToColorBuffer = writeToColorBuffer;
-          SetWriteToColorBufferMessage( GetEventThreadServices(), *mSceneObject, writeToColorBuffer );
-        }
+        mStencilParameters.stencilOperationOnZPass = convertedValue;
+        SetStencilOperationOnZPassMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
       }
       break;
     }
@@ -761,9 +788,9 @@ Property::Value Renderer::GetDefaultProperty( Property::Index index ) const
       value = mStencilParameters.stencilMask;
       break;
     }
-    case Dali::Renderer::Property::STENCIL_MODE:
+    case Dali::Renderer::Property::RENDER_MODE:
     {
-      value = mStencilParameters.stencilMode;
+      value = mStencilParameters.renderMode;
       break;
     }
     case Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL:
@@ -781,11 +808,6 @@ Property::Value Renderer::GetDefaultProperty( Property::Index index ) const
       value = mStencilParameters.stencilOperationOnZPass;
       break;
     }
-    case Dali::Renderer::Property::WRITE_TO_COLOR_BUFFER:
-    {
-      value = mWriteToColorBuffer;
-      break;
-    }
   }
   return value;
 }
@@ -863,20 +885,19 @@ void Renderer::Disconnect()
 }
 
 Renderer::Renderer()
-: mSceneObject (NULL ),
+: mSceneObject(NULL ),
   mBlendColor( NULL ),
   mDepthIndex( 0 ),
   mOnStageCount( 0 ),
   mIndexedDrawFirstElement( 0 ),
   mIndexedDrawElementCount( 0 ),
-  mStencilParameters( StencilMode::AUTO, StencilFunction::ALWAYS, 0xFF, 0x00, 0xFF, StencilOperation::KEEP, StencilOperation::KEEP, StencilOperation::KEEP ),
+  mStencilParameters( RenderMode::AUTO, StencilFunction::ALWAYS, 0xFF, 0x00, 0xFF, StencilOperation::KEEP, StencilOperation::KEEP, StencilOperation::KEEP ),
   mBlendingOptions(),
   mDepthFunction( DepthFunction::LESS ),
   mFaceCullingMode( FaceCullingMode::NONE ),
   mBlendMode( BlendMode::AUTO ),
   mDepthWriteMode( DepthWriteMode::AUTO ),
   mDepthTestMode( DepthTestMode::AUTO ),
-  mWriteToColorBuffer( true ),
   mPremultipledAlphaEnabled( false )
 {
 }