Deprecate VisualRenderer::MIX_COLOR + Visual MIX_COLOR Animate as Vector4 61/317461/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Tue, 10 Sep 2024 12:17:43 +0000 (21:17 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Tue, 10 Sep 2024 12:21:14 +0000 (21:21 +0900)
Let we change visual's MIX_COLOR property use Renderer::Property::MIX_COLOR,
and make it animate as Vector4 type.

Change-Id: I6b38299e11da79c9583ca9372ddee4e788e2585d
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
examples/color-visual/color-visual-example.cpp
examples/text-label/text-label-example.cpp

index ca2f9d7..40719cb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -93,10 +93,9 @@ public:
 
       if(!mBlurEnabled)
       {
-        animation.AnimateTo(DevelControl::GetVisualProperty(mImageView, ImageView::Property::IMAGE, Visual::Property::MIX_COLOR), Vector3(1.0f, 0.0f, 0.0f));
-        animation.AnimateTo(DevelControl::GetVisualProperty(mImageView, ImageView::Property::IMAGE, Visual::Property::OPACITY), 0.5f);
+        animation.AnimateTo(DevelControl::GetVisualProperty(mImageView, ImageView::Property::IMAGE, Visual::Property::MIX_COLOR), Vector4(1.0f, 0.0f, 0.0f, 0.5f));
         animation.AnimateTo(DevelControl::GetVisualProperty(mImageView, ImageView::Property::IMAGE, DevelVisual::Property::CORNER_RADIUS), CORNER_RADIUS_VALUE);
-        animation.AnimateTo(DevelControl::GetVisualProperty(mImageView, DevelControl::Property::SHADOW, ColorVisual::Property::MIX_COLOR), Vector3(0.0f, 0.0f, 1.0f));
+        animation.AnimateTo(DevelControl::GetVisualProperty(mImageView, DevelControl::Property::SHADOW, ColorVisual::Property::MIX_COLOR), Vector4(0.0f, 0.0f, 1.0f, 0.5f));
         animation.AnimateTo(DevelControl::GetVisualProperty(mImageView, DevelControl::Property::SHADOW, DevelVisual::Property::CORNER_RADIUS), SHADOW_CORNER_RADIUS_VALUE);
         animation.AnimateTo(DevelControl::GetVisualProperty(mImageView, DevelControl::Property::SHADOW, DevelColorVisual::Property::BLUR_RADIUS), BLUR_RADIUS_VALUE);
         animation.AnimateTo(DevelControl::GetVisualProperty(mImageView, DevelControl::Property::SHADOW, Visual::Transform::Property::OFFSET), BLUR_OFFSET_VALUE);
@@ -104,10 +103,9 @@ public:
       }
       else
       {
-        animation.AnimateTo(DevelControl::GetVisualProperty(mImageView, ImageView::Property::IMAGE, Visual::Property::MIX_COLOR), Vector3(1.0f, 1.0f, 1.0f));
-        animation.AnimateTo(DevelControl::GetVisualProperty(mImageView, ImageView::Property::IMAGE, Visual::Property::OPACITY), 1.0f);
+        animation.AnimateTo(DevelControl::GetVisualProperty(mImageView, ImageView::Property::IMAGE, Visual::Property::MIX_COLOR), Vector4(1.0f, 1.0f, 1.0f, 1.0f));
         animation.AnimateTo(DevelControl::GetVisualProperty(mImageView, ImageView::Property::IMAGE, DevelVisual::Property::CORNER_RADIUS), Vector4::ZERO);
-        animation.AnimateTo(DevelControl::GetVisualProperty(mImageView, DevelControl::Property::SHADOW, ColorVisual::Property::MIX_COLOR), Vector3(0.0f, 0.0f, 0.0f));
+        animation.AnimateTo(DevelControl::GetVisualProperty(mImageView, DevelControl::Property::SHADOW, ColorVisual::Property::MIX_COLOR), Vector4(0.0f, 0.0f, 0.0f, 0.5f));
         animation.AnimateTo(DevelControl::GetVisualProperty(mImageView, DevelControl::Property::SHADOW, DevelVisual::Property::CORNER_RADIUS), Vector4::ZERO);
         animation.AnimateTo(DevelControl::GetVisualProperty(mImageView, DevelControl::Property::SHADOW, DevelColorVisual::Property::BLUR_RADIUS), 0.0f);
         animation.AnimateTo(DevelControl::GetVisualProperty(mImageView, DevelControl::Property::SHADOW, Visual::Transform::Property::OFFSET), Vector2::ZERO);
index bc2765c..ba97971 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -112,9 +112,12 @@ struct HSVColorConstraint
   {
   }
 
-  void operator()(Vector3& current, const PropertyInputContainer& inputs)
+  void operator()(Vector4& current, const PropertyInputContainer& inputs)
   {
-    current = hsv2rgb(Vector3(inputs[0]->GetFloat(), saturation, value));
+    auto rgbColor = hsv2rgb(Vector3(inputs[0]->GetFloat(), saturation, value));
+    current.r     = rgbColor.r;
+    current.g     = rgbColor.g;
+    current.b     = rgbColor.b;
   }
 
   Vector3 hsv2rgb(Vector3 colorHSV)
@@ -207,7 +210,7 @@ public:
     mContainer = Control::New();
     mContainer.SetProperty(Dali::Actor::Property::NAME, "Container");
     mContainer.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
-    auto size = std::min(mWindowSize.width, mWindowSize.height) * 0.6f;
+    auto size   = std::min(mWindowSize.width, mWindowSize.height) * 0.6f;
     mLayoutSize = Vector2(size, size);
     mContainer.SetProperty(Actor::Property::SIZE, mLayoutSize);
     window.Add(mContainer);
@@ -257,7 +260,7 @@ public:
     mHueAngleIndex      = mLabel.RegisterProperty("hue", 0.0f);
     Renderer bgRenderer = mLabel.GetRendererAt(0);
 
-    Constraint constraint = Constraint::New<Vector3>(bgRenderer, VisualRenderer::Property::VISUAL_MIX_COLOR, HSVColorConstraint(0.0f, 0.5f, 0.8f));
+    Constraint constraint = Constraint::New<Vector4>(bgRenderer, Renderer::Property::MIX_COLOR, HSVColorConstraint(0.0f, 0.5f, 0.8f));
     constraint.AddSource(Source(mLabel, mHueAngleIndex));
     constraint.SetRemoveAction(Constraint::DISCARD);
     constraint.Apply();