(Scene3D) Support SceneView CornerRadius and Borderline 77/318377/6
authorEunki, Hong <eunkiki.hong@samsung.com>
Fri, 27 Sep 2024 08:17:25 +0000 (17:17 +0900)
committerEunki Hong <eunkiki.hong@samsung.com>
Thu, 10 Oct 2024 01:45:32 +0000 (01:45 +0000)
Let we allow to apply corner radius and borderline if we use framebuffer.

Change-Id: I8dd9924f0dc9ef933e8383fd126a45b68bd54e72
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
automated-tests/src/dali-scene3d/utc-Dali-SceneView.cpp
dali-scene3d/internal/controls/scene-view/scene-view-impl.cpp
dali-scene3d/internal/controls/scene-view/scene-view-impl.h
dali-scene3d/public-api/controls/scene-view/scene-view.h

index 63d533fc535a255764a4adf05fd9db28b56b0e8a..dfb44addaa93c1b29536dce944a128c0cc16d622 100644 (file)
@@ -27,7 +27,6 @@
 #include <dali-scene3d/public-api/controls/scene-view/scene-view.h>
 #include <dali/devel-api/actors/camera-actor-devel.h>
 
-
 using namespace Dali;
 using namespace Dali::Toolkit;
 
@@ -1200,6 +1199,56 @@ int UtcDaliSceneViewMasking(void)
   END_TEST;
 }
 
