Implementation of BorderRenderer and apply it to Magnifier 44/48544/6
authorXiangyin Ma <x1.ma@samsung.com>
Tue, 22 Sep 2015 16:09:28 +0000 (17:09 +0100)
committerXiangyin Ma <x1.ma@samsung.com>
Thu, 24 Sep 2015 10:07:34 +0000 (11:07 +0100)
Change-Id: I94c915e7c1530c10654d5458965765eb7d2431de

12 files changed:
automated-tests/src/dali-toolkit/utc-Dali-RendererFactory.cpp
dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.cpp
dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h
dali-toolkit/images/magnifier-image-frame.png [deleted file]
dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp
dali-toolkit/internal/controls/magnifier/magnifier-impl.h
dali-toolkit/internal/controls/renderers/border/border-renderer.cpp [new file with mode: 0644]
dali-toolkit/internal/controls/renderers/border/border-renderer.h [new file with mode: 0644]
dali-toolkit/internal/controls/renderers/renderer-factory-cache.h
dali-toolkit/internal/controls/renderers/renderer-factory-impl.cpp
dali-toolkit/internal/controls/renderers/renderer-factory-impl.h
dali-toolkit/internal/file.list

index f35501b..c132161 100644 (file)
@@ -285,6 +285,87 @@ int UtcDaliRendererFactoryGetColorRenderer2(void)
   END_TEST;
 }
 
