application.Render();
Vector3 targetColor(1.0f, 1.0f, 1.0f);
+ Vector2 targetOffset(0.05f, 0.05f);
+ Vector2 targetSize(1.1f, 1.1f);
float targetOpacity = 0.5f;
float targetCornerRadius = 20.0f;
float targetBlurRadius = 10.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);
animation.AnimateTo(DevelControl::GetVisualProperty(dummyControl, DummyControl::Property::TEST_VISUAL, DevelColorVisual::Property::BLUR_RADIUS), targetBlurRadius);
animation.Play();
DALI_TEST_CHECK(colorValue);
DALI_TEST_EQUALS(colorValue->Get<Vector4>(), Vector4(targetColor.r, targetColor.g, targetColor.b, targetOpacity), TEST_LOCATION);
+ Property::Value* transformValue = resultMap.Find(Dali::Toolkit::Visual::Property::TRANSFORM);
+ Dali::Property::Map* transformMap = transformValue->GetMap();
+ DALI_TEST_CHECK(transformMap);
+
+ Property::Value* offsetValue = transformMap->Find(Toolkit::Visual::Transform::Property::OFFSET);
+ DALI_TEST_CHECK(offsetValue);
+ DALI_TEST_EQUALS(offsetValue->Get<Vector2>(), targetOffset, TEST_LOCATION);
+
+ Property::Value* sizeValue = transformMap->Find(Toolkit::Visual::Transform::Property::SIZE);
+ DALI_TEST_CHECK(sizeValue);
+ DALI_TEST_EQUALS(sizeValue->Get<Vector2>(), targetSize, TEST_LOCATION);
+
Property::Value* cornerRadiusValue = resultMap.Find(DevelVisual::Property::CORNER_RADIUS, Property::FLOAT);
DALI_TEST_CHECK(cornerRadiusValue);
DALI_TEST_EQUALS(cornerRadiusValue->Get< float >(), targetCornerRadius, 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<float>("cornerRadius", targetCornerRadius), true, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<float>("blurRadius", targetBlurRadius), true, TEST_LOCATION);
application.Render();
Vector3 targetColor(1.0f, 1.0f, 1.0f);
+ Vector2 targetOffset(0.05f, 0.05f);
+ Vector2 targetSize(1.1f, 1.1f);
float targetOpacity = 0.5f;
float targetCornerRadius = 20.0f;
float targetBlurRadius = 10.0f;
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);
animation.AnimateTo(DevelControl::GetVisualProperty(dummyControl, DummyControl::Property::TEST_VISUAL, "blurRadius"), targetBlurRadius);
animation.Play();
DALI_TEST_CHECK(colorValue);
DALI_TEST_EQUALS(colorValue->Get<Vector4>(), Vector4(targetColor.r, targetColor.g, targetColor.b, targetOpacity), TEST_LOCATION);
+ Property::Value* transformValue = resultMap.Find(Dali::Toolkit::Visual::Property::TRANSFORM);
+ Dali::Property::Map* transformMap = transformValue->GetMap();
+ DALI_TEST_CHECK(transformMap);
+
+ Property::Value* offsetValue = transformMap->Find(Toolkit::Visual::Transform::Property::OFFSET);
+ DALI_TEST_CHECK(offsetValue);
+ DALI_TEST_EQUALS(offsetValue->Get<Vector2>(), targetOffset, TEST_LOCATION);
+
+ Property::Value* sizeValue = transformMap->Find(Toolkit::Visual::Transform::Property::SIZE);
+ DALI_TEST_CHECK(sizeValue);
+ DALI_TEST_EQUALS(sizeValue->Get<Vector2>(), targetSize, TEST_LOCATION);
+
Property::Value* cornerRadiusValue = resultMap.Find(DevelVisual::Property::CORNER_RADIUS, Property::FLOAT);
DALI_TEST_CHECK(cornerRadiusValue);
DALI_TEST_EQUALS(cornerRadiusValue->Get< float >(), targetCornerRadius, 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<float>("cornerRadius", targetCornerRadius), true, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<float>("blurRadius", targetBlurRadius), true, TEST_LOCATION);
}
Internal::Visual::Base::Impl::Transform::Transform()
-: mOffset( 0.0f,0.0f ),
- mSize( 1.0f,1.0f ),
- mExtraSize( 0.0f,0.0f ),
- mOffsetSizeMode( 0.0f,0.0f,0.0f,0.0f ),
- mOrigin( Toolkit::Align::TOP_BEGIN ),
- mAnchorPoint( Toolkit::Align::TOP_BEGIN )
+: mOffset(0.0f, 0.0f),
+ mSize(1.0f, 1.0f),
+ mExtraSize(0.0f, 0.0f),
+ mOffsetSizeMode(0.0f, 0.0f, 0.0f, 0.0f),
+ mOrigin(Toolkit::Align::TOP_BEGIN),
+ mAnchorPoint(Toolkit::Align::TOP_BEGIN),
+ mOffsetIndex(Property::INVALID_INDEX),
+ mSizeIndex(Property::INVALID_INDEX)
{
}
void Internal::Visual::Base::Impl::Transform::RegisterUniforms( Dali::Renderer renderer, Toolkit::Direction::Type direction )
{
- renderer.RegisterProperty( SIZE, mSize );
- renderer.RegisterProperty( OFFSET, direction == Toolkit::Direction::LEFT_TO_RIGHT ? mOffset : mOffset * Vector2(-1.0f,1.0f));
+ mSizeIndex = renderer.RegisterProperty(SIZE, mSize);
+ mOffsetIndex = renderer.RegisterProperty(OFFSET, direction == Toolkit::Direction::LEFT_TO_RIGHT ? mOffset : mOffset * Vector2(-1.0f, 1.0f));
renderer.RegisterProperty( OFFSET_SIZE_MODE, mOffsetSizeMode );
renderer.RegisterProperty( ORIGIN, PointToVector2( mOrigin, direction ) - Vector2(0.5,0.5) );
renderer.RegisterProperty( ANCHOR_POINT, Vector2(0.5,0.5) - PointToVector2( mAnchorPoint, direction ) );
// Update values from Renderer
mImpl->mMixColor = mImpl->mRenderer.GetProperty<Vector3>(mImpl->mMixColorIndex);
mImpl->mMixColor.a = mImpl->mRenderer.GetProperty<float>(DevelRenderer::Property::OPACITY);
+ if(mImpl->mTransform.mOffsetIndex != Property::INVALID_INDEX)
+ {
+ mImpl->mTransform.mOffset = mImpl->mRenderer.GetProperty<Vector2>(mImpl->mTransform.mOffsetIndex);
+ }
+ if(mImpl->mTransform.mSizeIndex != Property::INVALID_INDEX)
+ {
+ mImpl->mTransform.mSize = mImpl->mRenderer.GetProperty<Vector2>(mImpl->mTransform.mSizeIndex);
+ }
if(mImpl->mCornerRadiusIndex != Property::INVALID_INDEX)
{
mImpl->mCornerRadius = mImpl->mRenderer.GetProperty<float>(mImpl->mCornerRadiusIndex);
// Update values from Renderer
mImpl->mMixColor = mImpl->mRenderer.GetProperty<Vector3>(mImpl->mMixColorIndex);
mImpl->mMixColor.a = mImpl->mRenderer.GetProperty<float>(DevelRenderer::Property::OPACITY);
+ if(mImpl->mTransform.mOffsetIndex != Property::INVALID_INDEX)
+ {
+ mImpl->mTransform.mOffset = mImpl->mRenderer.GetProperty<Vector2>(mImpl->mTransform.mOffsetIndex);
+ }
+ if(mImpl->mTransform.mSizeIndex != Property::INVALID_INDEX)
+ {
+ mImpl->mTransform.mSize = mImpl->mRenderer.GetProperty<Vector2>(mImpl->mTransform.mSizeIndex);
+ }
if(mImpl->mCornerRadiusIndex != Property::INVALID_INDEX)
{
mImpl->mCornerRadius = mImpl->mRenderer.GetProperty<float>(mImpl->mCornerRadiusIndex);
{
return Dali::Property(mImpl->mRenderer, DevelRenderer::Property::OPACITY);
}
+ else if(key.indexKey == Toolkit::Visual::Transform::Property::OFFSET)
+ {
+ return Dali::Property(mImpl->mRenderer, OFFSET);
+ }
+ else if(key.indexKey == Toolkit::Visual::Transform::Property::SIZE)
+ {
+ return Dali::Property(mImpl->mRenderer, SIZE);
+ }
}
else
{
{
return Dali::Property(mImpl->mRenderer, DevelRenderer::Property::OPACITY);
}
+ else if(key.stringKey == OFFSET)
+ {
+ return Dali::Property(mImpl->mRenderer, OFFSET);
+ }
+ else if(key.stringKey == SIZE)
+ {
+ return Dali::Property(mImpl->mRenderer, SIZE);
+ }
}
// Other cases
// Register CORNER_RADIUS property
mImpl->mCornerRadiusIndex = mImpl->mRenderer.RegisterProperty(DevelVisual::Property::CORNER_RADIUS, CORNER_RADIUS, mImpl->mCornerRadius);
mImpl->mRenderer.RegisterProperty(CORNER_RADIUS_POLICY, mImpl->mCornerRadiusPolicy);
- index = mImpl->mCornerRadiusIndex;
+ mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
+
+ index = mImpl->mCornerRadiusIndex;
mImpl->mNeedCornerRadius = true;
// Change shader