+int UtcDaliSceneViewCornerRadius(void)
+{
+  ToolkitTestApplication application;
+
+  Scene3D::SceneView view = Scene3D::SceneView::New();
+  application.GetScene().Add(view);
+
+  DALI_TEST_EQUALS(view.GetProperty<Vector4>(Dali::Scene3D::SceneView::Property::CORNER_RADIUS), Vector4::ZERO, TEST_LOCATION);
+  DALI_TEST_EQUALS(view.GetProperty<int>(Dali::Scene3D::SceneView::Property::CORNER_RADIUS_POLICY), static_cast<int>(Visual::Transform::Policy::ABSOLUTE), TEST_LOCATION);
+
+  Vector4 expectCornerRadius       = Vector4(0.5f, 0.3f, 0.2f, 0.0f);
+  int     expectCornerRadiusPolicy = static_cast<int>(Visual::Transform::Policy::RELATIVE);
+
+  view.UseFramebuffer(true);
+  view.SetProperty(Dali::Scene3D::SceneView::Property::CORNER_RADIUS, expectCornerRadius);
+  view.SetProperty(Dali::Scene3D::SceneView::Property::CORNER_RADIUS_POLICY, expectCornerRadiusPolicy);
+
+  DALI_TEST_EQUALS(view.GetProperty<Vector4>(Dali::Scene3D::SceneView::Property::CORNER_RADIUS), expectCornerRadius, TEST_LOCATION);
+  DALI_TEST_EQUALS(view.GetProperty<int>(Dali::Scene3D::SceneView::Property::CORNER_RADIUS_POLICY), expectCornerRadiusPolicy, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliSceneViewBorderline(void)
+{
+  ToolkitTestApplication application;
+
+  Scene3D::SceneView view = Scene3D::SceneView::New();
+  application.GetScene().Add(view);
+
+  DALI_TEST_EQUALS(view.GetProperty<float>(Dali::Scene3D::SceneView::Property::BORDERLINE_WIDTH), 0.0f, TEST_LOCATION);
+  DALI_TEST_EQUALS(view.GetProperty<Vector4>(Dali::Scene3D::SceneView::Property::BORDERLINE_COLOR), Color::BLACK, TEST_LOCATION);
+  DALI_TEST_EQUALS(view.GetProperty<float>(Dali::Scene3D::SceneView::Property::BORDERLINE_OFFSET), 0.0f, TEST_LOCATION);
+
+  float   expectBorderlineWidth  = 10.0f;
+  Vector4 expectBorderlineColor  = Vector4(0.5f, 0.3f, 0.2f, 0.1f);
+  float   expectBorderlineOffset = -1.0f;
+
+  view.UseFramebuffer(true);
+  view.SetProperty(Dali::Scene3D::SceneView::Property::BORDERLINE_WIDTH, expectBorderlineWidth);
+  view.SetProperty(Dali::Scene3D::SceneView::Property::BORDERLINE_COLOR, expectBorderlineColor);
+  view.SetProperty(Dali::Scene3D::SceneView::Property::BORDERLINE_OFFSET, expectBorderlineOffset);
+
+  DALI_TEST_EQUALS(view.GetProperty<float>(Dali::Scene3D::SceneView::Property::BORDERLINE_WIDTH), expectBorderlineWidth, TEST_LOCATION);
+  DALI_TEST_EQUALS(view.GetProperty<Vector4>(Dali::Scene3D::SceneView::Property::BORDERLINE_COLOR), expectBorderlineColor, TEST_LOCATION);
+  DALI_TEST_EQUALS(view.GetProperty<float>(Dali::Scene3D::SceneView::Property::BORDERLINE_OFFSET), expectBorderlineOffset, TEST_LOCATION);
+
+  END_TEST;
+}
+
 namespace
 {
 static bool              gCaptureFinishedCalled{false};
@@ -1213,9 +1262,9 @@ void OnCaptureFinished(Scene3D::SceneView sceneView, int32_t captureId, const To
   gCapturedImageUrl      = capturedImageUrl;
 }
 
-static int32_t                                             gCapturedCount{0};
-static std::vector<int32_t>                                gCaptureIds;
-static std::vector<Toolkit::ImageUrl>                      gCapturedImageUrls;
+static int32_t                        gCapturedCount{0};
+static std::vector<int32_t>           gCaptureIds;
+static std::vector<Toolkit::ImageUrl> gCapturedImageUrls;
 
 void OnCaptureMultipleFinished(Scene3D::SceneView sceneView, int32_t captureId, const Toolkit::ImageUrl& capturedImageUrl)
 {
@@ -1259,7 +1308,7 @@ int UtcDaliSceneViewCapture01(void)
   view.Add(camera);
 
   gCaptureFinishedCalled = false;
-  gCaptureId = -1;
+  gCaptureId             = -1;
   gCapturedImageUrl.Reset();
   int32_t captureId = view.Capture(camera, Vector2(300, 300));
 
@@ -1277,7 +1326,7 @@ int UtcDaliSceneViewCapture01(void)
   Toolkit::ImageUrl tempImageUrl = gCapturedImageUrl;
 
   gCaptureFinishedCalled = false;
-  gCaptureId = -1;
+  gCaptureId             = -1;
   gCapturedImageUrl.Reset();
   int32_t captureId2 = view.Capture(camera, Vector2(400, 400));
 
@@ -1333,7 +1382,7 @@ int UtcDaliSceneViewCapture02(void)
   gCapturedCount = 0;
   gCaptureIds.clear();
   gCapturedImageUrls.clear();
-  int32_t captureId = view.Capture(camera, Vector2(300, 300));
+  int32_t captureId  = view.Capture(camera, Vector2(300, 300));
   int32_t captureId2 = view.Capture(camera, Vector2(300, 300));
 
   application.SendNotification();
@@ -1393,7 +1442,7 @@ int UtcDaliSceneViewCaptureCancel(void)
   view.Add(camera);
 
   gCaptureFinishedCalled = false;
-  gCaptureId = -1;
+  gCaptureId             = -1;
   gCapturedImageUrl.Reset();
   int32_t captureId = view.Capture(camera, Vector2(300, 300));
 
@@ -1403,9 +1452,8 @@ int UtcDaliSceneViewCaptureCancel(void)
   DALI_TEST_EQUALS(gCaptureId, captureId, TEST_LOCATION);
   DALI_TEST_EQUALS(!!gCapturedImageUrl, false, TEST_LOCATION);
 
-
   gCaptureFinishedCalled = false;
-  gCaptureId = -1;
+  gCaptureId             = -1;
   gCapturedImageUrl.Reset();
 
   application.SendNotification();
@@ -1453,7 +1501,7 @@ int UtcDaliSceneViewCaptureFailed(void)
   view.Add(camera);
 
   gCaptureFinishedCalled = false;
-  gCaptureId = -1;
+  gCaptureId             = -1;
   gCapturedImageUrl.Reset();
   int32_t captureId = view.Capture(camera, Vector2(300, 300));
 
@@ -1466,7 +1514,7 @@ int UtcDaliSceneViewCaptureFailed(void)
   DALI_TEST_EQUALS(!!gCapturedImageUrl, false, TEST_LOCATION);
 
   gCaptureFinishedCalled = false;
-  gCaptureId = -1;
+  gCaptureId             = -1;
   gCapturedImageUrl.Reset();
 
   application.SendNotification();
@@ -1505,7 +1553,7 @@ int UtcDaliSceneViewCaptureFailed2(void)
   view.Add(camera);
 
   gCaptureFinishedCalled = false;
-  gCaptureId = -1;
+  gCaptureId             = -1;
   gCapturedImageUrl.Reset();
   int32_t captureId = view.Capture(camera, Vector2(300, 300));
 
@@ -1577,10 +1625,10 @@ int UtcDaliSceneViewRenderTaskOrdering(void)
   ToolkitTestApplication application;
   tet_infoline("UtcDaliPanelRenderTaskOrdering");
 
-  Integration::Scene scene = application.GetScene();
-  RenderTaskList taskList = scene.GetRenderTaskList();
+  Integration::Scene scene    = application.GetScene();
+  RenderTaskList     taskList = scene.GetRenderTaskList();
 
-  uint32_t defaultTaskCount = taskList.GetTaskCount();
+  uint32_t   defaultTaskCount  = taskList.GetTaskCount();
   RenderTask defaultRenderTask = taskList.GetTask(defaultTaskCount - 1);
   tet_printf("default Task Cnt : %d\n", defaultTaskCount);
 
@@ -1588,8 +1636,8 @@ int UtcDaliSceneViewRenderTaskOrdering(void)
   sceneView.UseFramebuffer(true);
   scene.Add(sceneView);
 
-  uint32_t afterSceneViewTaskCount = taskList.GetTaskCount();
-  RenderTask sceneViewRenderTask = taskList.GetTask(afterSceneViewTaskCount - 1);
+  uint32_t   afterSceneViewTaskCount = taskList.GetTaskCount();
+  RenderTask sceneViewRenderTask     = taskList.GetTask(afterSceneViewTaskCount - 1);
   tet_printf("after SceneView Task cnt : %d\n", afterSceneViewTaskCount);
   DALI_TEST_CHECK(afterSceneViewTaskCount == defaultTaskCount + 1);
 
@@ -1600,10 +1648,10 @@ int UtcDaliSceneViewRenderTaskOrdering(void)
 
   sceneView.Add(control1);
 
-  uint32_t afterBlurEffectTaskCount = taskList.GetTaskCount();
-  RenderTask blurSourceRenderTask = taskList.GetTask(afterBlurEffectTaskCount - 3);
+  uint32_t   afterBlurEffectTaskCount = taskList.GetTaskCount();
+  RenderTask blurSourceRenderTask     = taskList.GetTask(afterBlurEffectTaskCount - 3);
   RenderTask blurHorizontalRenderTask = taskList.GetTask(afterBlurEffectTaskCount - 2);
-  RenderTask blurVerticalRenderTask = taskList.GetTask(afterBlurEffectTaskCount - 1);
+  RenderTask blurVerticalRenderTask   = taskList.GetTask(afterBlurEffectTaskCount - 1);
   tet_printf("after blurEffect Task cnt : %d\n", afterBlurEffectTaskCount);
   DALI_TEST_CHECK(afterBlurEffectTaskCount == afterSceneViewTaskCount + 3);
 
index 52aee16d3a81aa06dced3ba1ac8905c9878cb5a5..b142f9ff747d6783769065aed7342f5c73f67528 100644 (file)
@@ -64,9 +64,14 @@ DALI_TYPE_REGISTRATION_BEGIN(Scene3D::SceneView, Toolkit::Control, Create);
 DALI_PROPERTY_REGISTRATION(Scene3D, SceneView, "AlphaMaskUrl", STRING, ALPHA_MASK_URL)
 DALI_PROPERTY_REGISTRATION(Scene3D, SceneView, "MaskContentScale", FLOAT, MASK_CONTENT_SCALE)
 DALI_PROPERTY_REGISTRATION(Scene3D, SceneView, "CropToMask", BOOLEAN, CROP_TO_MASK)
+DALI_PROPERTY_REGISTRATION(Scene3D, SceneView, "CornerRadius", VECTOR4, CORNER_RADIUS)
+DALI_PROPERTY_REGISTRATION(Scene3D, SceneView, "CornerRadiusPolicy", FLOAT, CORNER_RADIUS_POLICY)
+DALI_PROPERTY_REGISTRATION(Scene3D, SceneView, "BorderlineWidth", FLOAT, BORDERLINE_WIDTH)
+DALI_PROPERTY_REGISTRATION(Scene3D, SceneView, "BorderlineColor", VECTOR4, BORDERLINE_COLOR)
+DALI_PROPERTY_REGISTRATION(Scene3D, SceneView, "BorderlineOffset", FLOAT, BORDERLINE_OFFSET)
 DALI_TYPE_REGISTRATION_END()
 
-Property::Index    RENDERING_BUFFER        = Dali::Toolkit::Control::CONTROL_PROPERTY_END_INDEX + 1;
+Property::Index           RENDERING_BUFFER        = Dali::Toolkit::Control::CONTROL_PROPERTY_END_INDEX + 1;
 static constexpr float    MIM_CAPTURE_SIZE        = 1.0f;
 static constexpr int32_t  DEFAULT_ORIENTATION     = 0;
 static constexpr int32_t  INVALID_INDEX           = -1;
@@ -171,8 +176,7 @@ void SetShadowLightConstraint(Dali::CameraActor selectedCamera, Dali::CameraActo
 
   // Compute ViewProjectionMatrix and store it to "tempViewProjectionMatrix" property
   auto       tempViewProjectionMatrixIndex = shadowLightCamera.RegisterProperty("tempViewProjectionMatrix", Matrix::IDENTITY);
-  Constraint projectionMatrixConstraint    = Constraint::New<Matrix>(shadowLightCamera, tempViewProjectionMatrixIndex, [](Matrix& output, const PropertyInputContainer& inputs)
-                                                                  {
+  Constraint projectionMatrixConstraint    = Constraint::New<Matrix>(shadowLightCamera, tempViewProjectionMatrixIndex, [](Matrix& output, const PropertyInputContainer& inputs) {
     Matrix worldMatrix  = inputs[0]->GetMatrix();
     float  tangentFov_2 = tanf(inputs[4]->GetFloat());
     float  nearDistance = inputs[5]->GetFloat();
@@ -333,6 +337,7 @@ SceneView::SceneView()
   mSkyboxIntensity(1.0f),
   mFailedCaptureCallbacks(nullptr),
   mLightObservers(),
+  mCornerRadiusPolicy(static_cast<int>(Toolkit::Visual::Transform::Policy::ABSOLUTE)),
   mShaderManager(new Scene3D::Loader::ShaderManager())
 {
 }
@@ -709,8 +714,7 @@ void SceneView::SetShadow(Scene3D::Light light)
     return;
   }
 
-  auto foundLight = std::find_if(mLights.begin(), mLights.end(), [light](std::pair<Scene3D::Light, bool> lightEntity) -> bool
-                                 { return (lightEntity.second && lightEntity.first == light); });
+  auto foundLight = std::find_if(mLights.begin(), mLights.end(), [light](std::pair<Scene3D::Light, bool> lightEntity) -> bool { return (lightEntity.second && lightEntity.first == light); });
 
   if(foundLight == mLights.end())
   {
@@ -927,7 +931,7 @@ int32_t SceneView::Capture(Dali::CameraActor camera, const Vector2& size)
     capturePossible = false;
   }
 
-  uint32_t width = std::max(1u, unsigned(size.width));
+  uint32_t width  = std::max(1u, unsigned(size.width));
   uint32_t height = std::max(1u, unsigned(size.height));
   if(width > Dali::GetMaxTextureSize() || height > Dali::GetMaxTextureSize())
   {
@@ -1051,9 +1055,12 @@ void SceneView::SetAlphaMaskUrl(std::string& alphaMaskUrl)
 {
   if(mAlphaMaskUrl != alphaMaskUrl)
   {
-    mAlphaMaskUrl           = alphaMaskUrl;
-    mMaskingPropertyChanged = true;
-    UpdateRenderTask();
+    mAlphaMaskUrl = alphaMaskUrl;
+    if(mUseFrameBuffer)
+    {
+      mMaskingPropertyChanged = true;
+      UpdateRenderTask();
+    }
   }
 }
 
@@ -1067,8 +1074,11 @@ void SceneView::SetMaskContentScaleFactor(float maskContentScaleFactor)
   if(mMaskContentScaleFactor != maskContentScaleFactor)
   {
     mMaskContentScaleFactor = maskContentScaleFactor;
-    mMaskingPropertyChanged = true;
-    UpdateRenderTask();
+    if(mUseFrameBuffer)
+    {
+      mMaskingPropertyChanged = true;
+      UpdateRenderTask();
+    }
   }
 }
 
@@ -1081,9 +1091,12 @@ void SceneView::EnableCropToMask(bool enableCropToMask)
 {
   if(mCropToMask != enableCropToMask)
   {
-    mCropToMask             = enableCropToMask;
-    mMaskingPropertyChanged = true;
-    UpdateRenderTask();
+    mCropToMask = enableCropToMask;
+    if(mUseFrameBuffer)
+    {
+      mMaskingPropertyChanged = true;
+      UpdateRenderTask();
+    }
   }
 }
 
@@ -1092,6 +1105,96 @@ bool SceneView::IsEnabledCropToMask()
   return mCropToMask;
 }
 
+void SceneView::SetCornerRadius(Vector4 cornerRadius)
+{
+  if(mCornerRadius != cornerRadius)
+  {
+    mCornerRadius = cornerRadius;
+    if(mUseFrameBuffer)
+    {
+      mDecoratedVisualPropertyChanged = true;
+      UpdateRenderTask();
+    }
+  }
+}
+
+Vector4 SceneView::GetCornerRadius() const
+{
+  return mCornerRadius;
+}
+
+void SceneView::SetCornerRadiusPolicy(int cornerRadiusPolicy)
+{
+  if(mCornerRadiusPolicy != cornerRadiusPolicy)
+  {
+    mCornerRadiusPolicy = cornerRadiusPolicy;
+    if(mUseFrameBuffer)
+    {
+      mDecoratedVisualPropertyChanged = true;
+      UpdateRenderTask();
+    }
+  }
+}
+
+int SceneView::GetCornerRadiusPolicy() const
+{
+  return mCornerRadiusPolicy;
+}
+
+void SceneView::SetBorderlineWidth(float borderlineWidth)
+{
+  if(!Dali::Equals(mBorderlineWidth, borderlineWidth))
+  {
+    mBorderlineWidth = borderlineWidth;
+    if(mUseFrameBuffer)
+    {
+      mDecoratedVisualPropertyChanged = true;
+      UpdateRenderTask();
+    }
+  }
+}
+
+float SceneView::GetBorderlineWidth() const
+{
+  return mBorderlineWidth;
+}
+
+void SceneView::SetBorderlineColor(Vector4 borderlineColor)
+{
+  if(mBorderlineColor != borderlineColor)
+  {
+    mBorderlineColor = borderlineColor;
+    if(mUseFrameBuffer)
+    {
+      mDecoratedVisualPropertyChanged = true;
+      UpdateRenderTask();
+    }
+  }
+}
+
+Vector4 SceneView::GetBorderlineColor() const
+{
+  return mBorderlineColor;
+}
+
+void SceneView::SetBorderlineOffset(float borderlineOffset)
+{
+  if(!Dali::Equals(mBorderlineOffset, borderlineOffset))
+  {
+    mBorderlineOffset = borderlineOffset;
+    if(mUseFrameBuffer)
+    {
+      mDecoratedVisualPropertyChanged = true;
+      UpdateRenderTask();
+    }
+  }
+}
+
+float SceneView::GetBorderlineOffset() const
+{
+  return mBorderlineOffset;
+}
+
 Dali::RenderTask SceneView::GetRenderTask()
 {
   return mRenderTask;
@@ -1123,6 +1226,31 @@ void SceneView::SetProperty(BaseObject* object, Property::Index index, const Pro
         sceneViewImpl.EnableCropToMask(value.Get<bool>());
         break;
       }
+      case Scene3D::SceneView::Property::CORNER_RADIUS:
+      {
+        sceneViewImpl.SetCornerRadius(value.Get<Vector4>());
+        break;
+      }
+      case Scene3D::SceneView::Property::CORNER_RADIUS_POLICY:
+      {
+        sceneViewImpl.SetCornerRadiusPolicy(value.Get<int>());
+        break;
+      }
+      case Scene3D::SceneView::Property::BORDERLINE_WIDTH:
+      {
+        sceneViewImpl.SetBorderlineWidth(value.Get<float>());
+        break;
+      }
+      case Scene3D::SceneView::Property::BORDERLINE_COLOR:
+      {
+        sceneViewImpl.SetBorderlineColor(value.Get<Vector4>());
+        break;
+      }
+      case Scene3D::SceneView::Property::BORDERLINE_OFFSET:
+      {
+        sceneViewImpl.SetBorderlineOffset(value.Get<float>());
+        break;
+      }
     }
   }
 }
@@ -1154,6 +1282,31 @@ Property::Value SceneView::GetProperty(BaseObject* object, Property::Index index
         value = sceneViewImpl.IsEnabledCropToMask();
         break;
       }
+      case Scene3D::SceneView::Property::CORNER_RADIUS:
+      {
+        value = sceneViewImpl.GetCornerRadius();
+        break;
+      }
+      case Scene3D::SceneView::Property::CORNER_RADIUS_POLICY:
+      {
+        value = sceneViewImpl.GetCornerRadiusPolicy();
+        break;
+      }
+      case Scene3D::SceneView::Property::BORDERLINE_WIDTH:
+      {
+        value = sceneViewImpl.GetBorderlineWidth();
+        break;
+      }
+      case Scene3D::SceneView::Property::BORDERLINE_COLOR:
+      {
+        value = sceneViewImpl.GetBorderlineColor();
+        break;
+      }
+      case Scene3D::SceneView::Property::BORDERLINE_OFFSET:
+      {
+        value = sceneViewImpl.GetBorderlineOffset();
+        break;
+      }
     }
   }
   return value;
@@ -1213,7 +1366,7 @@ void SceneView::OnSceneConnection(int depth)
   }
 
   CameraActor selectedCamera = GetSelectedCamera();
-  selectedCamera = selectedCamera ? selectedCamera : mDefaultCamera;
+  selectedCamera             = selectedCamera ? selectedCamera : mDefaultCamera;
   if(selectedCamera)
   {
     UpdateCamera(selectedCamera);
@@ -1242,7 +1395,7 @@ void SceneView::OnSceneDisconnection()
   }
   tempContainer.clear();
 
-  for(auto && capture : mCaptureContainer)
+  for(auto&& capture : mCaptureContainer)
   {
     ResetCaptureData(capture.second);
   }
@@ -1411,6 +1564,7 @@ void SceneView::UpdateRenderTask()
          !Dali::Equals(currentFrameBuffer.GetColorTexture().GetWidth(), width) ||
          !Dali::Equals(currentFrameBuffer.GetColorTexture().GetHeight(), height) ||
          mMaskingPropertyChanged ||
+         mDecoratedVisualPropertyChanged ||
          mWindowSizeChanged)
       {
         mRootLayer.SetProperty(Dali::Actor::Property::COLOR_MODE, ColorMode::USE_OWN_COLOR);
@@ -1438,6 +1592,17 @@ void SceneView::UpdateRenderTask()
           imagePropertyMap.Insert(Toolkit::DevelImageVisual::Property::MASKING_TYPE, Toolkit::DevelImageVisual::MaskingType::MASKING_ON_RENDERING);
           Self().RegisterProperty(Y_FLIP_MASK_TEXTURE, FLIP_MASK_TEXTURE);
         }
+        if(mCornerRadius != Vector4::ZERO)
+        {
+          imagePropertyMap.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, mCornerRadius);
+          imagePropertyMap.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, mCornerRadiusPolicy);
+        }
+        if(!Dali::EqualsZero(mBorderlineWidth))
+        {
+          imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, mBorderlineWidth);
+          imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, mBorderlineColor);
+          imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, mBorderlineOffset);
+        }
 
         mVisual = Toolkit::VisualFactory::Get().CreateVisual(imagePropertyMap);
         Toolkit::DevelControl::RegisterVisual(*this, RENDERING_BUFFER, mVisual);
@@ -1446,8 +1611,9 @@ void SceneView::UpdateRenderTask()
         mRenderTask.SetClearEnabled(true);
         mRenderTask.SetClearColor(Color::TRANSPARENT);
 
-        mMaskingPropertyChanged = false;
-        mWindowSizeChanged      = false;
+        mMaskingPropertyChanged         = false;
+        mDecoratedVisualPropertyChanged = false;
+        mWindowSizeChanged              = false;
       }
     }
     else
@@ -1689,8 +1855,7 @@ void SceneView::UpdateShadowMapBuffer(uint32_t shadowMapSize)
 
 void SceneView::OnCaptureFinished(Dali::RenderTask& task)
 {
-  auto iter = std::find_if(mCaptureContainer.begin(), mCaptureContainer.end(), [task](std::pair<Dali::RenderTask, std::shared_ptr<CaptureData>> item)
-                           { return item.first == task; });
+  auto iter = std::find_if(mCaptureContainer.begin(), mCaptureContainer.end(), [task](std::pair<Dali::RenderTask, std::shared_ptr<CaptureData>> item) { return item.first == task; });
 
   if(iter != mCaptureContainer.end())
   {
@@ -1711,8 +1876,8 @@ void SceneView::OnCaptureFinished(Dali::RenderTask& task)
 bool SceneView::OnTimeOut()
 {
   mTimerTickCount++;
-  auto                     self = Self();
-  Dali::Scene3D::SceneView handle(Dali::Scene3D::SceneView::DownCast(self));
+  auto                                                                   self = Self();
+  Dali::Scene3D::SceneView                                               handle(Dali::Scene3D::SceneView::DownCast(self));
   std::vector<std::pair<Dali::RenderTask, std::shared_ptr<CaptureData>>> tempContainer;
   for(auto&& capture : mCaptureContainer)
   {
@@ -1727,14 +1892,14 @@ bool SceneView::OnTimeOut()
     mCaptureFinishedSignal.Emit(handle, capture.second->mCaptureId, Dali::Toolkit::ImageUrl());
   }
 
-  for(auto && capture : tempContainer)
+  for(auto&& capture : tempContainer)
   {
     ResetCaptureData(capture.second);
   }
   tempContainer.clear();
 
   int32_t tickCount = mTimerTickCount;
-  auto it = std::remove_if(mCaptureContainer.begin(), mCaptureContainer.end(), [tickCount](std::pair<Dali::RenderTask, std::shared_ptr<CaptureData>> item) {
+  auto    it        = std::remove_if(mCaptureContainer.begin(), mCaptureContainer.end(), [tickCount](std::pair<Dali::RenderTask, std::shared_ptr<CaptureData>> item) {
     return item.second->mStartTick + 1 < tickCount;
   });
   mCaptureContainer.erase(it, mCaptureContainer.end());
@@ -1779,7 +1944,7 @@ void SceneView::RequestCameraTransition()
 {
   if(mTransitionSourceCamera && mTransitionDestinationCamera && !(mTransitionSourceCamera == mTransitionDestinationCamera))
   {
-    Vector3 sourceWorldPosition = mTransitionSourceCamera.GetProperty<Vector3>(Dali::Actor::Property::WORLD_POSITION);
+    Vector3    sourceWorldPosition    = mTransitionSourceCamera.GetProperty<Vector3>(Dali::Actor::Property::WORLD_POSITION);
     Quaternion sourceWorldOrientation = mTransitionSourceCamera.GetProperty<Quaternion>(Dali::Actor::Property::WORLD_ORIENTATION);
 
     if(!CheckInside(mRootLayer, mTransitionDestinationCamera))
@@ -1787,9 +1952,9 @@ void SceneView::RequestCameraTransition()
       mRootLayer.Add(mTransitionDestinationCamera);
     }
 
-    Vector3 destinationWorldPosition;
-    Quaternion destinationWorldOrientation;
-    Vector3 destinationWorldScale;
+    Vector3      destinationWorldPosition;
+    Quaternion   destinationWorldOrientation;
+    Vector3      destinationWorldScale;
     Dali::Matrix destinationWorldTransform = Dali::DevelActor::GetWorldTransform(mTransitionDestinationCamera);
     destinationWorldTransform.GetTransformComponents(destinationWorldPosition, destinationWorldOrientation, destinationWorldScale);
 
@@ -1824,7 +1989,7 @@ void SceneView::RequestCameraTransition()
     Dali::DevelCameraActor::ProjectionDirection destinationProjectionDirection = mTransitionDestinationCamera.GetProperty<Dali::DevelCameraActor::ProjectionDirection>(Dali::DevelCameraActor::Property::PROJECTION_DIRECTION);
     if(mTransitionDestinationCamera.GetProjectionMode() == Dali::Camera::ProjectionMode::PERSPECTIVE_PROJECTION)
     {
-      float sourceFieldOfView = mTransitionSourceCamera.GetFieldOfView();
+      float sourceFieldOfView      = mTransitionSourceCamera.GetFieldOfView();
       float destinationFieldOfView = mTransitionDestinationCamera.GetFieldOfView();
 
       if(sourceProjectionDirection != destinationProjectionDirection)
@@ -1847,7 +2012,7 @@ void SceneView::RequestCameraTransition()
     }
     else
     {
-      float sourceOrthographicSize = mTransitionSourceCamera.GetProperty<float>(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE);
+      float sourceOrthographicSize      = mTransitionSourceCamera.GetProperty<float>(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE);
       float destinationOrthographicSize = mTransitionDestinationCamera.GetProperty<float>(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE);
 
       if(sourceProjectionDirection != destinationProjectionDirection)
@@ -1870,7 +2035,7 @@ void SceneView::RequestCameraTransition()
     }
 
     float destinationNearPlaneDistance = mTransitionDestinationCamera.GetNearClippingPlane();
-    float destinationFarPlaneDistance = mTransitionDestinationCamera.GetFarClippingPlane();
+    float destinationFarPlaneDistance  = mTransitionDestinationCamera.GetFarClippingPlane();
     mTransitionCamera.SetNearClippingPlane(std::min(mTransitionSourceCamera.GetNearClippingPlane(), destinationNearPlaneDistance));
     mTransitionCamera.SetFarClippingPlane(std::max(mTransitionSourceCamera.GetFarClippingPlane(), destinationFarPlaneDistance));
 
index 86d3f9e0382de7236da331d5a9de24e177a0b071..c436a252c203e13fdf218fd63b2a7f462b7accbb 100644 (file)
@@ -338,6 +338,66 @@ public:
    */
   bool IsEnabledCropToMask();
 
+  /**
+   * @brief Sets the radius value of each corner.
+   * @param[in] cornerRadius Radius value of each corner.
+   */
+  void SetCornerRadius(Vector4 cornerRadius);
+
+  /**
+   * @brief Retrieves the radius value of each corner.
+   * @return The radius value of each corner.
+   */
+  Vector4 GetCornerRadius() const;
+
+  /**
+   * @brief Sets the policy of corner radius value.
+   * @param[in] cornerRadiusPolicy Policy of corner radius value.
+   */
+  void SetCornerRadiusPolicy(int cornerRadiusPolicy);
+
+  /**
+   * @brief Retrieves the policy of corner radius value.
+   * @return The policy of corner radius value.
+   */
+  int GetCornerRadiusPolicy() const;
+
+  /**
+   * @brief Sets the width of borderline.
+   * @param[in] borderlineWidth The width of borderline.
+   */
+  void SetBorderlineWidth(float borderlineWidth);
+
+  /**
+   * @brief Retrieves the width of borderline.
+   * @return The width of borderline.
+   */
+  float GetBorderlineWidth() const;
+
+  /**
+   * @brief Sets the color of borderline.
+   * @param[in] borderlineColor The color of borderline.
+   */
+  void SetBorderlineColor(Vector4 borderlineColor);
+
+  /**
+   * @brief Retrieves the color of borderline.
+   * @return The color of borderline.
+   */
+  Vector4 GetBorderlineColor() const;
+
+  /**
+   * @brief Sets the offset of borderline.
+   * @param[in] borderlineOffset The offset of borderline.
+   */
+  void SetBorderlineOffset(float borderlineOffset);
+
+  /**
+   * @brief Retrieves the offset of borderline.
+   * @return The offset of borderline.
+   */
+  float GetBorderlineOffset() const;
+
   /**
    * @brief Gets current RenderTask
    */
@@ -617,6 +677,17 @@ private: // Implementation of Processor
   bool        mCropToMask{true};
   bool        mMaskingPropertyChanged{false};
 
+  // Corner Radius
+  Vector4 mCornerRadius{Vector4::ZERO};
+  int     mCornerRadiusPolicy; ///< Should be initialize at .cpp
+
+  // Borderline
+  float   mBorderlineWidth{0.0f};
+  Vector4 mBorderlineColor{Color::BLACK};
+  float   mBorderlineOffset{0.0f};
+
+  bool mDecoratedVisualPropertyChanged{false};
+
   // Shader Factory
   Dali::Scene3D::Loader::ShaderManagerPtr mShaderManager;
 
index 4e72412cbb09ed3c91355e183b7976b05bbd50c1..d9ff7ff655d3113d44e3d3e1eeea933f9584f369 100644 (file)
@@ -149,11 +149,58 @@ public:
        * @note If this is false, then the mask is scaled to fit the rendered result before being applied.
        */
       CROP_TO_MASK,
+
+      /**
+       * @brief The radius for the rounded corners of the scene view.
+       * @details Name "cornerRadius", type Prooperty::VECTOR4, The radius for the rounded corners of the scene view.
+       * @note By default, it is Vector::ZERO.
+       * @note Corner radius is only available when framebuffer is used.
+       * @note Each radius will clamp internally to the half of smaller of the SceneView width and height.
+       * @note Radius value are used in clockwise order from top-left-corner to bottom-left-corner.
+       *       When radius is Vector4(x, y, z, w)
+       *       x    y
+       *        +--+
+       *        |  |
+       *        +--+
+       *       w    z
+       */
+      CORNER_RADIUS,
+
+      /**
+       * @brief Whether the corner radius value is relative (percentage [0.0f to 0.5f] of the SceneView size) or absolute (in world units).
+       * @details Name "cornerRadiusPolicy", type Property::INTEGER.
+       * @see Dali::Visual::Transform::Policy::Type
+       * @note By default, it is ABSOLUTE to the SceneView's size.
+       *       If it it RELATIVE, the corner radius value is relative to the smaller of the SceneView width and height.
+       */
+      CORNER_RADIUS_POLICY,
+
+      /**
+       * @brief The width for the borderline of the scene view.
+       * @details Name "borderlineWidth", type Property::FLOAT.
+       * @note Optional. Default value is 0.0f.
+       * @note Borderline is only available when framebuffer is used.
+       */
+      BORDERLINE_WIDTH,
+
+      /**
+       * @brief The color for the borderline of the scene view.
+       * @details Name "borderlineColor", type Property::VECTOR4.
+       * @note Default value is Color::BLACK.
+       */
+      BORDERLINE_COLOR,
+
+      /**
+       * @brief The offset from the scene view borderline (recommend [-1.0f to 1.0f]).
+       * @details Name "borderlineOffset", type Property::FLOAT
+       * @note Default value is 0.0f.
+       * @note This value will clamp internally to [-1.0f to 1.0f].
+       */
+      BORDERLINE_OFFSET,
     };
   };
 
 public:
-
   /**
    * @brief Typedef for capture finished signals sent by this class.
    *