/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
Vector3(mImpl->mMixColor) );
}
- if( mImpl->mMixColor.a < 1.f )
- {
- mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
- }
-
mImpl->mRenderer.SetProperty( DevelRenderer::Property::OPACITY, mImpl->mMixColor.a );
float preMultipliedAlpha = 0.0f;
{
mImpl->mRenderer.SetProperty( mImpl->mMixColorIndex, Vector3(color) );
mImpl->mRenderer.SetProperty( DevelRenderer::Property::OPACITY, color.a );
- if( color.a < 1.f )
- {
- mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
- }
}
}
Dali::Animation& transition,
Internal::TransitionData::Animator& animator )
{
- bool isOpaque = mImpl->mMixColor.a >= 1.0f;
-
- float initialOpacity;
- if( animator.initialValue.Get( initialOpacity ) )
- {
- isOpaque = (initialOpacity >= 1.0f);
- }
-
float targetOpacity;
if( animator.targetValue.Get( targetOpacity ) )
{
}
SetupTransition( transition, animator, DevelRenderer::Property::OPACITY, animator.initialValue, animator.targetValue );
- SetupBlendMode( transition, isOpaque, animator.animate );
}
void Visual::Base::AnimateRendererProperty(
{
Property::Index index = mImpl->mMixColorIndex;
bool animateOpacity = false;
- bool isOpaque = true;
Property::Value initialOpacity;
Property::Value targetOpacity;
if( animator.initialValue.GetType() == Property::VECTOR4 )
{
// if there is an initial color specifying alpha, test it
- isOpaque = initialColor.a >= 1.0f;
initialOpacity = initialColor.a;
}
initialMixColor = Vector3( initialColor );
if( animateOpacity )
{
SetupTransition( transition, animator, DevelRenderer::Property::OPACITY, initialOpacity, targetOpacity );
- SetupBlendMode( transition, isOpaque, animator.animate );
- }
- }
-}
-
-void Visual::Base::SetupBlendMode( Animation& transition, bool isInitialOpaque, bool animating )
-{
- // Ensure the blend mode is turned on if we are animating opacity, and
- // turned off after the animation ends if the final value is opaque
- if( ! isInitialOpaque || mImpl->mMixColor.a < 1.0f )
- {
- if( mImpl->mRenderer )
- {
- mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
-
- if( animating == true && mImpl->mMixColor.a >= 1.0f )
- {
- // When it becomes opaque, set the blend mode back to automatically
- if( ! mImpl->mBlendSlotDelegate )
- {
- mImpl->mBlendSlotDelegate = new SlotDelegate<Visual::Base>(this);
- }
- transition.FinishedSignal().Connect( *(mImpl->mBlendSlotDelegate),
- &Visual::Base::OnMixColorFinished );
- }
}
}
}
-void Visual::Base::OnMixColorFinished( Animation& animation )
-{
- if( mImpl->mRenderer )
- {
- DALI_LOG_INFO( gVisualBaseLogFilter, Debug::General, "Visual::Base::OnMixColorFinished()\n");
- mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE,
- ( mImpl->mMixColor.a < 1.0 ) ? BlendMode::ON : BlendMode::AUTO );
- }
- delete mImpl->mBlendSlotDelegate;
- mImpl->mBlendSlotDelegate = NULL;
-}
-
} // namespace Internal
} // namespace Toolkit