Let we remove Visual's PreMultpliyAlpha property, what most application didn't set.
Also, let we use Renderer::Property::MIX_COLOR instead of VisualRenderer::Property::MIX_COLOR.
Change-Id: I29fc8c03416237466b88bc6533b58257f766371c
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
application.Render();
DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
- auto renderer = actor.GetRendererAt(0);
- auto preMultipliedIndex = renderer.GetPropertyIndex("preMultipliedAlpha");
+ auto renderer = actor.GetRendererAt(0);
+
+ // Note : renderer don't have "premultipliedAlpha" at pre multiplied alpha enabled. (Since shader hold it.)
+ auto shader = renderer.GetShader();
+ auto preMultipliedIndex = shader.GetPropertyIndex("premultipliedAlpha");
DALI_TEST_CHECK(preMultipliedIndex != Property::INVALID_INDEX);
- auto preMultipliedAlpha = renderer.GetProperty<float>(preMultipliedIndex);
+ auto preMultipliedAlpha = shader.GetProperty<float>(preMultipliedIndex);
auto preMultipliedAlpha2 = renderer.GetProperty<bool>(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA);
DALI_TEST_EQUALS(preMultipliedAlpha, 1.0f, TEST_LOCATION);
DALI_TEST_EQUALS(preMultipliedAlpha2, true, TEST_LOCATION);
application.Render();
DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
- auto renderer = actor.GetRendererAt(0);
- auto preMultipliedIndex = renderer.GetPropertyIndex("preMultipliedAlpha");
+ auto renderer = actor.GetRendererAt(0);
+
+ // Note : renderer now have "premultipliedAlpha" since pre multiplied alpha disabled.
+ auto preMultipliedIndex = renderer.GetPropertyIndex("premultipliedAlpha");
DALI_TEST_CHECK(preMultipliedIndex != Property::INVALID_INDEX);
- auto preMultipliedAlpha = renderer.GetProperty<bool>(preMultipliedIndex);
+ auto preMultipliedAlpha = renderer.GetProperty<float>(preMultipliedIndex);
auto preMultipliedAlpha2 = renderer.GetProperty<bool>(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA);
- DALI_TEST_EQUALS(preMultipliedAlpha, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(preMultipliedAlpha, 0.0f, TEST_LOCATION);
DALI_TEST_EQUALS(preMultipliedAlpha2, false, TEST_LOCATION);
DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
application.Render();
DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
- auto renderer = actor.GetRendererAt(0);
- auto preMultipliedIndex = renderer.GetPropertyIndex("preMultipliedAlpha");
+ auto renderer = actor.GetRendererAt(0);
+
+ // Note : renderer now have "premultipliedAlpha" since pre multiplied alpha disabled.
+ auto preMultipliedIndex = renderer.GetPropertyIndex("premultipliedAlpha");
DALI_TEST_CHECK(preMultipliedIndex != Property::INVALID_INDEX);
- auto preMultipliedAlpha = renderer.GetProperty<bool>(preMultipliedIndex);
+ auto preMultipliedAlpha = renderer.GetProperty<float>(preMultipliedIndex);
auto preMultipliedAlpha2 = renderer.GetProperty<bool>(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA);
- DALI_TEST_EQUALS(preMultipliedAlpha, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(preMultipliedAlpha, 0.0f, TEST_LOCATION);
DALI_TEST_EQUALS(preMultipliedAlpha2, false, TEST_LOCATION);
DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
DALI_TEST_EQUALS(newActor.GetRendererCount(), 1u, TEST_LOCATION);
auto newRenderer = newActor.GetRendererAt(0);
- preMultipliedIndex = newRenderer.GetPropertyIndex("preMultipliedAlpha");
+ preMultipliedIndex = newRenderer.GetPropertyIndex("premultipliedAlpha");
DALI_TEST_CHECK(preMultipliedIndex != Property::INVALID_INDEX);
- preMultipliedAlpha = newRenderer.GetProperty<bool>(preMultipliedIndex);
+ preMultipliedAlpha = newRenderer.GetProperty<float>(preMultipliedIndex);
preMultipliedAlpha2 = newRenderer.GetProperty<bool>(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA);
- DALI_TEST_EQUALS(preMultipliedAlpha, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(preMultipliedAlpha, 0.0f, TEST_LOCATION);
DALI_TEST_EQUALS(preMultipliedAlpha2, false, TEST_LOCATION);
srcFactorRgb = newRenderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_SRC_RGB);
ToolkitTestApplication application;
tet_infoline("Animate mix color");
- static std::vector<UniformData> customUniforms =
- {
- UniformData("mixColor", Property::Type::VECTOR3),
- };
-
- TestGraphicsController& graphics = application.GetGraphicsController();
- graphics.AddCustomUniforms(customUniforms);
-
application.GetPlatform().SetClosestImageSize(Vector2(100, 100));
VisualFactory factory = VisualFactory::Get();
application.SendNotification();
application.Render(0); // Ensure animation starts
application.Render(2000u); // Halfway point
- Vector3 testColor(1.0f, 0.0f, 0.5f);
+ Vector4 testColor(1.0f, 0.0f, 0.5f, 0.75f);
- // uColor.a should be actor's alpha * mixColor.a.
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4(0.5f, 0.5f, 0.5f, 0.75f)), true, TEST_LOCATION);
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", testColor), true, TEST_LOCATION);
+ // uColor should be actor's color * mixColor.
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4(0.5f, 0.5f, 0.5f, 1.0f) * testColor), true, TEST_LOCATION);
DALI_TEST_CHECK(glEnableStack.FindMethodAndParams("Enable", blendStr.str()));
application.SendNotification();
DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4(1.0f, 1.0f, 1.0f, 0.5f)), true, TEST_LOCATION);
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(TARGET_MIX_COLOR)), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Color::WHITE * TARGET_MIX_COLOR), true, TEST_LOCATION);
// (Don't test for caching of capabilities, toolkit uses Test graphics backend, not actual backend)
ToolkitTestApplication application;
tet_infoline("UtcDaliVisualGetPropertyMap9: PrimitiveVisual");
- static std::vector<UniformData> customUniforms =
- {
- UniformData("mixColor", Property::Type::VECTOR3),
- };
-
- TestGraphicsController& graphics = application.GetGraphicsController();
- graphics.AddCustomUniforms(customUniforms);
-
Vector4 color = Vector4(1.0, 0.8, 0.6, 1.0);
Vector3 dimensions = Vector3(1.0, 2.0, 3.0);
application.GetScene().Add(actor);
Animation animation = Animation::New(1.0f);
- animation.AnimateTo(DevelControl::GetVisualProperty(actor, DummyControl::Property::TEST_VISUAL, PrimitiveVisual::Property::MIX_COLOR), Vector3(Color::MAGENTA));
+ animation.AnimateTo(DevelControl::GetVisualProperty(actor, DummyControl::Property::TEST_VISUAL, PrimitiveVisual::Property::MIX_COLOR), Color::MAGENTA);
animation.Play();
application.SendNotification();
application.Render(0);
application.SendNotification();
auto& gl = application.GetGlAbstraction();
- DALI_TEST_EQUALS(gl.CheckUniformValue<Vector3>("mixColor", Vector3(Color::MAGENTA)), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gl.CheckUniformValue<Vector4>("uColor", Color::MAGENTA), true, TEST_LOCATION);
tet_infoline("Check property map after animation");
DALI_TEST_CHECK(value);
color = value->Get<Vector4>();
// Ignore alpha part
- DALI_TEST_EQUALS(Vector3(color), Vector3(Color::MAGENTA), 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(color, Color::MAGENTA, 0.001f, TEST_LOCATION);
END_TEST;
}
static std::vector<UniformData> customUniforms =
{
UniformData("borderColor", Property::Type::VECTOR4),
- UniformData("mixColor", Property::Type::VECTOR3),
};
TestGraphicsController& graphics = application.GetGraphicsController();
Renderer renderer = actor.GetRendererAt(0);
Property::Index borderColorIndex = renderer.GetPropertyIndex(BorderVisual::Property::COLOR);
- Property::Index mixColorIndex = VisualRenderer::Property::VISUAL_MIX_COLOR; //renderer.GetPropertyIndex( Visual::Property::MIX_COLOR );
+ Property::Index mixColorIndex = Renderer::Property::MIX_COLOR;
Animation animation = dummyImpl.CreateTransition(transition);
DALI_TEST_EQUALS(color, testColor, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector4>("borderColor", testColor), true, TEST_LOCATION);
- color = renderer.GetCurrentProperty<Vector3>(mixColorIndex);
+ color = renderer.GetCurrentProperty<Vector4>(mixColorIndex);
testColor = Vector4(1, 1, 1, 0.45f);
- DALI_TEST_EQUALS(Vector3(color), Vector3(testColor), 0.0001f, TEST_LOCATION);
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(testColor)), true, TEST_LOCATION);
-
- Vector4 uColor;
- DALI_TEST_CHECK(application.GetGlAbstraction().GetUniformValue<Vector4>("uColor", uColor));
- DALI_TEST_EQUALS(uColor.a, testColor.a, TEST_LOCATION);
+ DALI_TEST_EQUALS(color, testColor, 0.0001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", testColor), true, TEST_LOCATION);
application.Render(2000u);
DALI_TEST_EQUALS(color, Color::WHITE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector4>("borderColor", Color::WHITE), true, TEST_LOCATION);
- color = renderer.GetCurrentProperty<Vector3>(mixColorIndex);
+ color = renderer.GetCurrentProperty<Vector4>(mixColorIndex);
testColor = Vector4(1, 1, 1, 0.1);
- DALI_TEST_EQUALS(Vector3(color), Vector3(testColor), TEST_LOCATION);
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(testColor)), true, TEST_LOCATION);
-
- DALI_TEST_CHECK(application.GetGlAbstraction().GetUniformValue<Vector4>("uColor", uColor));
- DALI_TEST_EQUALS(uColor.a, testColor.a, TEST_LOCATION);
+ DALI_TEST_EQUALS(color, testColor, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", testColor), true, TEST_LOCATION);
END_TEST;
}
ToolkitTestApplication application;
tet_infoline("UtcDaliAnimateColorVisual mixColor");
- static std::vector<UniformData> customUniforms =
- {
- UniformData("mixColor", Property::Type::VECTOR3),
- };
-
- TestGraphicsController& graphics = application.GetGraphicsController();
- graphics.AddCustomUniforms(customUniforms);
-
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
Renderer renderer = actor.GetRendererAt(0);
- Property::Index mixColorIndex = VisualRenderer::Property::VISUAL_MIX_COLOR; //renderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR );
+ Property::Index mixColorIndex = Renderer::Property::MIX_COLOR;
Property::Value blendModeValue = renderer.GetProperty(Renderer::Property::BLEND_MODE);
DALI_TEST_EQUALS(blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION);
Animation animation = Animation::New(4.0f);
- animation.AnimateTo(Property(renderer, mixColorIndex), Vector3(Color::WHITE));
+ animation.AnimateTo(Property(renderer, mixColorIndex), Color::WHITE);
animation.Play();
application.SendNotification();
application.Render(0);
application.Render(2000u); // halfway point
- Vector3 color = renderer.GetCurrentProperty<Vector3>(mixColorIndex);
- Vector3 testColor = Vector3(Color::BLUE + Color::WHITE) * 0.5f;
+ Vector4 color = renderer.GetCurrentProperty<Vector4>(mixColorIndex);
+ Vector4 testColor = (Color::BLUE + Color::WHITE) * 0.5f;
DALI_TEST_EQUALS(color, testColor, TEST_LOCATION);
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", testColor), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", testColor), true, TEST_LOCATION);
application.Render(2000u); // halfway point between blue and white
- color = renderer.GetCurrentProperty<Vector3>(mixColorIndex);
- DALI_TEST_EQUALS(color, Vector3(Color::WHITE), TEST_LOCATION);
+ color = renderer.GetCurrentProperty<Vector4>(mixColorIndex);
+ DALI_TEST_EQUALS(color, Color::WHITE, TEST_LOCATION);
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(Color::WHITE)), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Color::WHITE), true, TEST_LOCATION);
blendModeValue = renderer.GetCurrentProperty(Renderer::Property::BLEND_MODE);
DALI_TEST_EQUALS(blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION);
ToolkitTestApplication application;
tet_infoline("UtcDaliAnimatePrimitiveVisual color");
- static std::vector<UniformData> customUniforms =
- {
- UniformData("mixColor", Property::Type::VECTOR3),
- };
-
- TestGraphicsController& graphics = application.GetGraphicsController();
- graphics.AddCustomUniforms(customUniforms);
-
{
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
application.SendNotification();
Vector4 halfwayColor = (INITIAL_MIX_COLOR + TARGET_MIX_COLOR) * 0.5;
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4(0.5f, 0.5f, 0.5f, halfwayColor.a)), true, TEST_LOCATION);
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(halfwayColor)), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4(0.5f, 0.5f, 0.5f, 1.0f) * halfwayColor), true, TEST_LOCATION);
DALI_TEST_CHECK(glEnableStack.FindMethodAndParams("Enable", blendStr.str()));
application.SendNotification(); // Trigger signals
DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4(1.0f, 1.0f, 1.0f, TARGET_MIX_COLOR.a)), true, TEST_LOCATION);
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(TARGET_MIX_COLOR)), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4(1.0f, 1.0f, 1.0f, 1.0f) * TARGET_MIX_COLOR), true, TEST_LOCATION);
DALI_TEST_CHECK(glEnableStack.FindMethodAndParams("Disable", blendStr.str()));
TestGraphicsController& graphics = application.GetGraphicsController();
static std::vector<UniformData> customUniforms =
{
- UniformData("mixColor", Property::Type::VECTOR3),
UniformData("cornerRadius", Property::Type::VECTOR4),
UniformData("cornerRadiusPolicy", Property::Type::FLOAT),
UniformData("borderlineWidth", Property::Type::FLOAT),
graphics.AddCustomUniforms(customUniforms);
{
- const Vector3 INITIAL_MIX_COLOR(1.0f, 0.0f, 1.0f);
- const float INITIAL_MIX_OPACITY(0.5f);
+ const Vector4 INITIAL_MIX_COLOR(1.0f, 0.0f, 1.0f, 0.5f);
const Vector4 INITIAL_BORDERLINE_COLOR(0.0f, 1.0f, 0.0f, 1.0f);
const float INITIAL_ACTOR_OPACITY(1.0f);
- const Vector3 TARGET_MIX_COLOR(1.0f, 0.0f, 0.0f);
- const float TARGET_MIX_OPACITY(0.8f);
+ const Vector4 TARGET_MIX_COLOR(1.0f, 0.0f, 0.0f, 0.8f);
const Vector4 TARGET_BORDERLINE_COLOR(1.0f, 0.0f, 1.0f, 0.2f);
const float TARGET_ACTOR_OPACITY(0.5f);
Property::Map propertyMap;
propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
propertyMap.Insert(Visual::Property::MIX_COLOR, INITIAL_MIX_COLOR);
- propertyMap.Insert(Visual::Property::OPACITY, INITIAL_MIX_OPACITY);
propertyMap.Insert(DevelVisual::Property::BORDERLINE_WIDTH, 1.0f);
propertyMap.Insert(DevelVisual::Property::BORDERLINE_COLOR, INITIAL_BORDERLINE_COLOR);
Visual::Base visual = factory.CreateVisual(propertyMap);
Animation animation = Animation::New(4.0f);
animation.AnimateTo(DevelControl::GetVisualProperty(actor, DummyControl::Property::TEST_VISUAL, Visual::Property::MIX_COLOR), TARGET_MIX_COLOR);
- animation.AnimateTo(DevelControl::GetVisualProperty(actor, DummyControl::Property::TEST_VISUAL, Visual::Property::OPACITY), TARGET_MIX_OPACITY);
animation.AnimateTo(DevelControl::GetVisualProperty(actor, DummyControl::Property::TEST_VISUAL, DevelVisual::Property::BORDERLINE_COLOR), TARGET_BORDERLINE_COLOR);
animation.AnimateTo(Property(actor, Actor::Property::OPACITY), TARGET_ACTOR_OPACITY);
animation.Play();
application.Render(2000u); // halfway point
application.SendNotification();
- Vector3 halfwayMixColor = (INITIAL_MIX_COLOR + TARGET_MIX_COLOR) * 0.5f;
- float halfwayMixOpacity = (INITIAL_MIX_OPACITY + TARGET_MIX_OPACITY) * 0.5f;
+ Vector4 halfwayMixColor = (INITIAL_MIX_COLOR + TARGET_MIX_COLOR) * 0.5f;
Vector4 halfwayBorderlineColor = (INITIAL_BORDERLINE_COLOR + TARGET_BORDERLINE_COLOR) * 0.5f;
float halfwayActorOpacity = (INITIAL_ACTOR_OPACITY + TARGET_ACTOR_OPACITY) * 0.5f;
- halfwayMixOpacity *= halfwayActorOpacity;
- DALI_TEST_EQUALS(glAbstraction.CheckUniformValue<Vector3>("mixColor", halfwayMixColor), true, TEST_LOCATION);
- DALI_TEST_EQUALS(glAbstraction.CheckUniformValue<Vector4>("uColor", Vector4(1.0f, 1.0f, 1.0f, halfwayMixOpacity)), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(glAbstraction.CheckUniformValue<Vector4>("uColor", Vector4(1.0f, 1.0f, 1.0f, halfwayActorOpacity) * halfwayMixColor), true, TEST_LOCATION);
DALI_TEST_EQUALS(glAbstraction.CheckUniformValue<Vector4>("uActorColor", Vector4(1.0f, 1.0f, 1.0f, halfwayActorOpacity)), true, TEST_LOCATION);
DALI_TEST_EQUALS(glAbstraction.CheckUniformValue<Vector4>("borderlineColor", halfwayBorderlineColor), true, TEST_LOCATION);
application.SendNotification(); // Trigger signals
DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Vector4(1.0f, 1.0f, 1.0f, TARGET_ACTOR_OPACITY), TEST_LOCATION);
- DALI_TEST_EQUALS(glAbstraction.CheckUniformValue<Vector3>("mixColor", TARGET_MIX_COLOR), true, TEST_LOCATION);
- DALI_TEST_EQUALS(glAbstraction.CheckUniformValue<Vector4>("uColor", Vector4(1.0f, 1.0f, 1.0f, TARGET_MIX_OPACITY * TARGET_ACTOR_OPACITY)), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(glAbstraction.CheckUniformValue<Vector4>("uColor", Vector4(1.0f, 1.0f, 1.0f, TARGET_ACTOR_OPACITY) * TARGET_MIX_COLOR), true, TEST_LOCATION);
DALI_TEST_EQUALS(glAbstraction.CheckUniformValue<Vector4>("uActorColor", Vector4(1.0f, 1.0f, 1.0f, TARGET_ACTOR_OPACITY)), true, TEST_LOCATION);
DALI_TEST_EQUALS(glAbstraction.CheckUniformValue<Vector4>("borderlineColor", TARGET_BORDERLINE_COLOR), true, TEST_LOCATION);
static std::vector<UniformData> customUniforms =
{
- UniformData("mixColor", Property::Type::VECTOR3),
UniformData("offset", Property::Type::VECTOR2),
UniformData("size", Property::Type::VECTOR2),
UniformData("cornerRadius", Property::Type::VECTOR4),
application.SendNotification();
application.Render();
- Vector3 targetColor(1.0f, 1.0f, 1.0f);
+ Vector4 targetColor(1.0f, 1.0f, 1.0f, 0.5f);
Vector2 targetOffset(0.05f, 0.05f);
Vector2 targetSize(1.1f, 1.1f);
- float targetOpacity = 0.5f;
Vector4 targetCornerRadius(0.0f, 0.0f, 0.0f, 0.0f);
float targetBlurRadius = 10.0f;
float targetBorderlineWidth = 25.0f;
Animation animation = Animation::New(1.0f);
animation.AnimateTo(DevelControl::GetVisualProperty(dummyControl, DummyControl::Property::TEST_VISUAL, Visual::Property::MIX_COLOR), targetColor);
- animation.AnimateTo(DevelControl::GetVisualProperty(dummyControl, DummyControl::Property::TEST_VISUAL, Visual::Property::OPACITY), targetOpacity);
animation.AnimateTo(DevelControl::GetVisualProperty(dummyControl, DummyControl::Property::TEST_VISUAL, Visual::Transform::Property::OFFSET), targetOffset);
animation.AnimateTo(DevelControl::GetVisualProperty(dummyControl, DummyControl::Property::TEST_VISUAL, Visual::Transform::Property::SIZE), targetSize);
animation.AnimateTo(DevelControl::GetVisualProperty(dummyControl, DummyControl::Property::TEST_VISUAL, DevelVisual::Property::CORNER_RADIUS), targetCornerRadius);
// Test property values: they should be updated
Property::Value* colorValue = resultMap.Find(ColorVisual::Property::MIX_COLOR, Property::VECTOR4);
DALI_TEST_CHECK(colorValue);
- DALI_TEST_EQUALS(colorValue->Get<Vector4>(), Vector4(targetColor.r, targetColor.g, targetColor.b, targetOpacity), TEST_LOCATION);
+ DALI_TEST_EQUALS(colorValue->Get<Vector4>(), targetColor, TEST_LOCATION);
Property::Value* transformValue = resultMap.Find(Dali::Toolkit::Visual::Property::TRANSFORM);
Dali::Property::Map* transformMap = transformValue->GetMap();
DALI_TEST_EQUALS(borderlineOffsetValue->Get<float>(), targetBorderlineOffset, TEST_LOCATION);
// Test uniform values
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", targetColor), true, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector2>("offset", targetOffset), true, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector2>("size", targetSize), true, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector4>("cornerRadius", targetCornerRadius), true, TEST_LOCATION);
static std::vector<UniformData> customUniforms =
{
- UniformData("mixColor", Property::Type::VECTOR3),
UniformData("offset", Property::Type::VECTOR2),
UniformData("size", Property::Type::VECTOR2),
UniformData("cornerRadius", Property::Type::VECTOR4),
application.SendNotification();
application.Render();
- Vector3 targetColor(1.0f, 1.0f, 1.0f);
+ Vector4 targetColor(1.0f, 1.0f, 1.0f, 0.5f);
Vector2 targetOffset(0.05f, 0.05f);
Vector2 targetSize(1.1f, 1.1f);
- float targetOpacity = 0.5f;
Vector4 targetCornerRadius(20.0f, 0.0f, 20.0f, 0.0f);
float targetBorderlineWidth = 77.7f;
Vector4 targetBorderlineColor(0.4f, 0.2f, 0.3f, 0.9f);
// Should work when the properties are not set before
Animation animation = Animation::New(1.0f);
animation.AnimateTo(DevelControl::GetVisualProperty(dummyControl, DummyControl::Property::TEST_VISUAL, "mixColor"), targetColor);
- animation.AnimateTo(DevelControl::GetVisualProperty(dummyControl, DummyControl::Property::TEST_VISUAL, "opacity"), targetOpacity);
animation.AnimateTo(DevelControl::GetVisualProperty(dummyControl, DummyControl::Property::TEST_VISUAL, "offset"), targetOffset);
animation.AnimateTo(DevelControl::GetVisualProperty(dummyControl, DummyControl::Property::TEST_VISUAL, "size"), targetSize);
animation.AnimateTo(DevelControl::GetVisualProperty(dummyControl, DummyControl::Property::TEST_VISUAL, "cornerRadius"), targetCornerRadius);
// Test property values: they should be updated
Property::Value* colorValue = resultMap.Find(ColorVisual::Property::MIX_COLOR, Property::VECTOR4);
DALI_TEST_CHECK(colorValue);
- DALI_TEST_EQUALS(colorValue->Get<Vector4>(), Vector4(targetColor.r, targetColor.g, targetColor.b, targetOpacity), TEST_LOCATION);
+ DALI_TEST_EQUALS(colorValue->Get<Vector4>(), targetColor, TEST_LOCATION);
Property::Value* transformValue = resultMap.Find(Dali::Toolkit::Visual::Property::TRANSFORM);
Dali::Property::Map* transformMap = transformValue->GetMap();
DALI_TEST_EQUALS(blurRadiusValue->Get<float>(), targetBlurRadius, TEST_LOCATION);
// Test uniform values
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", targetColor), true, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector2>("offset", targetOffset), true, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector2>("size", targetSize), true, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector4>("cornerRadius", targetCornerRadius), true, TEST_LOCATION);
ToolkitTestApplication application;
tet_infoline("UtcDaliVisualFactoryGetColorVisual1: Request color visual with a Property::Map");
- static std::vector<UniformData> customUniforms =
- {
- UniformData("mixColor", Property::Type::VECTOR3),
- };
-
- TestGraphicsController& graphics = application.GetGraphicsController();
- graphics.AddCustomUniforms(customUniforms);
-
VisualFactory factory = VisualFactory::Get();
DALI_TEST_CHECK(factory);
DummyControl actor = DummyControl::New(true);
TestVisualRender(application, actor, visual);
- Vector3 actualValue(Vector4::ZERO);
Vector4 actualColor(Vector4::ZERO);
TestGlAbstraction& gl = application.GetGlAbstraction();
- DALI_TEST_CHECK(gl.GetUniformValue<Vector3>("mixColor", actualValue));
DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uColor", actualColor));
- DALI_TEST_EQUALS(actualValue, Vector3(testColor), TEST_LOCATION);
- DALI_TEST_EQUALS(actualColor.a, testColor.a, TEST_LOCATION);
+ DALI_TEST_EQUALS(actualColor, testColor, TEST_LOCATION);
END_TEST;
}
ToolkitTestApplication application;
tet_infoline("UtcDaliVisualFactoryGetColorVisual2: Request color visual with a Vector4");
- static std::vector<UniformData> customUniforms =
- {
- UniformData("mixColor", Property::Type::VECTOR3),
- };
-
- TestGraphicsController& graphics = application.GetGraphicsController();
- graphics.AddCustomUniforms(customUniforms);
-
VisualFactory factory = VisualFactory::Get();
DALI_TEST_CHECK(factory);
DummyControl actor = DummyControl::New(true);
TestVisualRender(application, actor, visual);
- Vector3 actualValue;
Vector4 actualColor;
TestGlAbstraction& gl = application.GetGlAbstraction();
- DALI_TEST_CHECK(gl.GetUniformValue<Vector3>("mixColor", actualValue));
DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uColor", actualColor));
- DALI_TEST_EQUALS(actualValue, Vector3(testColor), TEST_LOCATION);
- DALI_TEST_EQUALS(actualColor.a, testColor.a, TEST_LOCATION);
+ DALI_TEST_EQUALS(actualColor, testColor, TEST_LOCATION);
application.GetScene().Remove(actor);
DALI_TEST_CHECK(actor.GetRendererCount() == 0u);
Property::Map imageShader2;
imageShader2["shaderType"] = "image";
imageShader2["shaderOption"] = Property::Map()
- .Add("ROUNDED_CORNER", true)
- .Add("BORDERLINE", true)
- .Add("MASKING", true);
+ .Add("ROUNDED_CORNER", true)
+ .Add("BORDERLINE", true)
+ .Add("MASKING", true);
Property::Map imageShader3;
imageShader3["shaderType"] = "image";
Property::Map textShader;
textShader["shaderType"] = "text";
textShader["shaderOption"] = Property::Map()
- .Add("MULTI_COLOR", true)
- .Add("OVERLAY", true)
- .Add("STYLES", true);
+ .Add("MULTI_COLOR", true)
+ .Add("OVERLAY", true)
+ .Add("STYLES", true);
Property::Map textShader2;
textShader2["shaderType"] = "text";
textShader2["shaderOption"] = Property::Map()
- .Add("EMOJI", true);
+ .Add("EMOJI", true);
Property::Map colorShader;
colorShader["shaderType"] = "color";
colorShader["shaderOption"] = Property::Map()
- .Add("CUTOUT", true)
- .Add("BORDERLINE", true);
+ .Add("CUTOUT", true)
+ .Add("BORDERLINE", true);
Property::Map colorShader2;
colorShader2["shaderType"] = "color";
colorShader2["shaderOption"] = Property::Map()
- .Add("ROUNDED_CORNER,", true)
- .Add("BLUR_EDGE", true);
+ .Add("ROUNDED_CORNER,", true)
+ .Add("BLUR_EDGE", true);
Property::Map npatchShader;
- npatchShader["shaderType"] = "npatch";
+ npatchShader["shaderType"] = "npatch";
Property::Map npatchShader2;
- npatchShader2["shaderType"] = "npatch";
- npatchShader2["shaderOption"] = Property::Map() .Add("MASKING", true);
+ npatchShader2["shaderType"] = "npatch";
+ npatchShader2["shaderOption"] = Property::Map().Add("MASKING", true);
npatchShader2["xStretchCount"] = 4;
npatchShader2["yStretchCount"] = 3;
Property::Map customSHader;
- customSHader["shaderType"] = "custom";
- customSHader["shaderName"] = "myShader";
- customSHader["vertexShader"] = VertexSource;
+ customSHader["shaderType"] = "custom";
+ customSHader["shaderName"] = "myShader";
+ customSHader["vertexShader"] = VertexSource;
customSHader["fragmentShader"] = FragmentSource;
factory.AddPrecompileShader(imageShader);
INPUT mediump vec2 vPosition;
uniform lowp vec4 uColor;
-uniform lowp vec3 mixColor;
uniform mediump float thickness;
uniform mediump float radius;
uniform mediump float startAngle;
void main()
{
- OUT_COLOR = vec4( mixColor, 1.0 ) * uColor;
+ OUT_COLOR = uColor;
OUT_COLOR.a *= GetOpacity();
}
INPUT mediump vec2 vPosition;
uniform lowp vec4 uColor;
-uniform lowp vec3 mixColor;
uniform mediump float thickness;
uniform mediump float radius;
uniform mediump float startAngle;
void main()
{
- OUT_COLOR = vec4( mixColor, 1.0 ) * uColor;
+ OUT_COLOR = uColor;
OUT_COLOR.a *= GetOpacity();
}
\ No newline at end of file
uniform lowp vec4 uColor;
uniform lowp vec4 borderColor;
-uniform lowp vec3 mixColor;
uniform mediump float borderSize;
void main()
{
- OUT_COLOR = vec4(mixColor, 1.0) * borderColor * uColor;
+ OUT_COLOR = borderColor * uColor;
OUT_COLOR.a *= smoothstep(0.0, 1.5, vAlpha) * smoothstep( borderSize + 1.5, borderSize, vAlpha );
}
\ No newline at end of file
uniform lowp vec4 uColor;
uniform lowp vec4 borderColor;
-uniform lowp vec3 mixColor;
void main()
{
- OUT_COLOR = vec4(mixColor, 1.0) * borderColor * uColor;
+ OUT_COLOR = borderColor * uColor;
}
\ No newline at end of file
#endif
uniform lowp vec4 uColor;
-uniform lowp vec3 mixColor;
#ifdef IS_REQUIRED_BLUR
uniform highp float blurRadius;
#elif defined(IS_REQUIRED_BORDERLINE)
// Manual blend operation with premultiplied colors.
// Final alpha = borderlineColorAlpha + (1.0 - borderlineColorAlpha) * textureColor.a.
// (Final rgb * alpha) = borderlineColorRGB + (1.0 - borderlineColorAlpha) * textureColor.rgb
- // If preMultipliedAlpha == 1.0, just return vec4(rgb*alpha, alpha)
+ // If premultipliedAlpha == 1.0, just return vec4(rgb*alpha, alpha)
// Else, return vec4((rgb*alpha) / alpha, alpha)
lowp float finalAlpha = mix(textureColor.a, 1.0, borderlineColorAlpha);
void main()
{
- lowp vec4 targetColor = vec4(mixColor, 1.0) * uColor;
+ lowp vec4 targetColor = uColor;
#ifdef IS_REQUIRED_CUTOUT
mediump float discardOpacity = 1.0;
uniform sampler2D sTexture; // sampler1D?
uniform lowp vec4 uColor;
-uniform lowp vec3 mixColor;
#ifdef IS_REQUIRED_BORDERLINE
uniform highp float borderlineWidth;
uniform highp float borderlineOffset;
// Manual blend operation with premultiplied colors.
// Final alpha = borderlineColorAlpha + (1.0 - borderlineColorAlpha) * textureColor.a.
// (Final rgb * alpha) = borderlineColorRGB + (1.0 - borderlineColorAlpha) * textureColor.rgb
- // If preMultipliedAlpha == 1.0, just return vec4(rgb*alpha, alpha)
+ // If premultipliedAlpha == 1.0, just return vec4(rgb*alpha, alpha)
// Else, return vec4((rgb*alpha) / alpha, alpha)
lowp float finalAlpha = mix(textureColor.a, 1.0, borderlineColorAlpha);
{
#ifdef RADIAL
mediump float radialTexCoord = ((length(vTexCoord) - 0.5) * uTextureCoordinateScaleFactor) + 0.5;
- lowp vec4 textureColor = TEXTURE(sTexture, vec2(radialTexCoord, 0.5)) * vec4(mixColor, 1.0) * uColor;
+ lowp vec4 textureColor = TEXTURE(sTexture, vec2(radialTexCoord, 0.5)) * uColor;
#else
- lowp vec4 textureColor = TEXTURE(sTexture, vec2(vTexCoord.y, 0.5)) * vec4(mixColor, 1.0) * uColor;
+ lowp vec4 textureColor = TEXTURE(sTexture, vec2(vTexCoord.y, 0.5)) * uColor;
#endif
#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
#endif
uniform lowp vec4 uColor;
-uniform lowp vec3 mixColor;
-uniform lowp float preMultipliedAlpha;
+uniform lowp float premultipliedAlpha;
#ifdef IS_REQUIRED_BORDERLINE
uniform highp float borderlineWidth;
uniform highp float borderlineOffset;
lowp vec3 borderlineColorRGB = borderlineColor.rgb * uActorColor.rgb;
lowp float borderlineColorAlpha = borderlineColor.a * uActorColor.a;
- borderlineColorRGB *= mix(1.0, borderlineColorAlpha, preMultipliedAlpha);
+ borderlineColorRGB *= mix(1.0, borderlineColorAlpha, premultipliedAlpha);
// Calculate inside of borderline when alpha is between (0.0 1.0). So we need to apply texture color.
// If borderlineOpacity is exactly 0.0, we always use whole texture color. In this case, we don't need to run below code.
// potential is in texture range.
lowp float textureAlphaScale = mix(1.0, 0.0, smoothstep(MinTexturelinePotential, MaxTexturelinePotential, potential));
textureColor.a *= textureAlphaScale;
- textureColor.rgb *= mix(textureColor.a, textureAlphaScale, preMultipliedAlpha);
+ textureColor.rgb *= mix(textureColor.a, textureAlphaScale, premultipliedAlpha);
}
borderlineColorAlpha *= borderlineOpacity;
- borderlineColorRGB *= mix(borderlineColorAlpha, borderlineOpacity, preMultipliedAlpha);
+ borderlineColorRGB *= mix(borderlineColorAlpha, borderlineOpacity, premultipliedAlpha);
// We use pre-multiplied color to reduce operations.
// In here, textureColor and borderlineColorRGB is pre-multiplied color now.
// Manual blend operation with premultiplied colors.
// Final alpha = borderlineColorAlpha + (1.0 - borderlineColorAlpha) * textureColor.a.
// (Final rgb * alpha) = borderlineColorRGB + (1.0 - borderlineColorAlpha) * textureColor.rgb
- // If preMultipliedAlpha == 1.0, just return vec4(rgb*alpha, alpha)
+ // If premultipliedAlpha == 1.0, just return vec4(rgb*alpha, alpha)
// Else, return vec4((rgb*alpha) / alpha, alpha)
lowp float finalAlpha = mix(textureColor.a, 1.0, borderlineColorAlpha);
lowp vec3 finalMultipliedRGB = borderlineColorRGB + (1.0 - borderlineColorAlpha) * textureColor.rgb;
// TODO : Need to find some way without division
- return vec4(finalMultipliedRGB * mix(1.0 / finalAlpha, 1.0, preMultipliedAlpha), finalAlpha);
+ return vec4(finalMultipliedRGB * mix(1.0 / finalAlpha, 1.0, premultipliedAlpha), finalAlpha);
}
return mix(textureColor, vec4(borderlineColorRGB, borderlineColorAlpha), borderlineOpacity);
}
mediump float colorRate = max(debugColorRateRed, max(debugColorRateGreen, debugColorRateBlue));
mediump vec3 debugColor = vec3(debugColorRateRed, debugColorRateGreen, debugColorRateBlue);
- debugColor *= mix(1.0, originColor.a, preMultipliedAlpha);
+ debugColor *= mix(1.0, originColor.a, premultipliedAlpha);
return originColor.rgb * (1.0 - colorRate) + debugColor;
}
#endif
#if defined(IS_REQUIRED_YUV_TO_RGB) || defined(IS_REQUIRED_UNIFIED_YUV_AND_RGB)
- lowp vec4 textureColor = ConvertYuvToRgba(texCoord) * vec4( mixColor, 1.0 ) * uColor;
+ lowp vec4 textureColor = ConvertYuvToRgba(texCoord) * uColor;
#else
- lowp vec4 textureColor = TEXTURE( sTexture, texCoord ) * vec4( mixColor, 1.0 ) * uColor;
+ lowp vec4 textureColor = TEXTURE( sTexture, texCoord ) * uColor;
#endif
#ifdef IS_REQUIRED_ALPHA_MASKING
maskTexCoord.y = mix(maskTexCoord.y, 1.0-maskTexCoord.y, uYFlipMaskTexture);
mediump float maskAlpha = TEXTURE(sMaskTexture, maskTexCoord).a;
textureColor.a *= maskAlpha;
- textureColor.rgb *= mix(1.0, maskAlpha, preMultipliedAlpha);
+ textureColor.rgb *= mix(1.0, maskAlpha, premultipliedAlpha);
#endif
#if defined(IS_REQUIRED_DEBUG_VISUAL_SHADER) || defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
#ifdef IS_REQUIRED_ROUNDED_CORNER
mediump float opacity = calculateCornerOpacity();
OUT_COLOR.a *= opacity;
- OUT_COLOR.rgb *= mix(1.0, opacity, preMultipliedAlpha);
+ OUT_COLOR.rgb *= mix(1.0, opacity, premultipliedAlpha);
#endif
}
uniform sampler2D sNormal;
uniform sampler2D sGloss;
uniform lowp vec4 uColor;
-uniform lowp vec3 mixColor;
-uniform lowp float preMultipliedAlpha;
void main()
{
vec4 texture = texture2D( sDiffuse, vTexCoord );
vec3 normal = normalize( texture2D( sNormal, vTexCoord ).xyz * 2.0 - 1.0 );
vec4 glossMap = texture2D( sGloss, vTexCoord );
- vec4 visualMixColor = vec4( mixColor, 1.0 );
float lightDiffuse = max( 0.0, dot( normal, normalize( vLightDirection ) ) );
lightDiffuse = lightDiffuse * 0.5 + 0.5;
float shininess = pow ( max ( dot ( normalize( vHalfVector ), normal ), 0.0 ), 16.0 );
- gl_FragColor = vec4( texture.rgb * uColor.rgb * visualMixColor.rgb * lightDiffuse + shininess * glossMap.rgb, texture.a * uColor.a * visualMixColor.a );
+ gl_FragColor = vec4( texture.rgb * uColor.rgb * lightDiffuse + shininess * glossMap.rgb, texture.a * uColor.a );
}
varying mediump float vSpecular;
uniform sampler2D sDiffuse;
uniform lowp vec4 uColor;
-uniform lowp vec3 mixColor;
-uniform lowp float preMultipliedAlpha;
void main()
{
vec4 texture = texture2D( sDiffuse, vTexCoord );
- vec4 visualMixColor = vec4( mixColor, 1.0 );
- gl_FragColor = vec4( vIllumination.rgb * texture.rgb * uColor.rgb * visualMixColor.rgb + vSpecular * 0.3, texture.a * uColor.a * visualMixColor.a );
+ gl_FragColor = vec4( vIllumination.rgb * texture.rgb * uColor.rgb + vSpecular * 0.3, texture.a * uColor.a );
}
precision mediump float;
varying mediump vec3 vIllumination;
uniform lowp vec4 uColor;
-uniform lowp vec3 mixColor;
-uniform lowp float preMultipliedAlpha;
void main()
{
- gl_FragColor = vec4( vIllumination.rgb * uColor.rgb, uColor.a ) * vec4( mixColor, 1.0 );
+ gl_FragColor = vec4( vIllumination.rgb * uColor.rgb, uColor.a );
}
uniform sampler2D sTexture;
uniform sampler2D sMask;
uniform lowp vec4 uColor;
-uniform lowp vec3 mixColor;
-uniform lowp float preMultipliedAlpha;
+uniform lowp float premultipliedAlpha;
uniform mediump float auxiliaryImageAlpha;
void main()
mediump float maskAlpha = mask.a * auxiliaryImageAlpha;
- lowp vec3 preMultipliedMaskRGB = mask.rgb * mix(mask.a, 1.0, preMultipliedAlpha) * auxiliaryImageAlpha;
- lowp vec3 preMultipliedTextureRGB = color.rgb * mix(color.a, 1.0, preMultipliedAlpha);
+ lowp vec3 preMultipliedMaskRGB = mask.rgb * mix(mask.a, 1.0, premultipliedAlpha) * auxiliaryImageAlpha;
+ lowp vec3 preMultipliedTextureRGB = color.rgb * mix(color.a, 1.0, premultipliedAlpha);
// Manual blend operation with premultiplied colors.
// Final alpha = maskAlpha + (1.0 - maskAlpha) * color.a.
// (Final rgb * alpha) = preMultipliedMaskRGB + (1.0 - maskAlpha) * preMultipliedTextureRGB
- // If preMultipliedAlpha == 1.0, just return vec4(rgb*alpha, alpha)
+ // If premultipliedAlpha == 1.0, just return vec4(rgb*alpha, alpha)
// Else, return vec4((rgb*alpha) / alpha, alpha)
lowp float finalAlpha = mix(color.a, 1.0, maskAlpha);
lowp vec3 finalMultipliedRGB = preMultipliedMaskRGB + (1.0 - maskAlpha) * preMultipliedTextureRGB;
// TODO : Need to find some way without division
- lowp vec4 finalColor = vec4(finalMultipliedRGB * mix(1.0 / finalAlpha, 1.0, preMultipliedAlpha), finalAlpha);
- gl_FragColor = finalColor * uColor * vec4(mixColor, 1.0);
+ lowp vec4 finalColor = vec4(finalMultipliedRGB * mix(1.0 / finalAlpha, 1.0, premultipliedAlpha), finalAlpha);
+ gl_FragColor = finalColor * uColor;
}
varying mediump vec2 vTexCoord;
uniform sampler2D sTexture;
uniform lowp vec4 uColor;
-uniform lowp vec3 mixColor;
-uniform lowp float preMultipliedAlpha;
void main()
{
- gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * vec4( mixColor, 1.0 );
+ gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;
}
precision mediump float;
varying mediump vec3 vIllumination;
uniform lowp vec4 uColor;
-uniform lowp vec3 mixColor;
void main()
{
- vec4 baseColor = vec4(mixColor, 1.0) * uColor;
- gl_FragColor = vec4( vIllumination.rgb * baseColor.rgb, baseColor.a );
+ gl_FragColor = vec4( vIllumination.rgb * uColor.rgb, uColor.a );
}
varying highp vec2 vTexCoord;
uniform sampler2D sTexture;
uniform lowp vec4 uColor;
-uniform lowp vec3 mixColor;
void main()
{
mediump vec4 textTexture = texture2D( sTexture, vTexCoord );
- gl_FragColor = textTexture * uColor * vec4( mixColor, 1.0 );
+ gl_FragColor = textTexture * uColor;
}
#endif
uniform lowp vec4 uTextColorAnimatable;
uniform lowp vec4 uColor;
-uniform lowp vec3 mixColor;
void main()
{
#endif
// Draw the text as overlay above the style
- OUT_COLOR = uColor * vec4(mixColor, 1.0) * (
+ OUT_COLOR = uColor * (
#ifdef IS_REQUIRED_OVERLAY
(
#endif
uniform lowp vec4 uColor;
-uniform lowp vec3 mixColor;
void main()
{
- gl_FragColor = uColor * vec4( mixColor, 1.0 );
+ gl_FragColor = uColor;
}
{
namespace
{
-const int CUSTOM_PROPERTY_COUNT(5); // ltr, wrap, pixel area, crop to mask, mask texture ratio
+const int CUSTOM_PROPERTY_COUNT(6); // ltr, wrap, pixel area, crop to mask, mask texture ratio, pre-multiplied alph
// fitting modes
DALI_ENUM_TO_STRING_TABLE_BEGIN(FITTING_MODE)
mPlacementActor(),
mImageVisualShaderFactory(shaderFactory),
mPixelArea(FULL_TEXTURE_RECT),
+ mPixelAreaIndex(Property::INVALID_INDEX),
+ mPreMultipliedAlphaIndex(Property::INVALID_INDEX),
mImageUrl(),
mAnimatedImageLoading(),
mFrameIndexForJumpTo(0),
map.Insert(Toolkit::ImageVisual::Property::URL, value);
}
- map.Insert(Toolkit::ImageVisual::Property::PIXEL_AREA, mPixelArea);
+ if(mImpl->mRenderer && mPixelAreaIndex != Property::INVALID_INDEX)
+ {
+ // Update values from Renderer
+ Vector4 pixelArea = mImpl->mRenderer.GetProperty<Vector4>(mPixelAreaIndex);
+ map.Insert(Toolkit::ImageVisual::Property::PIXEL_AREA, pixelArea);
+ }
+ else
+ {
+ map.Insert(Toolkit::ImageVisual::Property::PIXEL_AREA, mPixelArea);
+ }
+
map.Insert(Toolkit::ImageVisual::Property::WRAP_MODE_U, mWrapModeU);
map.Insert(Toolkit::ImageVisual::Property::WRAP_MODE_V, mWrapModeV);
map.Insert(Toolkit::ImageVisual::Property::DESIRED_HEIGHT, mDesiredSize.GetHeight());
}
+void AnimatedImageVisual::EnablePreMultipliedAlpha(bool preMultiplied)
+{
+ if(mImpl->mRenderer)
+ {
+ if(mPreMultipliedAlphaIndex != Property::INVALID_INDEX || !preMultiplied)
+ {
+ // RegisterUniqueProperty call SetProperty internally.
+ // Register PREMULTIPLIED_ALPHA only if it become false.
+ // Default PREMULTIPLIED_ALPHA value is 1.0f, at image-visual-shader-factory.cpp
+ mPreMultipliedAlphaIndex = mImpl->mRenderer.RegisterUniqueProperty(mPreMultipliedAlphaIndex, PREMULTIPLIED_ALPHA, preMultiplied ? 1.0f : 0.0f);
+ }
+ }
+
+ Visual::Base::EnablePreMultipliedAlpha(preMultiplied);
+}
+
void AnimatedImageVisual::OnDoAction(const Dali::Property::Index actionId, const Dali::Property::Value& attributes)
{
// Make not set any action when the resource status is already failed.
if(mPixelArea != FULL_TEXTURE_RECT)
{
- mImpl->mRenderer.RegisterProperty(PIXEL_AREA_UNIFORM_NAME, mPixelArea);
+ mPixelAreaIndex = mImpl->mRenderer.RegisterProperty(mPixelAreaIndex, PIXEL_AREA_UNIFORM_NAME, mPixelArea);
}
if(mMaskingData)
mImpl->mRenderer.RegisterProperty(CROP_TO_MASK_NAME, static_cast<float>(mMaskingData->mCropToMask));
}
- // Enable PreMultipliedAlpha if it need premultiplied
+ // Enable PreMultipliedAlpha if it need.
auto preMultiplyOnLoad = IsPreMultipliedAlphaEnabled() && !mImpl->mCustomShader
? TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD
: TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
*/
void DoCreateInstancePropertyMap(Property::Map& map) const override;
+ /**
+ * @copydoc Visual::Base::EnablePreMultipliedAlpha
+ */
+ void EnablePreMultipliedAlpha(bool preMultiplied) override;
+
/**
* @copydoc Visual::Base::OnDoAction
*/
WeakHandle<Actor> mPlacementActor;
ImageVisualShaderFactory& mImageVisualShaderFactory;
+ // Variables for Image renderer
+ Vector4 mPixelArea;
+ Property::Index mPixelAreaIndex;
+ Property::Index mPreMultipliedAlphaIndex; ///< Index of premultipliedAlpha uniform.
+
// Variables for Animated Image player
- Vector4 mPixelArea;
VisualUrl mImageUrl;
Dali::AnimatedImageLoading mAnimatedImageLoading; // Only needed for animated image
uint32_t mFrameIndexForJumpTo; // Frame index into textureRects
{
const Vector4 FULL_TEXTURE_RECT(0.f, 0.f, 1.f, 1.f);
+constexpr float ALPHA_PRE_MULTIPLIED(1.0f);
+
+constexpr int CUSTOM_PROPERTY_COUNT(2); // PixelArea, pre-multiplied alpha
+
constexpr int NATIVE_SHADER_TYPE_OFFSET = VisualFactoryCache::ShaderType::NATIVE_IMAGE_SHADER - VisualFactoryCache::ShaderType::IMAGE_SHADER;
constexpr std::string_view Y_FLIP_MASK_TEXTURE = "uYFlipMaskTexture";
constexpr float NOT_FLIP_MASK_TEXTURE = 0.0f;
}
shader = factoryCache.GenerateAndSaveShader(shaderType, vertexShader, fragmentShader);
+
+ shader.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT +
+ (featureBuilder.IsEnabledAlphaMaskingOnRendering() ? 1 : 0));
+
shader.RegisterProperty(PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT);
+
+ // Most of image visual shader user (like svg, animated vector image visual) use pre-multiplied alpha.
+ // If the visual dont want to using pre-multiplied alpha, it should be set as 0.0f as renderer side.
+ shader.RegisterProperty(PREMULTIPLIED_ALPHA, ALPHA_PRE_MULTIPLIED);
+
if(featureBuilder.IsEnabledAlphaMaskingOnRendering())
{
shader.RegisterProperty(Y_FLIP_MASK_TEXTURE, NOT_FLIP_MASK_TEXTURE);
{
ShaderFlagList shaderOption = option.GetShaderOptions();
- auto featureBuilder = ImageVisualShaderFeature::FeatureBuilder();
+ auto featureBuilder = ImageVisualShaderFeature::FeatureBuilder();
std::string vertexPrefixList;
std::string fragmentPrefixList;
CreatePrecompileShader(featureBuilder, shaderOption);
VisualFactoryCache::ShaderType type = featureBuilder.GetShaderType();
featureBuilder.GetVertexShaderPrefixList(vertexPrefixList);
featureBuilder.GetFragmentShaderPrefixList(fragmentPrefixList);
- return SavePrecompileShader(type, vertexPrefixList, fragmentPrefixList );
+ return SavePrecompileShader(type, vertexPrefixList, fragmentPrefixList);
}
void ImageVisualShaderFactory::GetPreCompiledShader(RawShaderData& shaders)
shaders.shaderCount = 0;
int shaderCount = 0;
- for(uint32_t i = 0u; i < mRequestedPrecompileShader.size(); i++ )
+ for(uint32_t i = 0u; i < mRequestedPrecompileShader.size(); i++)
{
vertexPrefix.push_back(mRequestedPrecompileShader[i].vertexPrefix);
fragmentPrefix.push_back(mRequestedPrecompileShader[i].fragmentPrefix);
shaders.vertexShader = SHADER_IMAGE_VISUAL_SHADER_VERT;
shaders.fragmentShader = SHADER_IMAGE_VISUAL_SHADER_FRAG;
shaders.shaderCount = shaderCount;
- shaders.custom = false;
+ shaders.custom = false;
}
void ImageVisualShaderFactory::CreatePrecompileShader(ImageVisualShaderFeature::FeatureBuilder& builder, const ShaderFlagList& option)
bool ImageVisualShaderFactory::SavePrecompileShader(VisualFactoryCache::ShaderType shader, std::string& vertexPrefix, std::string& fragmentPrefix)
{
- for(uint32_t i = 0u; i< PREDEFINED_SHADER_TYPE_COUNT; i++)
+ for(uint32_t i = 0u; i < PREDEFINED_SHADER_TYPE_COUNT; i++)
{
if(ShaderTypePredefines[i] == shader)
{
}
}
- for(uint32_t i = 0u; i< mRequestedPrecompileShader.size(); i++)
+ for(uint32_t i = 0u; i < mRequestedPrecompileShader.size(); i++)
{
if(mRequestedPrecompileShader[i].type == shader)
{
}
RequestShaderInfo info;
- info.type = shader;
- info.vertexPrefix = vertexPrefix;
+ info.type = shader;
+ info.vertexPrefix = vertexPrefix;
info.fragmentPrefix = fragmentPrefix;
mRequestedPrecompileShader.push_back(info);
- DALI_LOG_RELEASE_INFO("Add precompile shader success!!(%s)",Scripting::GetLinearEnumerationName<VisualFactoryCache::ShaderType>(shader, VISUAL_SHADER_TYPE_TABLE, VISUAL_SHADER_TYPE_TABLE_COUNT));
+ DALI_LOG_RELEASE_INFO("Add precompile shader success!!(%s)", Scripting::GetLinearEnumerationName<VisualFactoryCache::ShaderType>(shader, VISUAL_SHADER_TYPE_TABLE, VISUAL_SHADER_TYPE_TABLE_COUNT));
return true;
}
{
namespace
{
-const int CUSTOM_PROPERTY_COUNT(7); // ltr, wrap, pixel area, atlas, pixalign, crop to mask, mask texture ratio
+const int CUSTOM_PROPERTY_COUNT(8); // ltr, wrap, pixel area, atlas, pixalign, crop to mask, mask texture ratio, pre-multiplied alpha
// fitting modes
DALI_ENUM_TO_STRING_TABLE_BEGIN(FITTING_MODE)
: Visual::Base(factoryCache, Visual::FittingMode::DONT_CARE, Toolkit::Visual::IMAGE),
mPixelArea(FULL_TEXTURE_RECT),
mPixelAreaIndex(Property::INVALID_INDEX),
+ mPreMultipliedAlphaIndex(Property::INVALID_INDEX),
mPlacementActor(),
mImageUrl(imageUrl),
mMaskingData(),
}
}
+void ImageVisual::EnablePreMultipliedAlpha(bool preMultiplied)
+{
+ if(mImpl->mRenderer)
+ {
+ if(mPreMultipliedAlphaIndex != Property::INVALID_INDEX || !preMultiplied)
+ {
+ // RegisterUniqueProperty call SetProperty internally.
+ // Register PREMULTIPLIED_ALPHA only if it become false.
+ // Default PREMULTIPLIED_ALPHA value is 1.0f, at image-visual-shader-factory.cpp
+ mPreMultipliedAlphaIndex = mImpl->mRenderer.RegisterUniqueProperty(mPreMultipliedAlphaIndex, PREMULTIPLIED_ALPHA, preMultiplied ? 1.0f : 0.0f);
+ }
+ }
+
+ Visual::Base::EnablePreMultipliedAlpha(preMultiplied);
+}
+
void ImageVisual::OnDoAction(const Dali::Property::Index actionId, const Dali::Property::Value& attributes)
{
// Check if action is valid for this visual type and perform action if possible
*/
void DoCreateInstancePropertyMap(Property::Map& map) const override;
+ /**
+ * @copydoc Visual::Base::EnablePreMultipliedAlpha
+ */
+ void EnablePreMultipliedAlpha(bool preMultiplied) override;
+
/**
* @copydoc Visual::Base::OnDoAction
*/
Geometry GenerateGeometry(TextureManager::TextureId textureId, bool createForce);
private:
- Vector4 mPixelArea;
- Property::Index mPixelAreaIndex;
+ Vector4 mPixelArea;
+ Property::Index mPixelAreaIndex;
+ Property::Index mPreMultipliedAlphaIndex; ///< Index of premultipliedAlpha uniform.
+
WeakHandle<Actor> mPlacementActor;
VisualUrl mImageUrl;
TextureManager::MaskingDataPointer mMaskingData;
{
namespace
{
-const int CUSTOM_PROPERTY_COUNT(5); // fixed(3),stretch,aux
+const int CUSTOM_PROPERTY_COUNT(6); // fixed(3),stretch,aux,pre-muliplied alpha
}
/////////////////NPatchVisual////////////////
? TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD
: TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
+ // Register PREMULTIPLIED_ALPHA property here.
+ mPreMultipliedAlphaIndex = mImpl->mRenderer.RegisterUniqueProperty(mPreMultipliedAlphaIndex, PREMULTIPLIED_ALPHA, IsPreMultipliedAlphaEnabled() ? 1.0f : 0.0f);
+
TextureManager::MaskingDataPointer maskingDataPtr = nullptr;
ImageAtlasManagerPtr imageAtlasManagerPtr = nullptr;
}
}
+void NPatchVisual::EnablePreMultipliedAlpha(bool preMultiplied)
+{
+ if(mImpl->mRenderer && mPreMultipliedAlphaIndex != Property::INVALID_INDEX)
+ {
+ mImpl->mRenderer.SetProperty(mPreMultipliedAlphaIndex, preMultiplied ? 1.0f : 0.0f);
+ }
+
+ Visual::Base::EnablePreMultipliedAlpha(preMultiplied);
+}
+
NPatchVisual::NPatchVisual(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory)
: Visual::Base(factoryCache, Visual::FittingMode::DONT_CARE, Toolkit::Visual::N_PATCH),
mPlacementActor(),
mAuxiliaryTextureSet(),
mAuxiliaryTextureId(TextureManager::INVALID_TEXTURE_ID),
mAuxiliaryResourceStatus(Toolkit::Visual::ResourceStatus::PREPARING),
+ mPreMultipliedAlphaIndex(Property::INVALID_INDEX),
mBorderOnly(false),
mBorder(),
mAuxiliaryImageAlpha(0.0f),
#define DALI_TOOLKIT_INTERNAL_N_PATCH_VISUAL_H
/*
- * 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.
*/
void DoCreateInstancePropertyMap(Property::Map& map) const override;
+ /**
+ * @copydoc Visual::Base::EnablePreMultipliedAlpha
+ */
+ void EnablePreMultipliedAlpha(bool preMultiplied) override;
+
protected:
/**
* @brief Constructor.
TextureSet mAuxiliaryTextureSet; ///< TextureSet of the auxiliary mask image
TextureManager::TextureId mAuxiliaryTextureId; ///< id of the auxiliary mask image (from TextureManager)
Toolkit::Visual::ResourceStatus mAuxiliaryResourceStatus; ///< resource status for auxiliary mask image
+ Property::Index mPreMultipliedAlphaIndex; ///< Index of premultipliedAlpha uniform. Only be used for auxiliary image.
bool mBorderOnly; ///< if only border is desired
Rect<int> mBorder; ///< The size of the border
float mAuxiliaryImageAlpha; ///< The alpha value for the auxiliary image only
void TextVisual::OnInitialize()
{
- Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY);
- auto featureBuilder = TextVisualShaderFeature::FeatureBuilder();
- Shader shader = GetTextShader(mFactoryCache, featureBuilder);
+ Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY);
+ auto featureBuilder = TextVisualShaderFeature::FeatureBuilder();
+ Shader shader = GetTextShader(mFactoryCache, featureBuilder);
mImpl->mRenderer = VisualRenderer::New(geometry, shader);
mImpl->mRenderer.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT);
// Enable the pre-multiplied alpha to improve the text quality
renderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, true);
- renderer.SetProperty(VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA, true);
// Set size and offset for the tiling.
renderer.SetProperty(VisualRenderer::Property::TRANSFORM_SIZE, Vector2(static_cast<float>(info.width), static_cast<float>(info.height)));
if(mImpl->mRenderer)
{
// Update values from Renderer
- mImpl->mMixColor = mImpl->mRenderer.GetProperty<Vector3>(VisualRenderer::Property::VISUAL_MIX_COLOR);
- mImpl->mMixColor.a = mImpl->mRenderer.GetProperty<float>(DevelRenderer::Property::OPACITY);
+ mImpl->mMixColor = mImpl->mRenderer.GetProperty<Vector4>(Renderer::Property::MIX_COLOR);
mImpl->mTransform.mOffset = mImpl->mRenderer.GetProperty<Vector2>(VisualRenderer::Property::TRANSFORM_OFFSET);
mImpl->mTransform.mSize = mImpl->mRenderer.GetProperty<Vector2>(VisualRenderer::Property::TRANSFORM_SIZE);
if(mImpl->mRenderer)
{
mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, preMultiplied);
- mImpl->mRenderer.SetProperty(VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA, preMultiplied);
}
}
if(mImpl->mRenderer)
{
// All visual renderers now use same mix color / opacity properties.
- mImpl->mRenderer.SetProperty(VisualRenderer::Property::VISUAL_MIX_COLOR, Vector3(mImpl->mMixColor));
- mImpl->mRenderer.SetProperty(DevelRenderer::Property::OPACITY, mImpl->mMixColor.a);
+ mImpl->mRenderer.SetProperty(Renderer::Property::MIX_COLOR, mImpl->mMixColor);
- float preMultipliedAlpha = 0.0f;
- if(IsPreMultipliedAlphaEnabled())
- {
- preMultipliedAlpha = 1.0f;
- }
- mImpl->mRenderer.SetProperty(VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA, preMultipliedAlpha);
+ mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, IsPreMultipliedAlphaEnabled());
}
}
if(mImpl->mRenderer)
{
- mImpl->mRenderer.SetProperty(VisualRenderer::Property::VISUAL_MIX_COLOR, Vector3(color));
- mImpl->mRenderer.SetProperty(DevelRenderer::Property::OPACITY, color.a);
+ mImpl->mRenderer.SetProperty(Renderer::Property::MIX_COLOR, color);
}
}
if(mImpl->mRenderer)
{
- mImpl->mRenderer.SetProperty(VisualRenderer::Property::VISUAL_MIX_COLOR, color);
+ mImpl->mRenderer.SetProperty(Renderer::Property::MIX_COLOR_RED, color.r);
+ mImpl->mRenderer.SetProperty(Renderer::Property::MIX_COLOR_GREEN, color.g);
+ mImpl->mRenderer.SetProperty(Renderer::Property::MIX_COLOR_BLUE, color.b);
}
}
}
case Dali::Toolkit::Visual::Property::MIX_COLOR:
{
- return VisualRenderer::Property::VISUAL_MIX_COLOR;
+ return Renderer::Property::MIX_COLOR;
}
case Dali::Toolkit::Visual::Property::OPACITY:
{
- return DevelRenderer::Property::OPACITY;
+ return Renderer::Property::OPACITY;
}
case Dali::Toolkit::Visual::Property::PREMULTIPLIED_ALPHA:
{
- return VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA;
+ return Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA;
}
case Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS:
{
Dali::Animation& transition,
Internal::TransitionData::Animator& animator,
Property::Index index,
- Property::Value& initialValue,
- Property::Value& targetValue)
+ const Property::Value& initialValue,
+ const Property::Value& targetValue)
{
if(index != Property::INVALID_INDEX)
{
mImpl->mMixColor.a = targetOpacity;
}
- SetupTransition(transition, animator, DevelRenderer::Property::OPACITY, animator.initialValue, animator.targetValue);
+ SetupTransition(transition, animator, Renderer::Property::OPACITY, animator.initialValue, animator.targetValue);
}
void Visual::Base::AnimateRendererProperty(
{
bool animateOpacity = false;
- Property::Value initialOpacity;
- Property::Value targetOpacity;
- Property::Value initialMixColor;
- Property::Value targetMixColor;
-
- Vector4 initialColor;
- if(animator.initialValue.Get(initialColor))
+ Vector4 initialMixColor;
+ Vector4 targetMixColor;
+ if(animator.initialValue.Get(initialMixColor))
{
- if(animator.initialValue.GetType() == Property::VECTOR4)
+ if(animator.initialValue.GetType() != Property::VECTOR4)
{
- // if there is an initial color specifying alpha, test it
- initialOpacity = initialColor.a;
+ // if there is non initial color specifying alpha, get from cached mix color
+ initialMixColor.a = mImpl->mMixColor.a;
}
- initialMixColor = Vector3(initialColor);
}
// Set target value into data store
if(animator.targetValue.GetType() != Property::NONE)
{
- Vector4 mixColor;
- animator.targetValue.Get(mixColor);
+ animator.targetValue.Get(targetMixColor);
if(animator.targetValue.GetType() == Property::VECTOR4)
{
- mImpl->mMixColor.a = mixColor.a;
- targetOpacity = mixColor.a;
+ mImpl->mMixColor.a = targetMixColor.a;
animateOpacity = true;
}
- mImpl->mMixColor.r = mixColor.r;
- mImpl->mMixColor.g = mixColor.g;
- mImpl->mMixColor.b = mixColor.b;
- targetMixColor = Vector3(mixColor);
+ mImpl->mMixColor.r = targetMixColor.r;
+ mImpl->mMixColor.g = targetMixColor.g;
+ mImpl->mMixColor.b = targetMixColor.b;
}
- SetupTransition(transition, animator, VisualRenderer::Property::VISUAL_MIX_COLOR, initialMixColor, targetMixColor);
-
if(animateOpacity)
{
- SetupTransition(transition, animator, DevelRenderer::Property::OPACITY, initialOpacity, targetOpacity);
+ SetupTransition(transition, animator, Renderer::Property::MIX_COLOR, initialMixColor, targetMixColor);
+ }
+ else
+ {
+ SetupTransition(transition, animator, Renderer::Property::MIX_COLOR_RED, initialMixColor.r, targetMixColor.r);
+ SetupTransition(transition, animator, Renderer::Property::MIX_COLOR_GREEN, initialMixColor.g, targetMixColor.g);
+ SetupTransition(transition, animator, Renderer::Property::MIX_COLOR_BLUE, initialMixColor.b, targetMixColor.b);
}
}
// Default animatable properties from VisualRenderer
case Toolkit::Visual::Property::MIX_COLOR:
{
- return Dali::Property(mImpl->mRenderer, VisualRenderer::Property::VISUAL_MIX_COLOR);
+ return Dali::Property(mImpl->mRenderer, Renderer::Property::MIX_COLOR);
}
case Toolkit::Visual::Property::OPACITY:
{
- return Dali::Property(mImpl->mRenderer, DevelRenderer::Property::OPACITY);
+ return Dali::Property(mImpl->mRenderer, Renderer::Property::OPACITY);
}
case Toolkit::Visual::Transform::Property::OFFSET:
{
((mImpl->mType == Toolkit::Visual::COLOR && key.indexKey == ColorVisual::Property::MIX_COLOR) ||
(mImpl->mType == Toolkit::Visual::PRIMITIVE && key.indexKey == PrimitiveVisual::Property::MIX_COLOR)))
{
- return Dali::Property(mImpl->mRenderer, VisualRenderer::Property::VISUAL_MIX_COLOR);
+ return Dali::Property(mImpl->mRenderer, Renderer::Property::MIX_COLOR);
}
// Special case for BLUR_RADIUS
void SetupTransition(Dali::Animation& transition,
Internal::TransitionData::Animator& animator,
Property::Index index,
- Property::Value& initialValue,
- Property::Value& targetValue);
+ const Property::Value& initialValue,
+ const Property::Value& targetValue);
/**
* Animate the opacity property - Special handling to
float destinationBorderlineOffset = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, defaultBorderlineOffset);
// If the value of the source Control and that of destination Control is different, the property should be transitioned.
- if(Vector3(sourceMixColor) != Vector3(destinationMixColor))
+ if(sourceMixColor != destinationMixColor)
{
- sourcePropertyMap.Add(Dali::Toolkit::Visual::Property::MIX_COLOR, Vector3(sourceMixColor));
- destinationPropertyMap.Add(Dali::Toolkit::Visual::Property::MIX_COLOR, Vector3(destinationMixColor));
- }
-
- if(std::abs(sourceMixColor.a - destinationMixColor.a) > Math::MACHINE_EPSILON_1)
- {
- sourcePropertyMap.Add(Dali::Toolkit::Visual::Property::OPACITY, sourceMixColor.a);
- destinationPropertyMap.Add(Dali::Toolkit::Visual::Property::OPACITY, destinationMixColor.a);
+ sourcePropertyMap.Add(Dali::Toolkit::Visual::Property::MIX_COLOR, sourceMixColor);
+ destinationPropertyMap.Add(Dali::Toolkit::Visual::Property::MIX_COLOR, destinationMixColor);
}
if(sourceCornerRadius != destinationCornerRadius)
#define DALI_TOOLKIT_VISUAL_PROPERTIES_H
/*
- * Copyright (c) 2020 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.
* @details Name "mixColor", type Property::VECTOR3 or Property::VECTOR4, animatable
* @SINCE_1_2.60
* @note Optional
- * @note To animate an opacity, OPACITY property should be used.
+ * @note Animate support for Property::VECTOR4, which OPACITY property included.
*/
MIX_COLOR,