+int UtcDaliRendererFactoryGetBorderRenderer1(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliRendererFactoryGetBorderRenderer1:  Request border renderer with a Property::Map" );
+
+  RendererFactory factory = RendererFactory::Get();
+  DALI_TEST_CHECK( factory );
+
+  Property::Map propertyMap;
+  Vector4 testColor( 1.f, 0.5f, 0.3f, 0.2f );
+  float testSize = 5.f;
+  propertyMap.Insert("renderer-type", "border-renderer");
+  propertyMap.Insert("border-color", testColor);
+  propertyMap.Insert("border-size", testSize);
+
+  ControlRenderer controlRenderer = factory.GetControlRenderer(propertyMap);
+  DALI_TEST_CHECK( controlRenderer );
+
+  Actor actor = Actor::New();
+  actor.SetSize(200.f, 200.f);
+  Stage::GetCurrent().Add( actor );
+  controlRenderer.SetSize(Vector2(200.f, 200.f));
+  controlRenderer.SetOnStage( actor );
+
+  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+
+  application.SendNotification();
+  application.Render(0);
+
+  Vector4 actualColor(Vector4::ZERO);
+  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uBorderColor", actualColor ) );
+  DALI_TEST_EQUALS( actualColor, testColor, TEST_LOCATION );
+
+  float actualSize = 0.f;
+  DALI_TEST_CHECK( gl.GetUniformValue<float>( "uBorderSize", actualSize ) );
+  DALI_TEST_EQUALS( actualSize, testSize, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliRendererFactoryGetBorderRenderer2(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliRendererFactoryGetBorderRenderer2:  Request border renderer with a borderSize and a borderColor" );
+
+  RendererFactory factory = RendererFactory::Get();
+  DALI_TEST_CHECK( factory );
+
+  Vector4 testColor( 1.f, 0.5f, 0.3f, 0.2f );
+  float testSize = 5.f;
+
+  ControlRenderer controlRenderer = factory.GetControlRenderer(testSize, testColor);
+  DALI_TEST_CHECK( controlRenderer );
+
+  Actor actor = Actor::New();
+  actor.SetSize(200.f, 200.f);
+  Stage::GetCurrent().Add( actor );
+  controlRenderer.SetSize(Vector2(200.f, 200.f));
+  controlRenderer.SetOnStage( actor );
+
+  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+
+  application.SendNotification();
+  application.Render(0);
+
+  Vector4 actualColor(Vector4::ZERO);
+  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uBorderColor", actualColor ) );
+  DALI_TEST_EQUALS( actualColor, testColor, TEST_LOCATION );
+
+  float actualSize = 0.f;
+  DALI_TEST_CHECK( gl.GetUniformValue<float>( "uBorderSize", actualSize ) );
+  DALI_TEST_EQUALS( actualSize, testSize, TEST_LOCATION );
+
+  END_TEST;
+}
+
+
 int UtcDaliRendererFactoryGetLinearGradientRenderer(void)
 {
   ToolkitTestApplication application;
index a5918ef..ce70893 100644 (file)
@@ -97,6 +97,11 @@ bool RendererFactory::ResetRenderer( ControlRenderer& renderer, const Vector4& c
   return GetImplementation( *this ).ResetRenderer( renderer, color );
 }
 
+ControlRenderer RendererFactory::GetControlRenderer( float borderSize, const Vector4& borderColor )
+{
+  return GetImplementation( *this ).GetControlRenderer( borderSize, borderColor );
+}
+
 ControlRenderer RendererFactory::GetControlRenderer( const Image& image )
 {
   return GetImplementation( *this ).GetControlRenderer( image );
index d15dc68..da948db 100644 (file)
@@ -115,6 +115,15 @@ public:
   bool ResetRenderer( ControlRenderer& renderer, const Vector4& color );
 
   /**
+   * @brief Request the control renderer to renderer the border with the given size and color.
+   *
+   * @param[in] borderSize The size of the border. Border size is the same along all edges.
+   * @param[in] borderColor The color of the border.
+   * @return The pointer pointing to the control renderer
+   */
+  ControlRenderer GetControlRenderer( float borderSize, const Vector4& borderColor );
+
+  /**
    * @brief Request the control renderer to render the image.
    *
    * @param[in] image The image to be rendered.
diff --git a/dali-toolkit/images/magnifier-image-frame.png b/dali-toolkit/images/magnifier-image-frame.png
deleted file mode 100644 (file)
index aa4559d..0000000
Binary files a/dali-toolkit/images/magnifier-image-frame.png and /dev/null differ
index d956e36..45a3152 100644 (file)
@@ -27,6 +27,9 @@
 #include <dali/public-api/object/type-registry.h>
 #include <dali/devel-api/object/type-registry-helper.h>
 
+// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
+
 namespace Dali
 {
 
@@ -54,9 +57,7 @@ DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, Magnifier, "source-position", VE
 
 DALI_TYPE_REGISTRATION_END()
 
-const char* DEFAULT_FRAME_IMAGE_PATH = DALI_IMAGE_DIR "magnifier-image-frame.png";
-
-const float IMAGE_BORDER_INDENT = 14.0f;            ///< Indent of border in pixels.
+const float IMAGE_BORDER_INDENT = 5.0f;            ///< Indent of border in pixels.
 
 struct CameraActorPositionConstraint
 {
@@ -253,20 +254,22 @@ void Magnifier::SetFrameVisibility(bool visible)
   {
     Actor self(Self());
 
-    Image image = ResourceImage::New( DEFAULT_FRAME_IMAGE_PATH );
-    mFrame = ImageActor::New( image );
-    mFrame.SetStyle( ImageActor::STYLE_NINE_PATCH );
+    mFrame = Actor::New( );
     mFrame.SetPositionInheritanceMode(DONT_INHERIT_POSITION);
     mFrame.SetInheritScale(true);
     mFrame.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS );
     Vector3 sizeOffset(IMAGE_BORDER_INDENT*2.f - 2.f, IMAGE_BORDER_INDENT*2.f - 2.f, 0.0f);
     mFrame.SetSizeModeFactor( sizeOffset );
 
+    //TODO Set the renderer onto the control self when Actor::RemoveRenderer is supported
+    Toolkit::RendererFactory rendererFactory = Toolkit::RendererFactory::Get();
+    Toolkit::ControlRenderer borderRenderer = rendererFactory.GetControlRenderer(IMAGE_BORDER_INDENT, Color::WHITE);
+    borderRenderer.SetOnStage( mFrame );
+
     Constraint constraint = Constraint::New<Vector3>( mFrame, Actor::Property::POSITION, EqualToConstraint() );
     constraint.AddSource( ParentSource( Actor::Property::WORLD_POSITION ) );
     constraint.Apply();
 
-    mFrame.SetNinePatchBorder( Vector4::ONE * IMAGE_BORDER_INDENT );
     self.Add(mFrame);
   }
   else if(!visible && mFrame)
index d8b990f..63d0a43 100644 (file)
@@ -152,7 +152,7 @@ private:
 
   RenderTask mTask;                             ///< Render Task to render the source actor contents.
   CameraActor mCameraActor;                     ///< CameraActor attached to RenderTask
-  ImageActor mFrame;                            ///< The Magnifier Frame
+  Actor mFrame;                                 ///< The Magnifier Frame
   Actor mSourceActor;                           ///< Source Delegate Actor represents the source position to read.
   float mDefaultCameraDistance;                 ///< Default RenderTask's camera distance from target.
   Vector3 mActorSize;                           ///< The Actor size
diff --git a/dali-toolkit/internal/controls/renderers/border/border-renderer.cpp b/dali-toolkit/internal/controls/renderers/border/border-renderer.cpp
new file mode 100644 (file)
index 0000000..1450460
--- /dev/null
@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+// CLASS HEADER
+#include "border-renderer.h"
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+
+//INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/renderers/renderer-factory-impl.h>
+#include <dali-toolkit/internal/controls/renderers/renderer-factory-cache.h>
+#include <dali-toolkit/internal/controls/renderers/control-renderer-data-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+namespace
+{
+const char * const COLOR_NAME("border-color");
+const char * const COLOR_UNIFORM_NAME("uBorderColor");
+const char * const SIZE_NAME("border-size");
+const char * const SIZE_UNIFORM_NAME("uBorderSize");
+
+const char * const POSITION_ATTRIBUTE_NAME("aPosition");
+const char * const DRIFT_ATTRIBUTE_NAME("aDrift");
+const char * const INDEX_NAME("indices");
+
+
+const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
+  attribute mediump vec2 aPosition;\n
+  attribute mediump vec2 aDrift;\n
+  uniform mediump mat4 uMvpMatrix;\n
+  uniform mediump vec3 uSize;\n
+  uniform mediump float uBorderSize;\n
+  \n
+  void main()\n
+  {\n
+    vec2 position = aPosition*uSize.xy + aDrift*uBorderSize;\n
+    gl_Position = uMvpMatrix * vec4(position, 0.0, 1.0);\n
+  }\n
+);
+
+const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
+  uniform lowp vec4 uColor;\n
+  uniform lowp vec4 uBorderColor;\n
+  \n
+  void main()\n
+  {\n
+    gl_FragColor = uBorderColor*uColor;\n
+  }\n
+);
+}
+
+BorderRenderer::BorderRenderer()
+: ControlRenderer(),
+  mBorderColor( Color::TRANSPARENT ),
+  mBorderSize( 0.f ),
+  mBorderColorIndex( Property::INVALID_INDEX ),
+  mBorderSizeIndex( Property::INVALID_INDEX )
+{
+}
+
+BorderRenderer::~BorderRenderer()
+{
+}
+
+void BorderRenderer::Initialize( RendererFactoryCache& factoryCache, const Property::Map& propertyMap )
+{
+  Initialize( factoryCache );
+
+  Property::Value* color = propertyMap.Find( COLOR_NAME );
+  if( !( color && color->Get(mBorderColor) ) )
+  {
+    DALI_LOG_ERROR( "Fail to provide a border color to the BorderRenderer object" );
+  }
+
+  Property::Value* size = propertyMap.Find( SIZE_NAME );
+  if( !( size && size->Get(mBorderSize) ) )
+  {
+    DALI_LOG_ERROR( "Fail to provide a border size to the BorderRenderer object" );
+  }
+}
+
+void BorderRenderer::SetClipRect( const Rect<int>& clipRect )
+{
+  ControlRenderer::SetClipRect( clipRect );
+
+  //ToDo: renderer responds to the clipRect change
+}
+
+void BorderRenderer::DoSetOnStage( Actor& actor )
+{
+  mBorderColorIndex = (mImpl->mRenderer).RegisterProperty( COLOR_UNIFORM_NAME, mBorderColor );
+  if( mBorderColor.a < 1.f )
+  {
+    (mImpl->mRenderer).GetMaterial().SetBlendMode( BlendingMode::ON );
+  }
+  mBorderSizeIndex = (mImpl->mRenderer).RegisterProperty( SIZE_UNIFORM_NAME, mBorderSize );
+}
+
+void BorderRenderer::Initialize( RendererFactoryCache& factoryCache)
+{
+  mImpl->mGeometry = factoryCache.GetGeometry( RendererFactoryCache::BORDER_GEOMETRY );
+  if( !(mImpl->mGeometry) )
+  {
+    mImpl->mGeometry =  CreateBorderGeometry();
+    factoryCache.SaveGeometry( RendererFactoryCache::QUAD_GEOMETRY, mImpl->mGeometry );
+  }
+
+  mImpl->mShader = factoryCache.GetShader( RendererFactoryCache::BORDER_SHADER );
+  if( !(mImpl->mShader) )
+  {
+    mImpl->mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
+    factoryCache.SaveShader( RendererFactoryCache::COLOR_SHADER, mImpl->mShader );
+  }
+}
+
+void BorderRenderer::SetBorderColor(const Vector4& color)
+{
+  mBorderColor = color;
+
+  if( mImpl->mIsOnStage )
+  {
+    (mImpl->mRenderer).SetProperty( mBorderColorIndex, color );
+    if( color.a < 1.f &&  (mImpl->mRenderer).GetMaterial().GetBlendMode() != BlendingMode::ON)
+    {
+      (mImpl->mRenderer).GetMaterial().SetBlendMode( BlendingMode::ON );
+    }
+  }
+}
+
+void BorderRenderer::SetBorderSize( float size )
+{
+  mBorderSize = size;
+
+  if( mImpl->mIsOnStage )
+  {
+    (mImpl->mRenderer).SetProperty( mBorderSizeIndex, size );
+  }
+}
+
+/**
+ * Vertices and triangles of the border geometry:
+ *
+ * vertex position = aPosition*uSize.xy + aDrift*uBorderSize;
+ *
+ * 0--1--2--3
+ * | /| /| /|
+ * |/ |/ |/ |
+ * 4--5--6--7
+ * | /|  | /|
+ * |/ |  |/ |
+ * 8--9--10-11
+ * | /| /| /|
+ * |/ |/ |/ |
+ * 12-13-14-15
+ */
+Geometry BorderRenderer::CreateBorderGeometry()
+{
+  const float halfWidth = 0.5f;
+  const float halfHeight = 0.5f;
+  struct BorderVertex { Vector2 position; Vector2 drift;};
+  BorderVertex borderVertexData[16] =
+  {
+      { Vector2(-halfWidth, -halfHeight), Vector2(0.f, 0.f) },
+      { Vector2(-halfWidth, -halfHeight), Vector2(1.f, 0.f) },
+      { Vector2(halfWidth, -halfHeight),  Vector2(-1.f, 0.f) },
+      { Vector2(halfWidth, -halfHeight),  Vector2(0.f, 0.f) },
+
+      { Vector2(-halfWidth, -halfHeight), Vector2(0.f, 1.f) },
+      { Vector2(-halfWidth, -halfHeight), Vector2(1.f, 1.f) },
+      { Vector2(halfWidth, -halfHeight),  Vector2(-1.f, 1.f) },
+      { Vector2(halfWidth, -halfHeight),  Vector2(0.f, 1.f) },
+
+      { Vector2(-halfWidth, halfHeight), Vector2(0.f, -1.f) },
+      { Vector2(-halfWidth, halfHeight), Vector2(1.f, -1.f) },
+      { Vector2(halfWidth, halfHeight),  Vector2(-1.f, -1.f) },
+      { Vector2(halfWidth, halfHeight),  Vector2(0.f, -1.f) },
+
+      { Vector2(-halfWidth, halfHeight), Vector2(0.f, 0.f) },
+      { Vector2(-halfWidth, halfHeight), Vector2(1.f, 0.f) },
+      { Vector2(halfWidth, halfHeight),  Vector2(-1.f, 0.f) },
+      { Vector2(halfWidth, halfHeight),  Vector2(0.f, 0.f) },
+  };
+
+  Property::Map borderVertexFormat;
+  borderVertexFormat[POSITION_ATTRIBUTE_NAME] = Property::VECTOR2;
+  borderVertexFormat[DRIFT_ATTRIBUTE_NAME] = Property::VECTOR2;
+  PropertyBuffer borderVertices = PropertyBuffer::New( borderVertexFormat, 16 );
+  borderVertices.SetData(borderVertexData);
+
+  // Create indices
+  unsigned int indexData[48] = { 0, 4, 1, 1, 4, 5, 1, 5, 2, 2, 5, 6, 2, 6,3, 3, 6, 7,
+                                 4, 8, 5, 5, 8, 9, 6, 10, 7, 7, 10, 11,
+                                 8, 12, 9, 9, 12, 13, 9, 13, 10, 10, 13, 14, 10, 11, 14, 11, 14, 15};
+
+  Property::Map indexFormat;
+  indexFormat[INDEX_NAME] = Property::INTEGER;
+  PropertyBuffer indices = PropertyBuffer::New( indexFormat, 48 );
+  indices.SetData(indexData);
+
+  // Create the geometry object
+  Geometry geometry = Geometry::New();
+  geometry.AddVertexBuffer( borderVertices );
+  geometry.SetIndexBuffer( indices );
+
+  return geometry;
+}
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/dali-toolkit/internal/controls/renderers/border/border-renderer.h b/dali-toolkit/internal/controls/renderers/border/border-renderer.h
new file mode 100644 (file)
index 0000000..5a1f575
--- /dev/null
@@ -0,0 +1,128 @@
+#ifndef __DALI_TOOLKIT_INTERNAL_BORDER_RENDERER_H__
+#define __DALI_TOOLKIT_INTERNAL_BORDER_RENDERER_H__
+
+/*
+ * Copyright (c) 2015 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/devel-api/rendering/geometry.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/renderers/control-renderer-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+/**
+ * The renderer which renders a solid color to the control's quad border fixed to a specified size.
+ *
+ * The following properties are required for create a BorderRender
+ *
+ * | %Property Name   | Type        |
+ * |------------------|-------------|
+ * | border-color     | VECTOR4     |
+ * | border-size      | FLOAT       |
+ */
+
+class BorderRenderer : public ControlRenderer
+{
+public:
+
+  /**
+   * @brief Constructor.
+   */
+  BorderRenderer();
+
+  /**
+   * @brief A reference counted object may only be deleted by calling Unreference().
+   */
+  virtual ~BorderRenderer();
+
+public:  // from ControlRenderer
+
+  /**
+   * @copydoc ControlRenderer::Initialize
+   */
+  virtual void Initialize( RendererFactoryCache& factoryCache, const Property::Map& propertyMap );
+
+  /**
+   * @copydoc ControlRenderer::SetClipRect
+   */
+  virtual void SetClipRect( const Rect<int>& clipRect );
+
+protected:
+  /**
+   * @copydoc ControlRenderer::DoSetOnStage
+   */
+  virtual void DoSetOnStage( Actor& actor );
+
+public:
+
+  /**
+   * Request the geometry and shader from the cache, if not available, create and save to the cache for sharing.
+   *
+   * @param[in] factoryCache A pointer pointing to the RendererFactoryCache object
+   */
+  void Initialize( RendererFactoryCache& factoryCache );
+
+  /**
+   * Set the color of the border.
+   * @param[in] color The border color.
+   */
+  void SetBorderColor( const Vector4& color);
+
+  /**
+   * Set the size of the border.
+   * @param[in] size The border size.
+   */
+  void SetBorderSize( float size );
+
+private:
+
+  /**
+   * Create the geometry which presents the border.
+   * @return The border geometry
+   */
+  Geometry CreateBorderGeometry();
+
+  // Undefined
+  BorderRenderer( const BorderRenderer& borderRenderer );
+
+  // Undefined
+  BorderRenderer& operator=( const BorderRenderer& borderRenderer );
+
+private:
+
+  Vector4 mBorderColor;
+  float   mBorderSize;
+
+  Property::Index mBorderColorIndex;
+  Property::Index mBorderSizeIndex;
+};
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif /* __DALI_TOOLKIT_INTERNAL_BORDER_RENDERER_H__ */
index f5eae35..ab589c2 100644 (file)
@@ -59,6 +59,7 @@ public:
   enum GeometryType
   {
     QUAD_GEOMETRY,
+    BORDER_GEOMETRY,
     NINE_PATCH_GEOMETRY,
     NINE_PATCH_BORDER_GEOMETRY,
     GEOMETRY_TYPE_MAX = NINE_PATCH_BORDER_GEOMETRY
index e9ec481..92fd3bf 100644 (file)
@@ -25,6 +25,7 @@
 #include <dali/devel-api/object/type-registry-helper.h>
 
 // Internal HEADER
+#include <dali-toolkit/internal/controls/renderers/border/border-renderer.h>
 #include <dali-toolkit/internal/controls/renderers/color/color-renderer.h>
 #include <dali-toolkit/internal/controls/renderers/gradient/gradient-renderer.h>
 #include <dali-toolkit/internal/controls/renderers/npatch/npatch-renderer.h>
@@ -34,7 +35,9 @@
 namespace
 {
 const char * const RENDERER_TYPE_NAME( "renderer-type" );
+
 const char * const COLOR_RENDERER("color-renderer");
+const char * const BORDER_RENDERER("border-renderer");
 const char * const GRADIENT_RENDERER("gradient-renderer");
 const char * const IMAGE_RENDERER("image-renderer");
 const char * const N_PATCH_RENDERER("n-patch-renderer");
@@ -96,6 +99,10 @@ Toolkit::ControlRenderer RendererFactory::GetControlRenderer( const Property::Ma
     {
       rendererPtr = new NPatchRenderer();
     }
+    else if( typeValue == BORDER_RENDERER )
+    {
+      rendererPtr = new BorderRenderer();
+    }
   }
 
   if( rendererPtr )
@@ -144,6 +151,22 @@ bool RendererFactory::ResetRenderer( Toolkit::ControlRenderer& renderer, const V
   }
 }
 
+Toolkit::ControlRenderer RendererFactory::GetControlRenderer( float borderSize, const Vector4& borderColor )
+{
+  BorderRenderer* rendererPtr = new BorderRenderer();
+
+  if( !mFactoryCache )
+  {
+    mFactoryCache = new RendererFactoryCache();
+  }
+  rendererPtr->Initialize( *( mFactoryCache.Get() ) );
+
+  rendererPtr->SetBorderSize( borderSize );
+  rendererPtr->SetBorderColor( borderColor );
+
+  return Toolkit::ControlRenderer( rendererPtr );
+}
+
 Toolkit::ControlRenderer RendererFactory::GetControlRenderer( const Image& image )
 {
   if( !mFactoryCache )
index d65e747..4ed7e7f 100644 (file)
@@ -65,6 +65,11 @@ public:
   bool ResetRenderer( Toolkit::ControlRenderer& renderer, const Vector4& color );
 
   /**
+   * @copydoc Toolkit::RenderFactory::GetControlRenderer( float, const Vector4& )
+   */
+  Toolkit::ControlRenderer GetControlRenderer( float borderSize, const Vector4& borderColor );
+
+  /**
    * @copydoc Toolkit::RenderFactory::GetControlRenderer( const Image& )
    */
   Toolkit::ControlRenderer GetControlRenderer( const Image& image );
index 3231e6b..6c8c9b7 100644 (file)
@@ -15,6 +15,7 @@ toolkit_src_files = \
    $(toolkit_src_dir)/controls/renderers/control-renderer-impl.cpp \
    $(toolkit_src_dir)/controls/renderers/renderer-factory-cache.cpp \
    $(toolkit_src_dir)/controls/renderers/renderer-factory-impl.cpp \
+   $(toolkit_src_dir)/controls/renderers/border/border-renderer.cpp \
    $(toolkit_src_dir)/controls/renderers/color/color-renderer.cpp \
    $(toolkit_src_dir)/controls/renderers/image/image-renderer.cpp \
    $(toolkit_src_dir)/controls/renderers/npatch/npatch-renderer.cpp \