Version: 0.1
Release: 0
Group: Development/Tools
-License: Apache-2.0
+License: Apache-2.0 and OFL-1.1
Source0: %{name}-%{version}.tar.gz
Requires: dali
Requires: dali-adaptor
RenderTaskList taskList2 = Stage::GetCurrent().GetRenderTaskList();
DALI_TEST_CHECK( 1u != taskList2.GetTaskCount() );
+ DALI_TEST_CHECK( 2u == view.GetChildCount() );
view.Deactivate();
RenderTaskList taskList3 = Stage::GetCurrent().GetRenderTaskList();
DALI_TEST_CHECK( 1u == taskList3.GetTaskCount() );
+ DALI_TEST_CHECK( 1u == view.GetChildCount() );
+
END_TEST;
}
propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
propertyMap.Insert(Visual::Property::MIX_COLOR, Color::BLUE);
propertyMap.Insert( DevelVisual::Property::CORNER_RADIUS, 10.0f );
+ propertyMap.Insert( DevelColorVisual::Property::BLUR_RADIUS, 20.0f );
Visual::Base colorVisual = factory.CreateVisual( propertyMap );
Property::Map resultMap;
DALI_TEST_CHECK( colorValue );
DALI_TEST_CHECK( colorValue->Get<Vector4>() == Color::BLUE );
- Property::Value* radiusValue = resultMap.Find( DevelVisual::Property::CORNER_RADIUS, Property::FLOAT );
- DALI_TEST_CHECK( radiusValue );
- DALI_TEST_CHECK( radiusValue->Get< float >() == 10.0f );
+ Property::Value* cornerRadiusValue = resultMap.Find( DevelVisual::Property::CORNER_RADIUS, Property::FLOAT );
+ DALI_TEST_CHECK( cornerRadiusValue );
+ DALI_TEST_CHECK( cornerRadiusValue->Get< float >() == 10.0f );
+
+ Property::Value* blurRadiusValue = resultMap.Find( DevelColorVisual::Property::BLUR_RADIUS, Property::FLOAT );
+ DALI_TEST_CHECK( blurRadiusValue );
+ DALI_TEST_CHECK( blurRadiusValue->Get< float >() == 20.0f );
// change the blend color
propertyMap[ColorVisual::Property::MIX_COLOR] = Color::CYAN;
DALI_TEST_CHECK( colorValue );
DALI_TEST_CHECK( colorValue->Get<Vector4>() == Color::CYAN );
+ // Test wrong values
+ propertyMap[DevelColorVisual::Property::BLUR_RADIUS] = "3.0f";
+
+ colorVisual = factory.CreateVisual( propertyMap );
+ colorVisual.CreatePropertyMap( resultMap );
+
+ blurRadiusValue = resultMap.Find( DevelColorVisual::Property::BLUR_RADIUS, Property::FLOAT );
+ DALI_TEST_CHECK( blurRadiusValue );
+ DALI_TEST_CHECK( blurRadiusValue->Get< float >() == 0.0f );
+
END_TEST;
}
END_TEST;
}
+
+int UtcDaliColorVisualBlurRadius(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliColorVisualBlurRadius" );
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map properties;
+ float blurRadius = 20.0f;
+
+ properties[Visual::Property::TYPE] = Visual::COLOR;
+ properties[ColorVisual::Property::MIX_COLOR] = Color::BLUE;
+ properties["blurRadius"] = blurRadius;
+
+ Visual::Base visual = factory.CreateVisual( properties );
+
+ // trigger creation through setting on stage
+ DummyControl dummy = DummyControl::New( true );
+ Impl::DummyControl& dummyImpl = static_cast< Impl::DummyControl& >( dummy.GetImplementation() );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+
+ dummy.SetSize( 200.f, 200.f );
+ dummy.SetParentOrigin( ParentOrigin::CENTER );
+ Stage::GetCurrent().Add( dummy );
+
+ application.SendNotification();
+ application.Render();
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue< float >( "blurRadius", blurRadius ), true, TEST_LOCATION );
+
+ END_TEST;
+}
ALIASES += SINCE_1_2="@since 1.2"
ALIASES += SINCE_1_3="@since 1.3"
ALIASES += SINCE_1_4="@since 1.4"
+ALIASES += SINCE_1_9="@since 1.9"
# Extra tags for Tizen 3.0
ALIASES += SINCE_1_2_2="@since 1.2.2"
#ALIASES += SINCE_1_2="\par Since:\n 4.0, DALi version 1.2"
#ALIASES += SINCE_1_3="\par Since:\n 5.0, DALi version 1.3"
#ALIASES += SINCE_1_4="\par Since:\n 5.5, DALi version 1.4"
+#ALIASES += SINCE_1_9="\par Since:\n 6.0, DALi version 1.9"
## Extra tags for Tizen 3.0
#ALIASES += SINCE_1_2_2="\par Since:\n 3.0, DALi version 1.2.2"
#define DALI_TOOLKIT_COLOR_VISUAL_PROPERTIES_DEVEL_H
/*
- * Copyright (c) 2017 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.
* @note By default it's false, i.e. ColorVisual will not render if the MIX_COLOR is transparent.
*/
RENDER_IF_TRANSPARENT = MIX_COLOR + 1,
+
+ /**
+ * @brief The blur radius of the visual.
+ * @details Name "blurRadius", type Property::FLOAT.
+ * If the value is 0, the edge is sharp. Otherwise, the larger the value, the more the edge is blurred.
+ * @note Optional.
+ * @note The default is 0.
+ * @note The visual size increases by the blur radius.
+ */
+ BLUR_RADIUS = MIX_COLOR + 2,
};
} // namespace Property
#define DALI_TOOLKIT_DEVEL_API_VISUALS_VISUAL_PROPERTIES_DEVEL_H
/*
- * 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.
/**
* @brief The radius for the rounded corners of the visual
- * @details Name "cornerRadius", type Property::FLOAT or Property::VECTOR4.
+ * @details Name "cornerRadius", type Property::FLOAT.
* @note Optional.
*/
CORNER_RADIUS = OPACITY + 2,
//////////////////////////////////////////////////////
// Connect to actor tree
Self().Add( mChildrenRoot );
- Self().Add( mInternalRoot );
mInternalRoot.Add( mHorizBlurActor );
mInternalRoot.Add( mVertBlurActor );
mInternalRoot.Add( mRenderDownsampledCamera );
void GaussianBlurView::Activate()
{
// make sure resources are allocated and start the render tasks processing
+ Self().Add( mInternalRoot );
AllocateResources();
CreateRenderTasks();
mActivated = true;
{
// stop render tasks processing
// Note: render target resources are automatically freed since we set the Image::Unused flag
+ mInternalRoot.Unparent();
RemoveRenderTasks();
mRenderTargetForRenderingChildren.Reset();
mRenderTarget1.Reset();
/*
- * 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.
{\n
mediump float dist = length( max( abs( vPosition ), vRectSize ) - vRectSize ) - cornerRadius;\n
gl_FragColor = uColor * vec4( mixColor, 1.0 );\n
- gl_FragColor.a *= smoothstep( 1.0, -1.0, dist );\n
+ gl_FragColor.a *= 1.0 - smoothstep( -1.0, 1.0, dist );\n
+ }\n
+);
+
+const char* VERTEX_SHADER_BLUR_EDGE = DALI_COMPOSE_SHADER(
+ attribute mediump vec2 aPosition;\n
+ uniform highp mat4 uMvpMatrix;\n
+ uniform mediump vec3 uSize;\n
+ varying mediump vec2 vPosition;\n
+ varying mediump vec2 vRectSize;\n
+ \n
+ //Visual size and offset
+ uniform mediump vec2 offset;\n
+ uniform mediump vec2 size;\n
+ uniform mediump vec4 offsetSizeMode;\n
+ uniform mediump vec2 origin;\n
+ uniform mediump vec2 anchorPoint;\n
+ uniform mediump float blurRadius;\n
+ \n
+ vec4 ComputeVertexPosition()\n
+ {\n
+ vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + blurRadius * 2.0;\n
+ vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
+ vRectSize = visualSize / 2.0;\n
+ vPosition = aPosition* visualSize;\n
+ return vec4( vPosition + anchorPoint*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n
+ }\n
+ \n
+ void main()\n
+ {\n
+ gl_Position = uMvpMatrix * ComputeVertexPosition();\n
+ }\n
+);
+
+const char* FRAGMENT_SHADER_BLUR_EDGE = DALI_COMPOSE_SHADER(
+ varying mediump vec2 vPosition;\n
+ varying mediump vec2 vRectSize;\n
+ uniform lowp vec4 uColor;\n
+ uniform lowp vec3 mixColor;\n
+ uniform mediump float blurRadius;\n
+ \n
+ void main()\n
+ {\n
+ mediump vec2 blur = 1.0 - smoothstep( vRectSize - blurRadius * 2.0, vRectSize, abs( vPosition ) );\n
+ gl_FragColor = uColor * vec4( mixColor, 1.0 );\n
+ gl_FragColor.a *= blur.x * blur.y;\n
}\n
);
ColorVisual::ColorVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache, Visual::FittingMode::FILL ),
+ mBlurRadius( 0.0f ),
mRenderIfTransparent( false )
{
}
DALI_LOG_ERROR( "ColorVisual: renderIfTransparent property has incorrect type: %d\n", renderIfTransparentValue->GetType() );
}
}
+
+ Property::Value* blurRadiusValue = propertyMap.Find( Toolkit::DevelColorVisual::Property::BLUR_RADIUS, BLUR_RADIUS_NAME );
+ if( blurRadiusValue )
+ {
+ if( !blurRadiusValue->Get( mBlurRadius ) )
+ {
+ DALI_LOG_ERROR( "ColorVisual:DoSetProperties:: BLUR_RADIUS property has incorrect type: %d\n", blurRadiusValue->GetType() );
+ }
+ }
}
void ColorVisual::DoSetOnStage( Actor& actor )
map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR );
map.Insert( Toolkit::ColorVisual::Property::MIX_COLOR, mImpl->mMixColor );
map.Insert( Toolkit::DevelColorVisual::Property::RENDER_IF_TRANSPARENT, mRenderIfTransparent );
+ map.Insert( Toolkit::DevelColorVisual::Property::BLUR_RADIUS, mBlurRadius );
}
void ColorVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
Shader shader;
- if( !IsRoundedCornerRequired() )
+ if( !EqualsZero( mBlurRadius ) )
+ {
+ shader = mFactoryCache.GetShader( VisualFactoryCache::COLOR_SHADER_BLUR_EDGE );
+ if( !shader )
+ {
+ shader = Shader::New( VERTEX_SHADER_BLUR_EDGE, FRAGMENT_SHADER_BLUR_EDGE );
+ mFactoryCache.SaveShader( VisualFactoryCache::COLOR_SHADER_BLUR_EDGE, shader );
+ }
+ }
+ else if( !IsRoundedCornerRequired() )
{
shader = mFactoryCache.GetShader( VisualFactoryCache::COLOR_SHADER );
if( !shader )
// String keys will get to this property.
mImpl->mMixColorIndex = DevelHandle::RegisterProperty( mImpl->mRenderer, Toolkit::ColorVisual::Property::MIX_COLOR, MIX_COLOR, Vector3(mImpl->mMixColor) );
- if( mImpl->mMixColor.a < 1.f )
+ mImpl->mRenderer.RegisterProperty( BLUR_RADIUS_NAME, mBlurRadius );
+
+ if( mImpl->mMixColor.a < 1.f || !EqualsZero( mBlurRadius ) )
{
mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
}
#define DALI_TOOLKIT_INTERNAL_COLOR_VISUAL_H
/*
- * Copyright (c) 2019 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.
private:
+ float mBlurRadius; ///< The blur radius
bool mRenderIfTransparent; ///< Whether we should render even if the mix-color is transparent.
};
#define DALI_TOOLKIT_VISUAL_FACTORY_CACHE_H
/*
- * Copyright (c) 2017 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.
{
COLOR_SHADER,
COLOR_SHADER_ROUNDED_CORNER,
+ COLOR_SHADER_BLUR_EDGE,
BORDER_SHADER,
BORDER_SHADER_ANTI_ALIASING,
GRADIENT_SHADER_LINEAR_USER_SPACE,
/*
- * 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.
// Color visual
const char * const RENDER_IF_TRANSPARENT_NAME( "renderIfTransparent" );
+const char * const BLUR_RADIUS_NAME( "blurRadius" );
// Image visual
const char * const IMAGE_URL_NAME( "url" );
#define DALI_TOOLKIT_INTERNAL_VISUAL_STRING_CONSTANTS_H
/*
- * 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.
// Color visual
extern const char * const RENDER_IF_TRANSPARENT_NAME;
+extern const char * const BLUR_RADIUS_NAME;
// Image visual
extern const char * const IMAGE_URL_NAME;
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 9;
-const unsigned int TOOLKIT_MICRO_VERSION = 4;
+const unsigned int TOOLKIT_MICRO_VERSION = 5;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali-toolkit
Summary: Dali 3D engine Toolkit
-Version: 1.9.4
+Version: 1.9.5
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT