DALI_TYPE_REGISTRATION_BEGIN( Toolkit::DummyControl, Toolkit::Control, Create );
DALI_TYPE_REGISTRATION_END()
-Dali::PropertyRegistration dummyControlVisualProperty(
+Dali::PropertyRegistration dummyControlVisualProperty01(
typeRegistration, "testVisual", Dali::Toolkit::DummyControl::Property::TEST_VISUAL, Dali::Property::MAP, &Dali::Toolkit::DummyControlImpl::SetProperty, &Dali::Toolkit::DummyControlImpl::GetProperty );
+Dali::PropertyRegistration dummyControlVisualProperty02(
+ typeRegistration, "testVisual", Dali::Toolkit::DummyControl::Property::TEST_VISUAL2, Dali::Property::MAP, &Dali::Toolkit::DummyControlImpl::SetProperty, &Dali::Toolkit::DummyControlImpl::GetProperty );
+
}
DummyControl DummyControlImpl::New()
return value;
}
-
-
-DummyControl DummyControlImplOverride::New()
+Toolkit::DummyControl Impl::DummyControl::New()
{
- IntrusivePtr< DummyControlImplOverride > impl = new DummyControlImplOverride;
- DummyControl control( *impl );
+ IntrusivePtr< Toolkit::Impl::DummyControl > impl = new Toolkit::Impl::DummyControl;
+ Toolkit::DummyControl control( *impl );
impl->Initialize();
return control;
}
-DummyControlImplOverride::DummyControlImplOverride()
+Impl::DummyControl::DummyControl()
: DummyControlImpl(),
initializeCalled(false),
activatedCalled(false),
{
}
-DummyControlImplOverride::~DummyControlImplOverride() { }
+Impl::DummyControl::~DummyControl() { }
-void DummyControlImplOverride::OnInitialize() { initializeCalled = true; }
-bool DummyControlImplOverride::OnAccessibilityActivated() { activatedCalled = true; return true; }
-bool DummyControlImplOverride::OnAccessibilityTouch(const TouchEvent& touchEvent) { onAccTouchedCalled = true; return true; }
-bool DummyControlImplOverride::OnAccessibilityValueChange( bool isIncrease )
+void Impl::DummyControl::OnInitialize() { initializeCalled = true; }
+bool Impl::DummyControl::OnAccessibilityActivated() { activatedCalled = true; return true; }
+bool Impl::DummyControl::OnAccessibilityTouch(const TouchEvent& touchEvent) { onAccTouchedCalled = true; return true; }
+bool Impl::DummyControl::OnAccessibilityValueChange( bool isIncrease )
{
onAccValueChangeCalled = true; return true;
}
-void DummyControlImplOverride::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
+void Impl::DummyControl::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
{
themeChangeCalled = change == StyleChange::THEME_CHANGE;
fontChangeCalled = change == StyleChange::DEFAULT_FONT_SIZE_CHANGE;
}
-void DummyControlImplOverride::OnPinch(const PinchGesture& pinch) { pinchCalled = true; }
-void DummyControlImplOverride::OnPan(const PanGesture& pan) { panCalled = true; }
-void DummyControlImplOverride::OnTap(const TapGesture& tap) { tapCalled = true; }
-void DummyControlImplOverride::OnLongPress(const LongPressGesture& longPress) { longPressCalled = true; }
-void DummyControlImplOverride::OnStageConnection( int depth ) { stageConnectionCalled = true; Control::OnStageConnection( depth ); }
-void DummyControlImplOverride::OnStageDisconnection() { stageDisconnectionCalled = true; Control::OnStageDisconnection(); }
-void DummyControlImplOverride::OnChildAdd(Actor& child) { childAddCalled = true; Control::OnChildAdd( child ); }
-void DummyControlImplOverride::OnChildRemove(Actor& child) { childRemoveCalled = true; Control::OnChildRemove( child ); }
-void DummyControlImplOverride::OnSizeSet(const Vector3& targetSize) { sizeSetCalled = true; Control::OnSizeSet( targetSize ); }
-void DummyControlImplOverride::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { sizeAnimationCalled = true; Control::OnSizeAnimation( animation, targetSize ); }
-bool DummyControlImplOverride::OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; }
-bool DummyControlImplOverride::OnHoverEvent(const HoverEvent& event) { hoverEventCalled = true; return false; }
-bool DummyControlImplOverride::OnWheelEvent(const WheelEvent& event) { wheelEventCalled = true; return false; }
-bool DummyControlImplOverride::OnKeyEvent(const KeyEvent& event) { keyEventCalled = true; return false;}
-void DummyControlImplOverride::OnKeyInputFocusGained() { keyInputFocusGained = true; }
-void DummyControlImplOverride::OnKeyInputFocusLost() { keyInputFocusLost = true; }
-
-void DummyControlImplOverride::OnRelayout( const Vector2& size, RelayoutContainer& container )
+void Impl::DummyControl::OnPinch(const PinchGesture& pinch) { pinchCalled = true; }
+void Impl::DummyControl::OnPan(const PanGesture& pan) { panCalled = true; }
+void Impl::DummyControl::OnTap(const TapGesture& tap) { tapCalled = true; }
+void Impl::DummyControl::OnLongPress(const LongPressGesture& longPress) { longPressCalled = true; }
+void Impl::DummyControl::OnStageConnection( int depth ) { Control::OnStageConnection( depth ); stageConnectionCalled = true; }
+void Impl::DummyControl::OnStageDisconnection() { stageDisconnectionCalled = true; Control::OnStageDisconnection(); }
+void Impl::DummyControl::OnChildAdd(Actor& child) { childAddCalled = true; }
+void Impl::DummyControl::OnChildRemove(Actor& child) { childRemoveCalled = true; }
+void Impl::DummyControl::OnSizeSet(const Vector3& targetSize) { Control::OnSizeSet( targetSize ); sizeSetCalled = true; }
+void Impl::DummyControl::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { Control::OnSizeAnimation( animation, targetSize ); sizeAnimationCalled = true; }
+bool Impl::DummyControl::OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; }
+bool Impl::DummyControl::OnHoverEvent(const HoverEvent& event) { hoverEventCalled = true; return false; }
+bool Impl::DummyControl::OnWheelEvent(const WheelEvent& event) { wheelEventCalled = true; return false; }
+bool Impl::DummyControl::OnKeyEvent(const KeyEvent& event) { keyEventCalled = true; return false;}
+void Impl::DummyControl::OnKeyInputFocusGained() { keyInputFocusGained = true; }
+void Impl::DummyControl::OnKeyInputFocusLost() { keyInputFocusLost = true; }
+
+void Impl::DummyControl::SetLayout( Property::Index visualIndex, Property::Map& map )
{
- Property::Map transformMap;
- transformMap
- .Add( Toolkit::DevelVisual::Transform::Property::OFFSET, Vector2(0.0f, 0.0f) )
- .Add( Toolkit::DevelVisual::Transform::Property::SIZE, Vector2(1.0f, 1.0f) )
- .Add( Toolkit::DevelVisual::Transform::Property::ORIGIN, Toolkit::Align::CENTER )
- .Add( Toolkit::DevelVisual::Transform::Property::ANCHOR_POINT, Toolkit::Align::CENTER )
- .Add( Toolkit::DevelVisual::Transform::Property::OFFSET_SIZE_MODE, Vector4::ZERO );
+ Property::Value value( map );
+ mLayouts[visualIndex] = value;
+}
+
+void Impl::DummyControl::OnRelayout( const Vector2& size, RelayoutContainer& container )
+{
+ Property::Map emptyMap;
for( VisualIndices::iterator iter = mRegisteredVisualIndices.begin(); iter != mRegisteredVisualIndices.end() ; ++iter )
{
Visual::Base visual = GetVisual(*iter);
- visual.SetTransformAndSize( transformMap, size );
+ Property::Value value = mLayouts[*iter];
+ Property::Map* map = NULL;
+
+ if( value.GetType() != Property::NONE )
+ {
+ map = value.GetMap();
+ }
+ if( map == NULL )
+ {
+ map = &emptyMap;
+ }
+
+ visual.SetTransformAndSize( *map, size );
}
}
-
DummyControl DummyControl::New( bool override )
{
DummyControl control;
if (override)
{
- control = DummyControlImplOverride::New();
+ control = Impl::DummyControl::New();
}
else
{
{
enum Type
{
- TEST_VISUAL = PROPERTY_START_INDEX
+ TEST_VISUAL = PROPERTY_START_INDEX,
+ TEST_VISUAL2
};
};
* Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
* This class does not override any of Internal::Control's behaviour.
*/
-class DummyControlImpl : public Internal::Control
+class DummyControlImpl : public Toolkit::Internal::Control
{
public:
virtual ~DummyControlImpl();
};
+namespace Impl
+{
+
/**
* Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
* This class DOES override Internal::Control's behaviour.
*/
-class DummyControlImplOverride : public DummyControlImpl
+class DummyControl : public Toolkit::DummyControlImpl
{
public:
- static DummyControl New();
+ static Toolkit::DummyControl New();
+
+ void SetLayout( Property::Index visualIndex, Property::Map& map );
private:
- DummyControlImplOverride();
+ DummyControl();
- virtual ~DummyControlImplOverride();
+ virtual ~DummyControl();
private: // From Internal::Control
virtual void OnKeyInputFocusLost();
virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
+ DALI_INTERNAL DummyControl( const DummyControl& );
+ DALI_INTERNAL DummyControl& operator=( const DummyControl& );
+
public:
bool initializeCalled;
bool keyEventCalled;
bool keyInputFocusGained;
bool keyInputFocusLost;
+
+ Property::Map mLayouts;
};
+} // namespace Impl
+
} // namespace Toolkit
} // namespace Dali
Dali::AccessibilityAdaptor accessibilityAdaptor = Dali::AccessibilityAdaptor::Get();
DummyControl dummyControl = DummyControl::New(true);
- DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummyControl.GetImplementation());
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
dummyControl.SetSize(480, 800);
manager.SetFocusOrder( dummyControl, 1 );
Stage::GetCurrent().Add( dummyControl );
application.SendNotification();
application.Render();
- DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
DALI_TEST_CHECK( dummyImpl.pinchCalled == false );
{
DummyControl dummy = DummyControl::New( true );
Stage::GetCurrent().Add(dummy);
- DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
application.Render();
application.SendNotification();
{
DummyControl dummy = DummyControl::New( true );
- DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
DALI_TEST_EQUALS( dummyImpl.stageConnectionCalled, false, TEST_LOCATION );
Stage::GetCurrent().Add(dummy);
{
DummyControl dummy = DummyControl::New( true );
- DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
Stage::GetCurrent().Add(dummy);
application.Render();
{
DummyControl dummy = DummyControl::New( true );
- DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
Stage::GetCurrent().Add(dummy);
{
DummyControl dummy = DummyControl::New( true );
- DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
dummy.SetSize( Vector2( 100.0f, 100.0f ) );
dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
{
DummyControl dummy = DummyControl::New( true );
- DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
dummy.SetSize( Vector2( 100.0f, 100.0f ) );
dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
{
DummyControl dummy = DummyControl::New( true );
- DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
Stage::GetCurrent().Add(dummy);
dummy.SetKeyInputFocus();
{
DummyControl dummy = DummyControl::New( true );
- DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
Stage::GetCurrent().Add(dummy);
{
DummyControl dummy = DummyControl::New( true );
- DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
Stage::GetCurrent().Add(dummy);
dummy.SetKeyInputFocus();
dummy.ClearKeyInputFocus();
- DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
dummyImpl.IsKeyboardNavigationSupported();
dummyImpl.IsKeyboardFocusGroup();
{
DummyControl dummy = DummyControl::New( true );
- DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
dummy.SetSize( Vector2( 100.0f, 100.0f ) );
dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
END_TEST;
}
-
int UtcDaliControlImplAutoClippingWithVisuals(void)
{
ToolkitTestApplication application;
END_TEST;
}
+int UtcDaliImageViewAsyncLoadingWithAtlasing02(void)
+{
+ ToolkitTestApplication application;
+
+ //Async loading, automatic atlasing for small size image
+ TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
+ callStack.Reset();
+ callStack.Enable(true);
+
+ Property::Map asyncLoadingMap;
+ asyncLoadingMap[ "url" ] = gImage_34_RGBA;
+ asyncLoadingMap[ "desiredHeight" ] = 34;
+ asyncLoadingMap[ "desiredWidth" ] = 34;
+ asyncLoadingMap[ "synchronousLoading" ] = false;
+
+ ImageView imageView = ImageView::New();
+ imageView.SetProperty( ImageView::Property::IMAGE, asyncLoadingMap );
+
+ Stage::GetCurrent().Add( imageView );
+ application.SendNotification();
+ application.Render(16);
+ application.Render(16);
+ application.SendNotification();
+
+ // loading started, this waits for the loader thread for max 30 seconds
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render(16);
+
+ callStack.Enable(false);
+
+ TraceCallStack::NamedParams params;
+ params["width"] = ToString(34);
+ params["height"] = ToString(34);
+ DALI_TEST_EQUALS( callStack.FindMethodAndParams( "TexSubImage2D", params ), true, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliImageViewSyncLoading(void)
{
ToolkitTestApplication application;
+ tet_infoline("ImageView Testing sync loading and size using index key property map");
+
Property::Map syncLoadingMap;
- syncLoadingMap[ "synchronousLoading" ] = true;
+ syncLoadingMap[ ImageVisual::Property::SYNCHRONOUS_LOADING ] = true;
// Sync loading, no atlasing for big size image
{
END_TEST;
}
+
+int UtcDaliImageViewSyncLoading02(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("ImageView Testing sync loading and size using string key property map");
+
+ // Sync loading, automatic atlasing for small size image
+ {
+ BitmapLoader::ResetLatestCreated();
+ TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
+ callStack.Reset();
+ callStack.Enable(true);
+
+ ImageView imageView = ImageView::New( );
+
+ // Sync loading is used
+ Property::Map syncLoadingMap;
+ syncLoadingMap[ "url" ] = gImage_34_RGBA;
+ syncLoadingMap[ "desiredHeight" ] = 34;
+ syncLoadingMap[ "desiredWidth" ] = 34;
+ syncLoadingMap[ "synchronousLoading" ] = true;
+ imageView.SetProperty( ImageView::Property::IMAGE, syncLoadingMap );
+
+ // loading is started even if the actor is offStage
+ BitmapLoader loader = BitmapLoader::GetLatestCreated();
+ DALI_TEST_CHECK( loader );
+
+ loader.WaitForLoading();
+
+ DALI_TEST_CHECK( loader.IsLoaded() );
+
+ Stage::GetCurrent().Add( imageView );
+ application.SendNotification();
+ application.Render(16);
+
+ TraceCallStack::NamedParams params;
+ params["width"] = ToString(34);
+ params["height"] = ToString(34);
+ DALI_TEST_EQUALS( callStack.FindMethodAndParams( "TexSubImage2D", params ),
+ true, TEST_LOCATION );
+ }
+ END_TEST;
+}
+
int UtcDaliImageViewSizeWithBackground(void)
{
ToolkitTestApplication application;
DALI_TEST_CHECK( ! focusedControl );
DummyControl dummy = DummyControl::New(true);
- DummyControlImplOverride& dummyImpl = static_cast<DummyControlImplOverride&>(dummy.GetImplementation());
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
dummy.SetSize(100.0f, 100.0f);
stage.Add( dummy );
DALI_TEST_CHECK( ! dummyImpl.keyInputFocusGained );
DALI_TEST_CHECK(manager);
DummyControl dummy1 = DummyControl::New(true);
- DummyControlImplOverride& dummy1Impl = static_cast<DummyControlImplOverride&>(dummy1.GetImplementation());
+ Impl::DummyControl& dummy1Impl = static_cast<Impl::DummyControl&>(dummy1.GetImplementation());
dummy1.SetSize(100.0f, 100.0f);
stage.Add( dummy1 );
DALI_TEST_CHECK( ! dummy1Impl.keyInputFocusGained );
dummy1Impl.keyInputFocusGained = false;
DummyControl dummy2 = DummyControl::New(true);
- DummyControlImplOverride& dummy2Impl = static_cast<DummyControlImplOverride&>(dummy2.GetImplementation());
+ Impl::DummyControl& dummy2Impl = static_cast<Impl::DummyControl&>(dummy2.GetImplementation());
dummy2.SetSize(100.0f, 100.0f);
stage.Add( dummy2 );
DALI_TEST_CHECK( ! dummy2Impl.keyInputFocusGained );
DALI_TEST_CHECK(manager);
DummyControl dummy1 = DummyControl::New(true);
- DummyControlImplOverride& dummy1Impl = static_cast<DummyControlImplOverride&>(dummy1.GetImplementation());
+ Impl::DummyControl& dummy1Impl = static_cast<Impl::DummyControl&>(dummy1.GetImplementation());
dummy1.SetSize(100.0f, 100.0f);
stage.Add( dummy1 );
DALI_TEST_CHECK( ! dummy1Impl.keyInputFocusGained );
DALI_TEST_CHECK( ! dummy1Impl.keyInputFocusLost );
DummyControl dummy2 = DummyControl::New(true);
- DummyControlImplOverride& dummy2Impl = static_cast<DummyControlImplOverride&>(dummy2.GetImplementation());
+ Impl::DummyControl& dummy2Impl = static_cast<Impl::DummyControl&>(dummy2.GetImplementation());
dummy2.SetSize(100.0f, 100.0f);
stage.Add( dummy2 );
DALI_TEST_CHECK( ! dummy2Impl.keyInputFocusGained );
DALI_TEST_CHECK(manager);
DummyControl dummy1 = DummyControl::New(true);
- DummyControlImplOverride& dummy1Impl = static_cast<DummyControlImplOverride&>(dummy1.GetImplementation());
+ Impl::DummyControl& dummy1Impl = static_cast<Impl::DummyControl&>(dummy1.GetImplementation());
dummy1.SetSize(100.0f, 100.0f);
stage.Add( dummy1 );
DALI_TEST_CHECK( ! dummy1Impl.keyInputFocusGained );
DALI_TEST_CHECK( ! dummy1Impl.keyInputFocusLost );
DummyControl dummy2 = DummyControl::New(true);
- DummyControlImplOverride& dummy2Impl = static_cast<DummyControlImplOverride&>(dummy2.GetImplementation());
+ Impl::DummyControl& dummy2Impl = static_cast<Impl::DummyControl&>(dummy2.GetImplementation());
dummy2.SetSize(100.0f, 100.0f);
stage.Add( dummy2 );
DALI_TEST_CHECK( ! dummy2Impl.keyInputFocusGained );
DALI_TEST_CHECK(manager);
DummyControl dummy1 = DummyControl::New(true);
- DummyControlImplOverride& dummy1Impl = static_cast<DummyControlImplOverride&>(dummy1.GetImplementation());
+ Impl::DummyControl& dummy1Impl = static_cast<Impl::DummyControl&>(dummy1.GetImplementation());
dummy1.SetSize(100.0f, 100.0f);
stage.Add( dummy1 );
DALI_TEST_CHECK( ! dummy1Impl.keyInputFocusGained );
DALI_TEST_CHECK( ! dummy1Impl.keyInputFocusLost );
DummyControl dummy2 = DummyControl::New(true);
- DummyControlImplOverride& dummy2Impl = static_cast<DummyControlImplOverride&>(dummy2.GetImplementation());
+ Impl::DummyControl& dummy2Impl = static_cast<Impl::DummyControl&>(dummy2.GetImplementation());
dummy2.SetSize(100.0f, 100.0f);
stage.Add( dummy2 );
DALI_TEST_CHECK( ! dummy2Impl.keyInputFocusGained );
DALI_TEST_CHECK( ! dummy2Impl.keyInputFocusLost );
DummyControl dummy3 = DummyControl::New(true);
- DummyControlImplOverride& dummy3Impl = static_cast<DummyControlImplOverride&>(dummy3.GetImplementation());
+ Impl::DummyControl& dummy3Impl = static_cast<Impl::DummyControl&>(dummy3.GetImplementation());
dummy3.SetSize(100.0f, 100.0f);
stage.Add( dummy3 );
DALI_TEST_CHECK( ! dummy3Impl.keyInputFocusGained );
DALI_TEST_CHECK(manager);
DummyControl dummy1 = DummyControl::New(true);
- DummyControlImplOverride& dummy1Impl = static_cast<DummyControlImplOverride&>(dummy1.GetImplementation());
+ Impl::DummyControl& dummy1Impl = static_cast<Impl::DummyControl&>(dummy1.GetImplementation());
dummy1.SetSize(100.0f, 100.0f);
stage.Add( dummy1 );
DALI_TEST_CHECK( ! dummy1Impl.keyInputFocusGained );
DALI_TEST_CHECK( ! dummy1Impl.keyInputFocusLost );
DummyControl dummy2 = DummyControl::New(true);
- DummyControlImplOverride& dummy2Impl = static_cast<DummyControlImplOverride&>(dummy2.GetImplementation());
+ Impl::DummyControl& dummy2Impl = static_cast<Impl::DummyControl&>(dummy2.GetImplementation());
dummy2.SetSize(100.0f, 100.0f);
stage.Add( dummy2 );
DALI_TEST_CHECK( ! dummy2Impl.keyInputFocusGained );
DALI_TEST_CHECK(manager);
DummyControl dummy1 = DummyControl::New(true);
- DummyControlImplOverride& dummy1Impl = static_cast<DummyControlImplOverride&>(dummy1.GetImplementation());
+ Impl::DummyControl& dummy1Impl = static_cast<Impl::DummyControl&>(dummy1.GetImplementation());
dummy1.SetSize(100.0f, 100.0f);
stage.Add( dummy1 );
DALI_TEST_CHECK( ! dummy1Impl.keyInputFocusGained );
{
DummyControl dummy2 = DummyControl::New(true);
- DummyControlImplOverride& dummy2Impl = static_cast<DummyControlImplOverride&>(dummy2.GetImplementation());
+ Impl::DummyControl& dummy2Impl = static_cast<Impl::DummyControl&>(dummy2.GetImplementation());
dummy2.SetSize(100.0f, 100.0f);
stage.Add( dummy2 );
DALI_TEST_CHECK( ! dummy2Impl.keyInputFocusGained );
DALI_TEST_CHECK(manager);
DummyControl dummy1 = DummyControl::New(true);
- DummyControlImplOverride& dummy1Impl = static_cast<DummyControlImplOverride&>(dummy1.GetImplementation());
+ Impl::DummyControl& dummy1Impl = static_cast<Impl::DummyControl&>(dummy1.GetImplementation());
dummy1.SetSize(100.0f, 100.0f);
stage.Add( dummy1 );
DALI_TEST_CHECK( ! dummy1Impl.keyInputFocusGained );
DummyControl dummy2 = DummyControl::New(true);
- DummyControlImplOverride& dummy2Impl = static_cast<DummyControlImplOverride&>(dummy2.GetImplementation());
+ Impl::DummyControl& dummy2Impl = static_cast<Impl::DummyControl&>(dummy2.GetImplementation());
dummy2.SetSize(100.0f, 100.0f);
stage.Add( dummy2 );
DALI_TEST_CHECK( ! dummy2Impl.keyInputFocusGained );
anim.Play();
application.SendNotification();
- application.Render(0);
application.Render(500); // Start animation
application.Render(500); // Halfway thru anim
application.SendNotification();
#include <dali/public-api/rendering/shader.h>
#include <dali/devel-api/object/handle-devel.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/devel-api/visual-factory/transition-data.h>
#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/devel-api/align-enums.h>
test_return_value = TET_PASS;
}
+
+static void TestMixColor( Visual::Base visual, Property::Index mixColorIndex, const Vector4& testColor )
+{
+ Property::Map map;
+ visual.CreatePropertyMap(map);
+ Property::Value* value = map.Find( mixColorIndex );
+ DALI_TEST_CHECK( value );
+ Vector4 mixColor;
+ DALI_TEST_CHECK( value->Get( mixColor ) );
+ DALI_TEST_EQUALS( mixColor, testColor, 0.001, TEST_LOCATION );
+}
+
+
int UtcDaliVisualCopyAndAssignment(void)
{
ToolkitTestApplication application;
visual.SetDepthIndex( 1.f );
- DummyControl dummyControl = DummyControl::New();
- DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummyControl.GetImplementation());
- dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+ DummyControl dummyControl = DummyControl::New(true);
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
dummyControl.SetSize(200.f, 200.f);
Stage::GetCurrent().Add( dummyControl );
propertyMap.Insert(Visual::Property::TYPE, Visual::GRADIENT);
Vector2 start(-1.f, -1.f);
Vector2 end(1.f, 1.f);
- propertyMap.Insert(GradientVisual::Property::START_POSITION, start);
- propertyMap.Insert(GradientVisual::Property::END_POSITION, end);
- propertyMap.Insert(GradientVisual::Property::STOP_OFFSET, Vector2(0.f, 1.f));
+ propertyMap.Insert( "mixColor", Color::MAGENTA );
+ propertyMap.Insert( GradientVisual::Property::START_POSITION, start) ;
+ propertyMap.Insert( GradientVisual::Property::END_POSITION, end );
+ propertyMap.Insert( GradientVisual::Property::STOP_OFFSET, Vector2(0.f, 1.f) );
+ propertyMap.Insert( GradientVisual::Property::SPREAD_METHOD, GradientVisual::SpreadMethod::REPEAT) ;
Property::Array stopColors;
stopColors.PushBack( Color::RED );
stopColors.PushBack( Color::GREEN );
propertyMap.Clear();
propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
- propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
+ propertyMap.Insert( "batchingEnabled", true );
Visual::Base batchImageVisual = factory.CreateVisual( propertyMap );
batchImageVisual.SetTransformAndSize(DefaultTransform(), controlSize );
batchImageVisual.GetNaturalSize( naturalSize );
propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
Visual::Base visual = factory.CreateVisual( propertyMap );
- DummyControl actor = DummyControl::New();
- DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
- dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+ DummyControl actor = DummyControl::New(true);
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
actor.SetSize(200.f, 200.f);
END_TEST;
}
-
int UtcDaliVisualGetPropertyMap1(void)
{
ToolkitTestApplication application;
- tet_infoline( "UtcDaliVisualGetPropertyMap1: ColorVisual" );
+ tet_infoline( "UtcDaliVisualGetPropertyMap1: ColorVisual (With base MixColor" );
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
- propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
+ propertyMap.Insert(DevelVisual::Property::MIX_COLOR, Color::BLUE);
Visual::Base colorVisual = factory.CreateVisual( propertyMap );
Property::Map resultMap;
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
propertyMap.Insert(Visual::Property::TYPE, Visual::BORDER);
- propertyMap.Insert(BorderVisual::Property::COLOR, Color::BLUE);
- propertyMap.Insert(BorderVisual::Property::SIZE, 5.f);
+ propertyMap.Insert("mixColor", Vector4(1.0f, 0.0f, 1.0f, 0.5f) );
+ propertyMap.Insert("borderColor", Color::BLUE);
+ propertyMap.Insert("borderSize", 5.f);
+ propertyMap.Insert("antiAliasing", true);
Visual::Base borderVisual = factory.CreateVisual( propertyMap );
Property::Map resultMap;
DALI_TEST_CHECK( sizeValue );
DALI_TEST_CHECK( sizeValue->Get<float>() == 5.f );
+ Property::Value* AAValue = resultMap.Find( BorderVisual::Property::ANTI_ALIASING, Property::BOOLEAN );
+ DALI_TEST_CHECK( AAValue );
+ DALI_TEST_CHECK( AAValue->Get<bool>() == true );
+
Property::Map propertyMap1;
propertyMap1[ Visual::Property::TYPE ] = Visual::BORDER;
propertyMap1[ BorderVisual::Property::COLOR ] = Color::CYAN;
END_TEST;
}
+int UtcDaliVisualGetPropertyMap2N(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliVisualGetPropertyMap2N: BorderVisual with no setup properties" );
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap.Insert(Visual::Property::TYPE, Visual::BORDER);
+ Visual::Base borderVisual = factory.CreateVisual( propertyMap );
+
+ tet_infoline( "Test that the visual is created, with a default renderer" );
+ DALI_TEST_CHECK( borderVisual );
+
+ DummyControl dummyControl = DummyControl::New(true);
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, borderVisual );
+ Stage::GetCurrent().Add( dummyControl );
+
+ DALI_TEST_EQUALS( dummyControl.GetRendererCount(), 1, TEST_LOCATION );
+
+ END_TEST;
+}
+
+
int UtcDaliVisualGetPropertyMap3(void)
{
ToolkitTestApplication application;
Vector2 start(-1.f, -1.f);
Vector2 end(1.f, 1.f);
- propertyMap.Insert(GradientVisual::Property::START_POSITION, start);
- propertyMap.Insert(GradientVisual::Property::END_POSITION, end);
- propertyMap.Insert(GradientVisual::Property::SPREAD_METHOD, GradientVisual::SpreadMethod::REPEAT);
+ propertyMap.Insert( "startPosition", start);
+ propertyMap.Insert( "endPosition", end);
+ propertyMap.Insert( "spreadMethod", GradientVisual::SpreadMethod::REPEAT);
propertyMap.Insert(GradientVisual::Property::STOP_OFFSET, Vector2(0.2f, 0.8f));
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( DevelVisual::Property::MIX_COLOR, Color::MAGENTA );
propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, 20 );
propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, 30 );
- propertyMap.Insert( ImageVisual::Property::FITTING_MODE, FittingMode::FIT_HEIGHT );
- propertyMap.Insert( ImageVisual::Property::SAMPLING_MODE, SamplingMode::BOX_THEN_NEAREST );
- propertyMap.Insert( ImageVisual::Property::PIXEL_AREA, Vector4( 0.25f, 0.25f, 0.5f, 0.5f ) );
- propertyMap.Insert( ImageVisual::Property::WRAP_MODE_U, WrapMode::REPEAT );
- propertyMap.Insert( ImageVisual::Property::WRAP_MODE_V, WrapMode::MIRRORED_REPEAT );
+ propertyMap.Insert( "fittingMode", FittingMode::FIT_HEIGHT );
+ propertyMap.Insert( "samplingMode", SamplingMode::BOX_THEN_NEAREST );
+ propertyMap.Insert( "pixelArea", Vector4( 0.25f, 0.25f, 0.5f, 0.5f ) );
+ propertyMap.Insert( "wrapModeU", WrapMode::REPEAT );
+ propertyMap.Insert( "wrapModeV", WrapMode::MIRRORED_REPEAT );
propertyMap.Insert( "synchronousLoading", true );
Visual::Base imageVisual = factory.CreateVisual(propertyMap);
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == TEST_IMAGE_FILE_NAME );
+ value = resultMap.Find( DevelVisual::Property::MIX_COLOR, Property::VECTOR4 );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_CHECK( value->Get<Vector4>() == Color::MAGENTA );
+
value = resultMap.Find( ImageVisual::Property::FITTING_MODE, Property::INTEGER );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == FittingMode::FIT_HEIGHT );
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( "mixColor", Color::MAGENTA );
propertyMap.Insert( ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME );
propertyMap.Insert( ImageVisual::Property::BORDER_ONLY, true );
Visual::Base nPatchVisual = factory.CreateVisual( propertyMap );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == Visual::IMAGE );
+ value = resultMap.Find( DevelVisual::Property::MIX_COLOR, Property::VECTOR4 );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_CHECK( value->Get<Vector4>() == Color::MAGENTA );
+
value = resultMap.Find( ImageVisual::Property::URL, Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == TEST_NPATCH_FILE_NAME );
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( DevelVisual::Property::MIX_COLOR, Color::WHITE );
propertyMap.Insert( ImageVisual::Property::URL, TEST_SVG_FILE_NAME );
Visual::Base svgVisual = factory.CreateVisual( propertyMap );
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
+ propertyMap.Insert( DevelVisual::Property::MIX_COLOR, Color::BLUE );
propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_LOCATION );
Property::Map resultMap;
meshVisual.CreatePropertyMap( resultMap );
+ TestMixColor( meshVisual, DevelVisual::Property::MIX_COLOR, Color::BLUE );
//Check values in the result map are identical to the initial map's values.
Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, DevelVisual::TEXT );
+ propertyMap.Insert( DevelVisual::Property::MIX_COLOR, Color::BLACK );
propertyMap.Insert( "renderingBackend", static_cast<int>( Toolkit::Text::DEFAULT_RENDERING_BACKEND ) );
propertyMap.Insert( "enableMarkup", false );
propertyMap.Insert( "text", "Hello world" );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<int>(), (int)DevelVisual::TEXT, TEST_LOCATION );
+ value = resultMap.Find( DevelVisual::Property::MIX_COLOR, Property::VECTOR4 );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_EQUALS( value->Get<Vector4>(), Color::BLACK, 0.001f, TEST_LOCATION );
+
value = resultMap.Find( TextVisual::Property::TEXT, Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<std::string>(), "Hello world", TEST_LOCATION );
DALI_TEST_CHECK( batchImageVisual );
- DummyControl dummyControl = DummyControl::New();
- DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummyControl.GetImplementation());
- dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, batchImageVisual );
+ DummyControl dummyControl = DummyControl::New(true);
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, batchImageVisual );
Stage::GetCurrent().Add( dummyControl );
DALI_TEST_CHECK( dummyControl.GetRendererCount() == 1u );
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
propertyMap.Insert(Visual::Property::TYPE, Visual::BORDER);
+ propertyMap.Insert(DevelVisual::Property::MIX_COLOR, Vector4(1, 1, 1, 0.8f));
propertyMap.Insert(BorderVisual::Property::COLOR, Color::BLUE);
propertyMap.Insert(BorderVisual::Property::SIZE, 5.f);
Visual::Base borderVisual = factory.CreateVisual( propertyMap );
- DummyControl actor = DummyControl::New();
- DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
- dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, borderVisual );
+ Property::Map map;
+ map["target"] = "testVisual";
+ map["property"] = "mixColor";
+ map["targetValue"] = Vector4(1,1,1,0);
+ map["animator"] = Property::Map()
+ .Add("alphaFunction", "LINEAR")
+ .Add("timePeriod", Property::Map()
+ .Add("delay", 0.0f)
+ .Add("duration", 4.0f));
+
+ Dali::Toolkit::TransitionData transition = TransitionData::New( map );
+
+ DummyControl actor = DummyControl::New(true);
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, borderVisual );
actor.SetSize(2000, 2000);
actor.SetParentOrigin(ParentOrigin::CENTER);
Stage::GetCurrent().Add(actor);
DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
Renderer renderer = actor.GetRendererAt(0);
- Property::Index index = DevelHandle::GetPropertyIndex( renderer, BorderVisual::Property::COLOR );
+ Property::Index borderColorIndex = DevelHandle::GetPropertyIndex( renderer, BorderVisual::Property::COLOR );
+ Property::Index mixColorIndex = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::MIX_COLOR );
- Animation animation = Animation::New(4.0f);
- animation.AnimateTo( Property(renderer, index), Color::WHITE );
+ Animation animation = dummyImpl.CreateTransition( transition );
+
+ // Animate the mix color through the transition, and the border color through
+ // programmatic method.
+ animation.AnimateTo( Property(renderer, borderColorIndex), Color::WHITE );
animation.Play();
application.SendNotification();
application.Render(0);
application.Render(2000u); // halfway point between blue and white
- Vector4 color = renderer.GetProperty<Vector4>( index );
+ Vector4 color = renderer.GetProperty<Vector4>( borderColorIndex );
Vector4 testColor = (Color::BLUE + Color::WHITE)*0.5f;
DALI_TEST_EQUALS( color, testColor, TEST_LOCATION );
DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("borderColor", testColor ), true, TEST_LOCATION );
+ color = renderer.GetProperty<Vector4>( mixColorIndex );
+ testColor = Vector4( 1,1,1,0.4f );
+ DALI_TEST_EQUALS( color, testColor, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("mixColor", testColor ), true, TEST_LOCATION );
+
application.Render(2000u); // halfway point between blue and white
- color = renderer.GetProperty<Vector4>( index );
+ color = renderer.GetProperty<Vector4>( borderColorIndex );
DALI_TEST_EQUALS( color, Color::WHITE, TEST_LOCATION );
DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("borderColor", Color::WHITE ), true, TEST_LOCATION );
+ color = renderer.GetProperty<Vector4>( mixColorIndex );
+ testColor = Vector4(1,1,1,0);
+ DALI_TEST_EQUALS( color, testColor, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("mixColor", testColor ), true, TEST_LOCATION );
+
END_TEST;
}
propertyMap.Insert(BorderVisual::Property::SIZE, 5.f);
Visual::Base borderVisual = factory.CreateVisual( propertyMap );
- DummyControl actor = DummyControl::New();
- DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
- dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, borderVisual );
+ DummyControl actor = DummyControl::New(true);
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, borderVisual );
actor.SetSize(2000, 2000);
actor.SetParentOrigin(ParentOrigin::CENTER);
Stage::GetCurrent().Add(actor);
propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
Visual::Base borderVisual = factory.CreateVisual( propertyMap );
- DummyControl actor = DummyControl::New();
- DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
- dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, borderVisual );
+ DummyControl actor = DummyControl::New(true);
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, borderVisual );
actor.SetSize(2000, 2000);
actor.SetParentOrigin(ParentOrigin::CENTER);
Stage::GetCurrent().Add(actor);
Renderer renderer = actor.GetRendererAt(0);
Property::Index index = DevelHandle::GetPropertyIndex( renderer, ColorVisual::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, index), Color::WHITE );
animation.Play();
DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("mixColor", Color::WHITE ), true, TEST_LOCATION );
+ blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
+ DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION );
END_TEST;
}
-
int UtcDaliVisualAnimatePrimitiveVisual(void)
{
ToolkitTestApplication application;
tet_infoline( "UtcDaliAnimatePrimitiveVisual color" );
+ {
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap.Insert(Visual::Property::TYPE, Visual::PRIMITIVE);
+ propertyMap.Insert(PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::CUBE);
+ propertyMap.Insert(PrimitiveVisual::Property::MIX_COLOR, Color::BLUE);
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+
+ DummyControl actor = DummyControl::New(true);
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+ actor.SetSize(2000, 2000);
+ actor.SetParentOrigin(ParentOrigin::CENTER);
+ actor.SetColor(Color::BLACK);
+ Stage::GetCurrent().Add(actor);
+
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+ Renderer renderer = actor.GetRendererAt(0);
+ Property::Index index = DevelHandle::GetPropertyIndex( renderer, PrimitiveVisual::Property::MIX_COLOR );
+
+ tet_infoline("Test that the renderer has the Primitive mix color");
+ DALI_TEST_CHECK( index != Property::INVALID_INDEX );
+
+ const Vector4 INITIAL_MIX_COLOR( 1.0f,0.0f,1.0f,0.5f ); // Magenta with half alpha
+ const Vector4 TARGET_MIX_COLOR( Color::RED );
+
+ Property::Map map;
+ map["target"] = "testVisual";
+ map["property"] = "mixColor";
+ map["initialValue"] = INITIAL_MIX_COLOR;
+ map["targetValue"] = TARGET_MIX_COLOR;
+ map["animator"] = Property::Map()
+ .Add("alphaFunction", "LINEAR")
+ .Add("timePeriod", Property::Map()
+ .Add("delay", 0.0f)
+ .Add("duration", 4.0f));
+
+ Dali::Toolkit::TransitionData transition = TransitionData::New( map );
+
+ Animation animation = dummyImpl.CreateTransition( transition );
+ Property::Value blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
+ DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
+
+ animation.AnimateTo( Property(actor, Actor::Property::COLOR), Color::WHITE );
+ animation.Play();
+
+ application.SendNotification();
+ application.Render(0);
+ application.Render(2000u); // halfway point
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4(0.5f, 0.5f, 0.5f, 1.0f )), true, TEST_LOCATION );
+
+ Vector4 halfwayColor = (INITIAL_MIX_COLOR + TARGET_MIX_COLOR)*0.5;
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("mixColor", halfwayColor ), true, TEST_LOCATION );
+
+ application.Render(2001u); // go past end
+ application.SendNotification(); // Trigger signals
+
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Color::WHITE ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("mixColor", TARGET_MIX_COLOR ), true, TEST_LOCATION );
+
+ blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
+ DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION );
+
+ actor.Unparent();
+ }
+
+ END_TEST;
+}
+
+int UtcDaliVisualAnimateImageVisualMixColor(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliAnimateImageVisual mix color" );
+
+ application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
+
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
- propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
- propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
- Visual::Base borderVisual = factory.CreateVisual( propertyMap );
+ propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE);
+ propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+ propertyMap.Insert("mixColor", Color::BLUE);
+ propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+
+ DummyControl actor = DummyControl::New(true);
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
- DummyControl actor = DummyControl::New();
- DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
- dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, borderVisual );
actor.SetSize(2000, 2000);
actor.SetParentOrigin(ParentOrigin::CENTER);
actor.SetColor(Color::BLACK);
DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
Renderer renderer = actor.GetRendererAt(0);
- Property::Index index = DevelHandle::GetPropertyIndex( renderer, PrimitiveVisual::Property::MIX_COLOR );
+ Property::Index index = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::MIX_COLOR );
+ Property::Value blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
+ DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION );
- // The property isn't registered on the renderer, it's instead registered on the shader.
- DALI_TEST_EQUALS( index, Property::INVALID_INDEX, TEST_LOCATION );
+ tet_infoline("Test that the renderer has the mixColor property");
+ DALI_TEST_CHECK( index != Property::INVALID_INDEX );
+
+ const Vector4 TARGET_MIX_COLOR( 1.0f, 0.0f, 0.0f, 0.5f );
+
+ Property::Map map;
+ map["target"] = "testVisual";
+ map["property"] = "mixColor";
+ map["initialValue"] = Color::MAGENTA;
+ map["targetValue"] = TARGET_MIX_COLOR;
+ map["animator"] = Property::Map()
+ .Add("alphaFunction", "LINEAR")
+ .Add("timePeriod", Property::Map()
+ .Add("delay", 0.0f)
+ .Add("duration", 4.0f));
+
+ Dali::Toolkit::TransitionData transition = TransitionData::New( map );
+
+ Animation animation = dummyImpl.CreateTransition( transition );
+
+ blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
+ DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
- Animation animation = Animation::New(4.0f);
animation.AnimateTo( Property(actor, Actor::Property::COLOR), Color::WHITE );
animation.Play();
application.Render(0);
application.Render(2000u); // halfway point
- // Actor color overrides renderer color.
DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4(0.5f, 0.5f, 0.5f, 1.0f )), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("mixColor", Vector4(1.0f, 0.0f, 0.5f, 0.75f )), true, TEST_LOCATION );
application.Render(2000u); // halfway point between blue and white
DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Color::WHITE ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("mixColor", TARGET_MIX_COLOR), true, TEST_LOCATION );
+
+ TestMixColor( visual, DevelVisual::Property::MIX_COLOR, TARGET_MIX_COLOR );
+
+ blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
+ DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliVisualAnimateImageVisualPixelArea(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliAnimateImageVisual pixel area" );
+
+ application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE);
+ propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+ propertyMap.Insert("mixColor", Color::BLUE);
+ propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+
+ DummyControl actor = DummyControl::New(true);
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+
+ actor.SetSize(2000, 2000);
+ actor.SetParentOrigin(ParentOrigin::CENTER);
+ actor.SetColor(Color::BLACK);
+ Stage::GetCurrent().Add(actor);
+
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+ Renderer renderer = actor.GetRendererAt(0);
+ Property::Index index = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::MIX_COLOR );
+
+ tet_infoline("Test that the renderer has the mixColor property");
+ DALI_TEST_CHECK( index != Property::INVALID_INDEX );
+
+ // TransitionData only takes string keys
+ Property::Map map;
+ map["target"] = "testVisual";
+ map["property"] = "pixelArea";
+ map["initialValue"] = Vector4( 0,0,0,1 );
+ map["targetValue"] = Vector4( 0,0,1,1 ); // Animate width from zero to full
+ map["animator"] = Property::Map()
+ .Add("alphaFunction", "LINEAR")
+ .Add("timePeriod", Property::Map()
+ .Add("delay", 0.0f)
+ .Add("duration", 4.0f));
+
+ Dali::Toolkit::TransitionData transition = TransitionData::New( map );
+
+ Animation animation = dummyImpl.CreateTransition( transition );
+ animation.AnimateTo( Property(actor, Actor::Property::COLOR), Color::WHITE );
+ animation.Play();
+
+ application.SendNotification();
+ application.Render(0);
+ application.Render(2000u); // halfway point
+
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("pixelArea", Vector4(0.0f, 0.0f, 0.5f, 1.0f )), true, TEST_LOCATION );
+ application.Render(2000u);
+
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("pixelArea", Vector4( 0.0f, 0.0f, 1.0f, 1.0f )), true, TEST_LOCATION );
END_TEST;
}
+
int UtcDaliVisualWireframeVisual(void)
{
ToolkitTestApplication application;
}
//Put the visual on the stage
- DummyControl actor = DummyControl::New();
- DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
- dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+ DummyControl actor = DummyControl::New(true);
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
actor.SetSize(2000, 2000);
actor.SetParentOrigin(ParentOrigin::CENTER);
Stage::GetCurrent().Add(actor);
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+ dummyImpl.SetLayout( DummyControl::Property::TEST_VISUAL, transform );
+
application.SendNotification();
application.Render(0);
Renderer renderer( actor.GetRendererAt(0) );
//Check that the properties have been registered on the Renderer
- Vector2 offset = renderer.GetProperty<Vector2>( renderer.GetPropertyIndex( "offset" ) );
+ Property::Index index = renderer.GetPropertyIndex( "offset" );
+ DALI_TEST_CHECK( index != Property::INVALID_INDEX );
+ Vector2 offset = renderer.GetProperty<Vector2>( index );
DALI_TEST_EQUALS( offset, Vector2(10.0f,10.0f), TEST_LOCATION );
- Vector2 size = renderer.GetProperty<Vector2>( renderer.GetPropertyIndex( "size" ) );
+ index = renderer.GetPropertyIndex( "size" );
+ DALI_TEST_CHECK( index != Property::INVALID_INDEX );
+ Vector2 size = renderer.GetProperty<Vector2>( index );
DALI_TEST_EQUALS( size, Vector2(0.2f,0.2f), TEST_LOCATION );
- Vector4 offsetSizeMode = renderer.GetProperty<Vector4>( renderer.GetPropertyIndex( "offsetSizeMode" ) );
+ index = renderer.GetPropertyIndex( "offsetSizeMode" );
+ DALI_TEST_CHECK( index != Property::INVALID_INDEX );
+ Vector4 offsetSizeMode = renderer.GetProperty<Vector4>( index );
DALI_TEST_EQUALS( offsetSizeMode, Vector4(1.0f,1.0f,0.0f,0.0f), TEST_LOCATION );
- Vector2 parentOrigin = renderer.GetProperty<Vector2>( renderer.GetPropertyIndex( "origin" ) );
+ index = renderer.GetPropertyIndex( "origin" );
+ DALI_TEST_CHECK( index != Property::INVALID_INDEX );
+ Vector2 parentOrigin = renderer.GetProperty<Vector2>( index );
DALI_TEST_EQUALS( parentOrigin, Vector2(-0.5f,-0.5f), TEST_LOCATION );
- Vector2 anchorPoint = renderer.GetProperty<Vector2>( renderer.GetPropertyIndex( "anchorPoint" ) );
+ index = renderer.GetPropertyIndex( "anchorPoint" );
+ DALI_TEST_CHECK( index != Property::INVALID_INDEX );
+ Vector2 anchorPoint = renderer.GetProperty<Vector2>( index );
DALI_TEST_EQUALS( anchorPoint, Vector2(-0.5f,-0.5f), TEST_LOCATION );
//Set a new transform
propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
Visual::Base visual = factory.CreateVisual( propertyMap );
TestTransform( application, visual );
+ TestMixColor( visual, ColorVisual::Property::MIX_COLOR, Color::BLUE );
END_TEST;
}
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
propertyMap[ Visual::Property::TYPE ] = Visual::PRIMITIVE;
- propertyMap[ PrimitiveVisual::Property::MIX_COLOR ] = Vector4(1.0f,1.0f,1.0f,1.0f);
+ propertyMap[ PrimitiveVisual::Property::MIX_COLOR ] = Color::WHITE;
propertyMap[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::SPHERE;
propertyMap[ PrimitiveVisual::Property::SLICES ] = 10;
propertyMap[ PrimitiveVisual::Property::STACKS ] = 10;
Visual::Base visual = factory.CreateVisual( propertyMap );
TestTransform( application, visual );
+ TestMixColor( visual, PrimitiveVisual::Property::MIX_COLOR, Color::WHITE );
END_TEST;
}
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, Visual::GRADIENT );
+ propertyMap.Insert( DevelVisual::Property::MIX_COLOR, Color::GREEN );
+
Property::Array stopOffsets;
stopOffsets.PushBack( 0.0f );
stopOffsets.PushBack( 0.3f );
propertyMap.Insert( GradientVisual::Property::RADIUS, 1.414f );
Visual::Base visual = factory.CreateVisual( propertyMap );
TestTransform( application, visual );
+ TestMixColor( visual, DevelVisual::Property::MIX_COLOR, Color::GREEN );
END_TEST;
}
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, Visual::BORDER );
+ propertyMap.Insert( DevelVisual::Property::MIX_COLOR, Color::MAGENTA );
propertyMap.Insert( BorderVisual::Property::COLOR, Vector4(0.f, 1.f, 0.f, 0.6f) );
propertyMap.Insert( BorderVisual::Property::SIZE, 3.0f );
Visual::Base visual = factory.CreateVisual( propertyMap );
TestTransform( application, visual );
+ TestMixColor( visual, DevelVisual::Property::MIX_COLOR, Color::MAGENTA );
END_TEST;
}
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
- propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
- propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
- propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_LOCATION );
- propertyMap.Insert( MeshVisual::Property::SHADING_MODE, MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING );
- propertyMap.Insert( MeshVisual::Property::LIGHT_POSITION, Vector3( 5.0f, 10.0f, 15.0f) );
+ propertyMap.Insert( DevelVisual::Property::MIX_COLOR, Color::CYAN );
+
+ propertyMap.Insert( "objectUrl", TEST_OBJ_FILE_NAME );
+ propertyMap.Insert( "materialUrl", TEST_MTL_FILE_NAME );
+ propertyMap.Insert( "texturesPath", TEST_RESOURCE_LOCATION );
+ propertyMap.Insert( "shadingMode", MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING );
+ propertyMap.Insert( "lightPosition", Vector3( 5.0f, 10.0f, 15.0f) );
Visual::Base visual = factory.CreateVisual( propertyMap );
TestTransform( application, visual );
+ TestMixColor( visual, DevelVisual::Property::MIX_COLOR, Color::CYAN );
END_TEST;
}
Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME, ImageDimensions(100, 200));
Visual::Base visual = factory.CreateVisual(image);
TestTransform( application, visual );
+ TestMixColor( visual, DevelVisual::Property::MIX_COLOR, Color::WHITE );
END_TEST;
}
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
propertyMap[Toolkit::Visual::Property::TYPE] = Toolkit::Visual::IMAGE;
+ propertyMap[DevelVisual::Property::MIX_COLOR] = Color::YELLOW;
propertyMap[Toolkit::ImageVisual::Property::URL] = TEST_IMAGE_FILE_NAME;
propertyMap[Toolkit::ImageVisual::Property::DESIRED_WIDTH] = 100.0f;
propertyMap[Toolkit::ImageVisual::Property::DESIRED_HEIGHT] = 100.0f;
propertyMap[Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING] = true;
Visual::Base visual = factory.CreateVisual(propertyMap);
TestTransform( application, visual );
+ TestMixColor( visual, DevelVisual::Property::MIX_COLOR, Color::YELLOW );
END_TEST;
}
Image image = ResourceImage::New(TEST_NPATCH_FILE_NAME, ImageDimensions(100, 200));
Visual::Base visual = factory.CreateVisual(image);
TestTransform( application, visual );
+ TestMixColor( visual, DevelVisual::Property::MIX_COLOR, Color::WHITE );
END_TEST;
}
transformMap["origin"] = Align::CENTER;
properties[DevelVisual::Property::TRANSFORM] = transformMap;
- properties[Dali::Toolkit::Visual::Property::TYPE] = Dali::Toolkit::Visual::IMAGE;
- properties[Dali::Toolkit::Visual::Property::SHADER]=shader;
- properties[Dali::Toolkit::ImageVisual::Property::URL] = TEST_NPATCH_FILE_NAME;
+ properties[Visual::Property::TYPE] = Visual::IMAGE;
+ properties[DevelVisual::Property::MIX_COLOR] = Color::BLUE;
+ properties[Visual::Property::SHADER]=shader;
+ properties[ImageVisual::Property::URL] = TEST_NPATCH_FILE_NAME;
Visual::Base visual = factory.CreateVisual( properties );
+ TestMixColor( visual, DevelVisual::Property::MIX_COLOR, Color::BLUE );
// trigger creation through setting on stage
- DummyControl dummy = DummyControl::New();
- DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
- dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+ DummyControl dummy = DummyControl::New(true);
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+ dummyImpl.SetLayout( DummyControl::Property::TEST_VISUAL, transformMap );
dummy.SetSize(2000, 2000);
dummy.SetParentOrigin(ParentOrigin::CENTER);
Stage::GetCurrent().Add(dummy);
END_TEST;
}
+
int UtcDaliGradientVisualBlendMode(void)
{
ToolkitTestApplication application;
.Add( GradientVisual::Property::STOP_COLOR, Property::Array().Add( Color::RED )
.Add( Vector4( 1.0f, 1.0f, 1.0f, 0.5f ) ) ) );
- DummyControl control = DummyControl::New();
+ DummyControl control = DummyControl::New(true);
control.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
Stage::GetCurrent().Add( control );
- DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>( control.GetImplementation() );
- dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, opaqueGradientVisual );
- dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 2, alphaGradientVisual );
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>( control.GetImplementation() );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, opaqueGradientVisual );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL2, alphaGradientVisual );
application.SendNotification();
application.Render();
visual.SetDepthIndex( 1.f );
- DummyControl dummyControl = DummyControl::New();
- DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummyControl.GetImplementation());
- dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
+ DummyControl dummyControl = DummyControl::New(true);
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
DALI_TEST_EQUALS( dummyControl.GetRendererCount(), 0, TEST_LOCATION );
dummyControl.SetSize(200.f, 200.f);
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, DevelVisual::TEXT );
+ propertyMap.Insert( "mixColor", Color::WHITE );
propertyMap.Insert( "renderingBackend", static_cast<int>( Toolkit::Text::DEFAULT_RENDERING_BACKEND ) );
propertyMap.Insert( "enableMarkup", false );
propertyMap.Insert( "text", "Hello world" );
textVisual.SetDepthIndex( 1.f );
DummyControl dummyControl = DummyControl::New(true);
- DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummyControl.GetImplementation());
- dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, textVisual );
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, textVisual );
DALI_TEST_EQUALS( dummyControl.GetRendererCount(), 0, TEST_LOCATION );
dummyControl.SetSize(200.f, 200.f);
textVisual = factory.CreateVisual( propertyMap );
textVisual.SetDepthIndex( 1.f );
- dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, textVisual );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, textVisual );
dummyControl.SetSize( 720.f, 640.f );
application.SendNotification(); // force process events to ensure text visual
END_TEST;
}
+//Test if mesh loads correctly when supplied with all main parameters, an object file, a material file and a directory location, but duff optional parameters
+int UtcDaliVisualFactoryGetMeshVisual3b(void)
+{
+ //Set up test application first, so everything else can be handled.
+ ToolkitTestApplication application;
+
+ tet_infoline( "UtcDaliVisualFactoryGetMeshVisual3: Request mesh visual with all parameters correct" );
+
+ //Set up visual properties.
+ Property::Map propertyMap;
+ propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
+ propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::USE_MIPMAPPING, Color::GREEN ); // Test that wrong property types don't prevent the object load
+ propertyMap.Insert( MeshVisual::Property::USE_SOFT_NORMALS, 1.0f );
+ propertyMap.Insert( MeshVisual::Property::LIGHT_POSITION, 1.0f );
+ propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_DIR "/" );
+
+ //Test to see if mesh loads correctly.
+ MeshVisualLoadsCorrectlyTest( propertyMap, application );
+
+ END_TEST;
+}
+
//Test if mesh loads correctly when supplied with all main parameters, an object file, a material file and a directory location.
int UtcDaliVisualFactoryGetMeshVisual3(void)
{
propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
+ propertyMap.Insert( MeshVisual::Property::USE_MIPMAPPING, false );
+ propertyMap.Insert( MeshVisual::Property::USE_SOFT_NORMALS, false );
+ propertyMap.Insert( MeshVisual::Property::LIGHT_POSITION, Vector3::XAXIS );
propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_DIR "/" );
//Test to see if mesh loads correctly.
//Test to see if mesh loads correctly.
MeshVisualLoadsCorrectlyTest( propertyMap, application );
-
END_TEST;
}
//Set up visual properties.
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
- propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
- propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
- propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_DIR "/" );
- propertyMap.Insert( MeshVisual::Property::SHADING_MODE, MeshVisual::ShadingMode::TEXTURED_WITH_SPECULAR_LIGHTING );
+ propertyMap.Insert( "objectUrl", TEST_OBJ_FILE_NAME );
+ propertyMap.Insert( "materialUrl", TEST_MTL_FILE_NAME );
+ propertyMap.Insert( "texturesPath", TEST_RESOURCE_DIR "/" );
+ propertyMap.Insert( "useMipmapping", false );
+ propertyMap.Insert( "useSoftNormals", false );
+ propertyMap.Insert( "lightPosition", Vector3::ZAXIS );
+ propertyMap.Insert( "shadingMode", MeshVisual::ShadingMode::TEXTURED_WITH_SPECULAR_LIGHTING );
//Test to see if mesh loads correctly.
MeshVisualLoadsCorrectlyTest( propertyMap, application );
// Create a property-map that enables batching.
Property::Map propertyMap;
- propertyMap.Insert( Dali::Toolkit::ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
- propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
+ propertyMap[ Dali::Toolkit::ImageVisual::Property::URL ] = TEST_IMAGE_FILE_NAME ;
+ propertyMap[ "desiredHeight" ] = 200;
+ propertyMap[ "desiredWidth" ] = 200;
+ propertyMap[ "batchingEnabled" ] = true;
+
+ // Create an ImageView, passing the property-map in to instruct it to use batching.
+ Toolkit::ImageView imageView = Toolkit::ImageView::New();
+ imageView.SetProperty( Toolkit::ImageView::Property::IMAGE, propertyMap );
+
+ imageView.SetSize( 200.0f, 200.0f );
+ Stage::GetCurrent().Add( imageView );
+
+ END_TEST;
+}
+
+int UtcDaliVisualFactoryGetBatchImageVisual4N(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliVisualFactoryGetBatchImageVisual4: Create an ImageView that uses a batched visual, with desired properties of the wrong type" );
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK( factory );
+
+ // Create a property-map that enables batching.
+ Property::Map propertyMap;
+ propertyMap[ Dali::Toolkit::ImageVisual::Property::URL ] = TEST_IMAGE_FILE_NAME ;
+ propertyMap[ "desiredHeight" ] = Vector2(100, 100);
+ propertyMap[ "desiredWidth" ] = Vector3(1, 1, 1);
+ propertyMap[ "batchingEnabled" ] = true;
// Create an ImageView, passing the property-map in to instruct it to use batching.
Toolkit::ImageView imageView = Toolkit::ImageView::New();
/**
* @brief The transform used by the visual.
* @details Name "transform", type Property::Map.
-
+ *
* @note Optional.
* @see DevelVisual::Transform::Property
*/
- TRANSFORM = SHADER + 1, // Dali::Toolkit::Visual::Property::SHADER + 1
+ TRANSFORM = SHADER + 1,
/**
* @brief Enables/disables premultiplied alpha.
* The premultiplied alpha is false by default unless this behaviour is modified
* by the derived Visual type.
-
+ *
* @details Name "premultipliedAlpha", type Property::Boolean.
-
+ *
* @note Optional.
*/
- PREMULTIPLIED_ALPHA = SHADER + 2, // Dali::Toolkit::Visual::Property::SHADER + 2
+ PREMULTIPLIED_ALPHA = SHADER + 2,
+
+ /**
+ * @brief Mix color is a blend color for any visual.
+ * @details Name "mixColor", type Property::VECTOR4
+ *
+ * @note Optional
+ */
+ MIX_COLOR = SHADER + 3,
};
} //namespace Property
{
map.Clear();
map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::IMAGE );
+
if( !mImageUrl.empty() )
{
map.Insert( Toolkit::ImageVisual::Property::URL, mImageUrl );
const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
uniform lowp vec4 uColor;\n
uniform lowp vec4 borderColor;\n
+ uniform lowp vec4 mixColor;\n
\n
void main()\n
{\n
- gl_FragColor = borderColor*uColor;\n
+ gl_FragColor = mixColor*borderColor*uColor;\n
}\n
);
const char* FRAGMENT_SHADER_ANTI_ALIASING = DALI_COMPOSE_SHADER(
uniform lowp vec4 uColor;\n
uniform lowp vec4 borderColor;\n
+ uniform lowp vec4 mixColor;\n
uniform mediump float borderSize;\n
varying mediump float vAlpha;\n
\n
void main()\n
{\n
- gl_FragColor = borderColor*uColor;\n
+ gl_FragColor = mixColor*borderColor*uColor;\n
gl_FragColor.a *= smoothstep(0.0, 1.5, vAlpha)*smoothstep( borderSize+1.5, borderSize, vAlpha );\n
}\n
);
void BorderVisual::DoSetProperties( const Property::Map& propertyMap )
{
- Property::Value* color = propertyMap.Find( Toolkit::BorderVisual::Property::COLOR, COLOR_NAME );
- if( !( color && color->Get(mBorderColor) ) )
+ for( Property::Map::SizeType iter = 0; iter < propertyMap.Count(); ++iter )
{
- DALI_LOG_ERROR( "Fail to provide a border color to the BorderVisual object\n" );
- }
-
- Property::Value* size = propertyMap.Find( Toolkit::BorderVisual::Property::SIZE, SIZE_NAME );
- if( !( size && size->Get(mBorderSize) ) )
- {
- DALI_LOG_ERROR( "Fail to provide a border size to the BorderVisual object\n" );
+ KeyValuePair keyValue = propertyMap.GetKeyValue( iter );
+ if( keyValue.first.type == Property::Key::INDEX )
+ {
+ DoSetProperty( keyValue.first.indexKey, keyValue.second );
+ }
+ else
+ {
+ if( keyValue.first == COLOR_NAME )
+ {
+ DoSetProperty( Toolkit::BorderVisual::Property::COLOR, keyValue.second );
+ }
+ else if( keyValue.first == SIZE_NAME )
+ {
+ DoSetProperty( Toolkit::BorderVisual::Property::SIZE, keyValue.second );
+ }
+ else if( keyValue.first == ANTI_ALIASING )
+ {
+ DoSetProperty( Toolkit::BorderVisual::Property::ANTI_ALIASING, keyValue.second );
+ }
+ }
}
+}
- Property::Value* antiAliasing = propertyMap.Find( Toolkit::BorderVisual::Property::ANTI_ALIASING, ANTI_ALIASING );
- if( antiAliasing )
+void BorderVisual::DoSetProperty( Dali::Property::Index index,
+ const Dali::Property::Value& value )
+{
+ switch( index )
{
- antiAliasing->Get( mAntiAliasing );
+ case Toolkit::BorderVisual::Property::COLOR:
+ {
+ if( !value.Get( mBorderColor ) )
+ {
+ DALI_LOG_ERROR("BorderVisual: borderColor property has incorrect type\n");
+ }
+ break;
+ }
+ case Toolkit::BorderVisual::Property::SIZE:
+ {
+ if( !value.Get( mBorderSize ) )
+ {
+ DALI_LOG_ERROR("BorderVisual: borderSize property has incorrect type\n");
+ }
+ break;
+ }
+ case Toolkit::BorderVisual::Property::ANTI_ALIASING:
+ {
+ if( !value.Get( mAntiAliasing ) )
+ {
+ DALI_LOG_ERROR("BorderVisual: antiAliasing property has incorrect type\n");
+ }
+ break;
+ }
}
}
void BorderVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( DevelVisual::Property::TYPE, Toolkit::Visual::BORDER );
+ map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::BORDER );
map.Insert( Toolkit::BorderVisual::Property::COLOR, mBorderColor );
map.Insert( Toolkit::BorderVisual::Property::SIZE, mBorderSize );
map.Insert( Toolkit::BorderVisual::Property::ANTI_ALIASING, mAntiAliasing );
mFactoryCache.SaveGeometry( VisualFactoryCache::BORDER_GEOMETRY, geometry );
}
-
Shader shader = GetBorderShader();
mImpl->mRenderer = Renderer::New( geometry, shader );
//Register transform properties
mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
-
}
void BorderVisual::SetBorderColor(const Vector4& color)
*/
Geometry CreateBorderGeometry();
+ /**
+ * Helper method to set individual values by index key.
+ * @param[in] index The index key of the value
+ * @param[in] value The value
+ */
+ void DoSetProperty( Property::Index index, const Property::Value& value );
+
// Undefined
BorderVisual( const BorderVisual& borderRenderer );
namespace
{
-const char * const COLOR_NAME("mixColor");
const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
attribute mediump vec2 aPosition;\n
}
ColorVisual::ColorVisual( VisualFactoryCache& factoryCache )
-: Visual::Base( factoryCache ),
- mMixColorIndex( Property::INVALID_INDEX )
+: Visual::Base( factoryCache )
{
}
void ColorVisual::DoSetProperties( const Property::Map& propertyMap )
{
- Property::Value* color = propertyMap.Find( Toolkit::ColorVisual::Property::MIX_COLOR, COLOR_NAME );
- if( !( color && color->Get(mMixColor) ) )
+ // By virtue of DoSetProperties being called last, this will override
+ // anything set by DevelVisual::Property::MIX_COLOR
+ Property::Value* colorValue = propertyMap.Find( Toolkit::ColorVisual::Property::MIX_COLOR, MIX_COLOR );
+ if( colorValue )
{
- DALI_LOG_ERROR( "Fail to provide a color to the ColorVisual object\n" );
+ Vector4 color;
+ if( colorValue->Get( color ) )
+ {
+ SetMixColor( color );
+ }
+ else
+ {
+ DALI_LOG_ERROR("ColorVisual: mixColor property has incorrect type\n");
+ }
}
}
{
map.Clear();
map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::COLOR );
- map.Insert( Toolkit::ColorVisual::Property::MIX_COLOR, mMixColor );
+ map.Insert( Toolkit::ColorVisual::Property::MIX_COLOR, mImpl->mMixColor );
}
void ColorVisual::OnSetTransform()
mImpl->mRenderer = Renderer::New( geometry, shader );
- mMixColorIndex = DevelHandle::RegisterProperty( mImpl->mRenderer, Toolkit::ColorVisual::Property::MIX_COLOR, COLOR_NAME, mMixColor );
- if( mMixColor.a < 1.f )
+ // ColorVisual has it's own index key for mix color - use this instead
+ // of using the new base index to avoid changing existing applications
+ // String keys will get to this property.
+ mImpl->mMixColorIndex = DevelHandle::RegisterProperty( mImpl->mRenderer, Toolkit::ColorVisual::Property::MIX_COLOR, MIX_COLOR, mImpl->mMixColor );
+ if( mImpl->mMixColor.a < 1.f )
{
mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
}
- //Register transform properties
+ // Register transform properties
mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
}
-void ColorVisual::SetColor(const Vector4& color)
-{
- mMixColor = color;
-
- if( mImpl->mRenderer )
- {
- (mImpl->mRenderer).SetProperty( mMixColorIndex, color );
- if( color.a < 1.f )
- {
- mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
- }
- }
-}
-
} // namespace Internal
} // namespace Toolkit
*/
virtual void OnSetTransform();
-public:
-
- /**
- * Set the color for rendering.
- * @param[in] color The color to be rendered.
- */
- void SetColor( const Vector4& color );
-
private:
/**
* @brief Initialize the renderer with the geometry and shader from the cache, if not available, create and save to the cache for sharing.
// Undefined
ColorVisual& operator=( const ColorVisual& colorRenderer );
-
-private:
-
- Vector4 mMixColor;
- Property::Index mMixColorIndex;
-
};
} // namespace Internal
DALI_COMPOSE_SHADER(
uniform sampler2D sTexture;\n // sampler1D?
uniform lowp vec4 uColor;\n
+ uniform lowp vec4 mixColor;\n
varying mediump vec2 vTexCoord;\n
\n
void main()\n
{\n
- gl_FragColor = texture2D( sTexture, vec2( vTexCoord.y, 0.5 ) ) * uColor;\n
+ gl_FragColor = texture2D( sTexture, vec2( vTexCoord.y, 0.5 ) ) * vec4(mixColor.rgb*mixColor.a, mixColor.a) * uColor;\n
}\n
),
DALI_COMPOSE_SHADER(
uniform sampler2D sTexture;\n // sampler1D?
uniform lowp vec4 uColor;\n
+ uniform lowp vec4 mixColor;\n
varying mediump vec2 vTexCoord;\n
\n
void main()\n
{\n
- gl_FragColor = texture2D( sTexture, vec2( length(vTexCoord), 0.5 ) ) * uColor;\n
+ gl_FragColor = texture2D( sTexture, vec2( length(vTexCoord), 0.5 ) ) * vec4(mixColor.rgb*mixColor.a, mixColor.a) * uColor;\n
}\n
)
};
varying mediump vec2 vTexCoord;\n
uniform sampler2D sTexture;\n
uniform lowp vec4 uColor;\n
- uniform lowp float uAlphaBlending; // Set to 1.0 for conventional alpha blending; if pre-multiplied alpha blending, set to 0.0
+ uniform lowp vec4 mixColor;\n
+ uniform lowp float preMultipliedAlpha;\n
+ lowp vec4 visualMixColor()\n
+ {\n
+ return vec4( mixColor.rgb * mix( 1.0, mixColor.a, preMultipliedAlpha ), mixColor.a );\n
+ }\n
\n
void main()\n
{\n
- gl_FragColor = texture2D( sTexture, vTexCoord ) * vec4( uColor.rgb*max( uAlphaBlending, uColor.a ), uColor.a );\n
+ gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * visualMixColor();
}\n
);
{
// url already passed in constructor
- int desiredWidth = 0;
- Property::Value* desiredWidthValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH, DESIRED_WIDTH );
- if( desiredWidthValue )
+ for( Property::Map::SizeType iter = 0; iter < propertyMap.Count(); ++iter )
{
- desiredWidthValue->Get( desiredWidth );
+ KeyValuePair keyValue = propertyMap.GetKeyValue( iter );
+ if( keyValue.first.type == Property::Key::INDEX )
+ {
+ DoSetProperty( keyValue.first.indexKey, keyValue.second );
+ }
+ else
+ {
+ if( keyValue.first == DESIRED_WIDTH )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::DESIRED_WIDTH, keyValue.second );
+ }
+ else if( keyValue.first == DESIRED_HEIGHT )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, keyValue.second );
+ }
+ }
}
+}
- int desiredHeight = 0;
- Property::Value* desiredHeightValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT, DESIRED_HEIGHT );
- if( desiredHeightValue )
+void BatchImageVisual::DoSetProperty( Property::Index index, const Property::Value& value )
+{
+ switch( index )
{
- desiredHeightValue->Get( desiredHeight );
+ case Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH:
+ {
+ int width;
+ if( value.Get( width ) )
+ {
+ mDesiredSize.SetWidth( width );
+ }
+ else
+ {
+ DALI_LOG_ERROR("BatchImageVisual: width property has incorrect type\n");
+ }
+ break;
+ }
+ case Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT:
+ {
+ int height;
+ if( value.Get( height ) )
+ {
+ mDesiredSize.SetHeight( height );
+ }
+ else
+ {
+ DALI_LOG_ERROR("BatchImageVisual: height property has incorrect type\n");
+ }
+ break;
+ }
}
-
- mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
}
void BatchImageVisual::GetNaturalSize( Vector2& naturalSize )
*/
void CleanCache( const std::string& url );
+ /**
+ * Helper method to set individual values by index key.
+ * @param[in] index The index key of the value
+ * @param[in] value The value
+ */
+ void DoSetProperty( Property::Index index, const Property::Value& value );
+
private:
Vector4 mAtlasRect;
varying mediump vec2 vTexCoord;\n
uniform sampler2D sTexture;\n
uniform lowp vec4 uColor;\n
+ uniform lowp vec4 mixColor;\n
+ uniform lowp float preMultipliedAlpha;\n
\n
+ lowp vec4 visualMixColor()\n
+ {\n
+ return vec4( mixColor.rgb * mix( 1.0, mixColor.a, preMultipliedAlpha ), mixColor.a );\n
+ }\n
void main()\n
{\n
- gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
+ gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * visualMixColor();\n
}\n
);
uniform sampler2D sTexture;\n
uniform mediump vec4 uAtlasRect;\n
uniform lowp vec4 uColor;\n
+ uniform lowp vec4 mixColor;\n
+ uniform lowp float preMultipliedAlpha;\n
\n
- void main()\n
+ lowp vec4 visualMixColor()\n
{\n
- mediump vec2 texCoord = clamp( mix( uAtlasRect.xy, uAtlasRect.zw, vTexCoord ), uAtlasRect.xy, uAtlasRect.zw );\n
- gl_FragColor = texture2D( sTexture, texCoord ) * uColor;\n
+ return vec4( mixColor.rgb * mix( 1.0, mixColor.a, preMultipliedAlpha ), mixColor.a );\n
}\n
+ \n
+ void main()\n
+ {\n
+ mediump vec2 texCoord = clamp( mix( uAtlasRect.xy, uAtlasRect.zw, vTexCoord ), uAtlasRect.xy, uAtlasRect.zw );\n
+ gl_FragColor = texture2D( sTexture, texCoord ) * uColor * visualMixColor();\n
+ }\n
);
const char* FRAGMENT_SHADER_ATLAS_VARIOUS_WRAP = DALI_COMPOSE_SHADER(
// WrapMode -- 0: CLAMP; 1: REPEAT; 2: REFLECT;
uniform lowp vec2 wrapMode;\n
uniform lowp vec4 uColor;\n
+ uniform lowp vec4 mixColor;\n
+ uniform lowp float preMultipliedAlpha;\n
\n
mediump float wrapCoordinate( mediump vec2 range, mediump float coordinate, lowp float wrap )\n
{\n
return clamp( mix(range.x, range.y, coord), range.x, range.y );
}\n
\n
+ lowp vec4 visualMixColor()\n
+ {\n
+ return vec4( mixColor.rgb * mix( 1.0, mixColor.a, preMultipliedAlpha ), mixColor.a );\n
+ }\n
+ \n
void main()\n
{\n
- mediump vec2 texCoord = vec2( wrapCoordinate( uAtlasRect.xz, vTexCoord.x, wrapMode.x ),
- wrapCoordinate( uAtlasRect.yw, vTexCoord.y, wrapMode.y ) );\n
- gl_FragColor = texture2D( sTexture, texCoord ) * uColor;\n
+ mediump vec2 texCoord = vec2( wrapCoordinate( uAtlasRect.xz, vTexCoord.x, wrapMode.x ),
+ wrapCoordinate( uAtlasRect.yw, vTexCoord.y, wrapMode.y ) );\n
+ gl_FragColor = texture2D( sTexture, texCoord ) * uColor * visualMixColor();\n
}\n
);
void ImageVisual::DoSetProperties( const Property::Map& propertyMap )
{
// Url is already received in constructor
- Property::Value* fittingValue = propertyMap.Find( Toolkit::ImageVisual::Property::FITTING_MODE, IMAGE_FITTING_MODE );
- if( fittingValue )
+ for( Property::Map::SizeType iter = 0; iter < propertyMap.Count(); ++iter )
{
- int value;
- Scripting::GetEnumerationProperty( *fittingValue, FITTING_MODE_TABLE, FITTING_MODE_TABLE_COUNT, value );
- mFittingMode = Dali::FittingMode::Type( value );
+ KeyValuePair keyValue = propertyMap.GetKeyValue( iter );
+ if( keyValue.first.type == Property::Key::INDEX )
+ {
+ DoSetProperty( keyValue.first.indexKey, keyValue.second );
+ }
+ else
+ {
+ if( keyValue.first == IMAGE_FITTING_MODE )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::FITTING_MODE, keyValue.second );
+ }
+ else if( keyValue.first == IMAGE_SAMPLING_MODE )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::SAMPLING_MODE, keyValue.second );
+ }
+ else if( keyValue.first == IMAGE_DESIRED_WIDTH )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::DESIRED_WIDTH, keyValue.second );
+ }
+ else if( keyValue.first == IMAGE_DESIRED_HEIGHT )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, keyValue.second );
+ }
+ else if( keyValue.first == PIXEL_AREA_UNIFORM_NAME )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::PIXEL_AREA, keyValue.second );
+ }
+ else if( keyValue.first == IMAGE_WRAP_MODE_U )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::WRAP_MODE_U, keyValue.second );
+ }
+ else if( keyValue.first == IMAGE_WRAP_MODE_V )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::WRAP_MODE_V, keyValue.second );
+ }
+ else if( keyValue.first == SYNCHRONOUS_LOADING )
+ {
+ DoSetProperty( Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING, keyValue.second );
+ }
+ }
}
- Property::Value* samplingValue = propertyMap.Find( Toolkit::ImageVisual::Property::SAMPLING_MODE, IMAGE_SAMPLING_MODE );
- if( samplingValue )
+ if( mImpl->mFlags & Impl::IS_SYNCHRONOUS_RESOURCE_LOADING && mImageUrl.size() > 0u )
{
- int value;
- Scripting::GetEnumerationProperty( *samplingValue, SAMPLING_MODE_TABLE, SAMPLING_MODE_TABLE_COUNT, value );
- mSamplingMode = Dali::SamplingMode::Type( value );
+ // if sync loading is required, the loading should start
+ // immediately when new image url is set or the actor is off stage
+ // ( for on-stage actor with image url unchanged, resource loading
+ // is already finished )
+ LoadResourceSynchronously();
}
+}
- // Use a variable to detect if the width or height have been modified by the property map.
- bool desiredSizeSpecified = false;
- int desiredWidth = 0;
- Property::Value* desiredWidthValue = propertyMap.Find( Toolkit::ImageVisual::Property::DESIRED_WIDTH, IMAGE_DESIRED_WIDTH );
- if( desiredWidthValue )
+void ImageVisual::DoSetProperty( Property::Index index, const Property::Value& value )
+{
+ switch( index )
{
- desiredWidthValue->Get( desiredWidth );
- desiredSizeSpecified = true;
- }
+ case Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING:
+ {
+ bool sync;
+ if( value.Get( sync ) )
+ {
+ if( sync )
+ {
+ mImpl->mFlags |= Impl::IS_SYNCHRONOUS_RESOURCE_LOADING;
+ }
+ else
+ {
+ mImpl->mFlags &= ~Impl::IS_SYNCHRONOUS_RESOURCE_LOADING;
+ }
+ }
+ else
+ {
+ DALI_LOG_ERROR("ImageVisual: synchronousLoading property has incorrect type\n");
+ }
+ break;
+ }
- int desiredHeight = 0;
- Property::Value* desiredHeightValue = propertyMap.Find( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, IMAGE_DESIRED_HEIGHT );
- if( desiredHeightValue )
- {
- desiredHeightValue->Get( desiredHeight );
- desiredSizeSpecified = true;
- }
+ case Toolkit::ImageVisual::Property::DESIRED_WIDTH:
+ {
+ float desiredWidth;
+ if( value.Get( desiredWidth ) )
+ {
+ mDesiredSize.SetWidth( desiredWidth );
+ }
+ else
+ {
+ DALI_LOG_ERROR("ImageVisual: desiredWidth property has incorrect type\n");
+ }
+ break;
+ }
- // Only update the desired size if specified in the property map.
- if( desiredSizeSpecified )
- {
- mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
- }
+ case Toolkit::ImageVisual::Property::DESIRED_HEIGHT:
+ {
+ float desiredHeight;
+ if( value.Get( desiredHeight ) )
+ {
+ mDesiredSize.SetHeight( desiredHeight );
+ }
+ else
+ {
+ DALI_LOG_ERROR("ImageVisual: desiredHeight property has incorrect type\n");
+ }
+ break;
+ }
- Property::Value* pixelAreaValue = propertyMap.Find( Toolkit::ImageVisual::Property::PIXEL_AREA, PIXEL_AREA_UNIFORM_NAME );
- if( pixelAreaValue )
- {
- pixelAreaValue->Get( mPixelArea );
- }
+ case Toolkit::ImageVisual::Property::FITTING_MODE:
+ {
+ int fittingMode;
+ Scripting::GetEnumerationProperty( value, FITTING_MODE_TABLE, FITTING_MODE_TABLE_COUNT, fittingMode );
+ mFittingMode = Dali::FittingMode::Type( fittingMode );
+ break;
+ }
- Property::Value* wrapModeValueU = propertyMap.Find( Toolkit::ImageVisual::Property::WRAP_MODE_U, IMAGE_WRAP_MODE_U );
- if( wrapModeValueU )
- {
- int value;
- Scripting::GetEnumerationProperty( *wrapModeValueU, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, value );
- mWrapModeU = Dali::WrapMode::Type( value );
- }
+ case Toolkit::ImageVisual::Property::SAMPLING_MODE:
+ {
+ int samplingMode;
+ Scripting::GetEnumerationProperty( value, SAMPLING_MODE_TABLE, SAMPLING_MODE_TABLE_COUNT, samplingMode );
+ mSamplingMode = Dali::SamplingMode::Type( samplingMode );
+ break;
+ }
- Property::Value* wrapModeValueV = propertyMap.Find( Toolkit::ImageVisual::Property::WRAP_MODE_V, IMAGE_WRAP_MODE_V );
- if( wrapModeValueV )
- {
- int value;
- Scripting::GetEnumerationProperty( *wrapModeValueV, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, value );
- mWrapModeV = Dali::WrapMode::Type( value );
- }
+ case Toolkit::ImageVisual::Property::PIXEL_AREA:
+ {
+ value.Get( mPixelArea );
+ break;
+ }
- Property::Value* syncLoading = propertyMap.Find( Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING, SYNCHRONOUS_LOADING );
- if( syncLoading )
- {
- bool sync;
- syncLoading->Get( sync );
- if( sync )
+ case Toolkit::ImageVisual::Property::WRAP_MODE_U:
{
- mImpl->mFlags |= Impl::IS_SYNCHRONOUS_RESOURCE_LOADING;
- // if sync loading is required, the loading should start immediately when new image url is set or the actor is off stage
- // ( for on-stage actor with image url unchanged, resource loading is already finished)
- if( mImageUrl.size() > 0u )
- {
- LoadResourceSynchronously();
- }
+ int wrapMode;
+ Scripting::GetEnumerationProperty( value, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, wrapMode );
+ mWrapModeU = Dali::WrapMode::Type( wrapMode );
+ break;
}
- else
+
+ case Toolkit::ImageVisual::Property::WRAP_MODE_V:
{
- mImpl->mFlags &= ~Impl::IS_SYNCHRONOUS_RESOURCE_LOADING;
+ int wrapMode;
+ Scripting::GetEnumerationProperty( value, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, wrapMode );
+ mWrapModeV = Dali::WrapMode::Type( wrapMode );
+ break;
}
}
}
void ImageVisual::InitializeRenderer( const Image& image )
{
-
mImpl->mFlags &= ~Impl::IS_FROM_CACHE;
// don't reuse CreateTextureSet
InitializeRenderer( mImage );
}
- if ( !mImpl->mRenderer)
+ if ( !mImpl->mRenderer )
{
return;
}
*/
void CleanCache(const std::string& url);
+ /**
+ * Helper method to set individual values by index key.
+ * @param[in] index The index key of the value
+ * @param[in] value The value
+ */
+ void DoSetProperty( Property::Index index, const Property::Value& value );
+
private:
Image mImage;
precision mediump float;\n
varying mediump vec3 vIllumination;\n
uniform lowp vec4 uColor;\n
+ uniform lowp vec4 mixColor;\n
+ uniform lowp float preMultipliedAlpha;\n
+ lowp vec4 visualMixColor()\n
+ {\n
+ return vec4( mixColor.rgb * mix( 1.0, mixColor.a, preMultipliedAlpha ), mixColor.a );\n
+ }\n
void main()\n
{\n
- gl_FragColor = vec4( vIllumination.rgb * uColor.rgb, uColor.a );\n
+ gl_FragColor = vec4( vIllumination.rgb * uColor.rgb, uColor.a ) * visualMixColor();\n
}\n
);
varying mediump float vSpecular;\n
uniform sampler2D sDiffuse;\n
uniform lowp vec4 uColor;\n
+ uniform lowp vec4 mixColor;\n
+ uniform lowp float preMultipliedAlpha;\n
+ lowp vec4 visualMixColor()\n
+ {\n
+ return vec4( mixColor.rgb * mix( 1.0, mixColor.a, preMultipliedAlpha ), mixColor.a );\n
+ }\n
void main()\n
{\n
vec4 texture = texture2D( sDiffuse, vTexCoord );\n
- gl_FragColor = vec4( vIllumination.rgb * texture.rgb * uColor.rgb + vSpecular * 0.3, texture.a * uColor.a );\n
+ vec4 visualMixColor = visualMixColor();\n
+ gl_FragColor = vec4( vIllumination.rgb * texture.rgb * uColor.rgb * visualMixColor.rgb + vSpecular * 0.3, texture.a * uColor.a * visualMixColor.a );\n
}\n
);
uniform sampler2D sNormal;\n
uniform sampler2D sGloss;\n
uniform lowp vec4 uColor;\n
+ uniform lowp vec4 mixColor;\n
+ uniform lowp float preMultipliedAlpha;\n
+ lowp vec4 visualMixColor()\n
+ {\n
+ return vec4( mixColor.rgb * mix( 1.0, mixColor.a, preMultipliedAlpha ), mixColor.a );\n
+ }\n
void main()\n
{\n
vec4 texture = texture2D( sDiffuse, vTexCoord );\n
vec3 normal = normalize( texture2D( sNormal, vTexCoord ).xyz * 2.0 - 1.0 );\n
vec4 glossMap = texture2D( sGloss, vTexCoord );\n
+ vec4 visualMixColor = visualMixColor();\n
float lightDiffuse = max( 0.0, dot( normal, normalize( vLightDirection ) ) );\n
lightDiffuse = lightDiffuse * 0.5 + 0.5;\n
float shininess = pow ( max ( dot ( normalize( vHalfVector ), normal ), 0.0 ), 16.0 ) ;
- gl_FragColor = vec4( texture.rgb * uColor.rgb * lightDiffuse + shininess * glossMap.rgb, texture.a * uColor.a );\n
+ gl_FragColor = vec4( texture.rgb * uColor.rgb * visualMixColor.rgb * lightDiffuse + shininess * glossMap.rgb, texture.a * uColor.a * visualMixColor.a );\n
}\n
);
void MeshVisual::DoSetProperties( const Property::Map& propertyMap )
{
- Property::Value* objectUrl = propertyMap.Find( Toolkit::MeshVisual::Property::OBJECT_URL, OBJECT_URL_NAME );
- if( !objectUrl || !objectUrl->Get( mObjectUrl ) )
+ for( Property::Map::SizeType iter = 0; iter < propertyMap.Count(); ++iter )
{
- DALI_LOG_ERROR( "Fail to provide object URL to the MeshVisual object.\n" );
+ KeyValuePair keyValue = propertyMap.GetKeyValue( iter );
+ if( keyValue.first.type == Property::Key::INDEX )
+ {
+ DoSetProperty( keyValue.first.indexKey, keyValue.second );
+ }
+ else
+ {
+ if( keyValue.first == OBJECT_URL_NAME )
+ {
+ DoSetProperty( Toolkit::MeshVisual::Property::OBJECT_URL, keyValue.second );
+ }
+ else if( keyValue.first == MATERIAL_URL_NAME )
+ {
+ DoSetProperty( Toolkit::MeshVisual::Property::MATERIAL_URL, keyValue.second );
+ }
+ else if( keyValue.first == TEXTURES_PATH_NAME )
+ {
+ DoSetProperty( Toolkit::MeshVisual::Property::TEXTURES_PATH, keyValue.second );
+ }
+ else if( keyValue.first == SHADING_MODE_NAME )
+ {
+ DoSetProperty( Toolkit::MeshVisual::Property::SHADING_MODE, keyValue.second );
+ }
+ else if( keyValue.first == USE_MIPMAPPING_NAME )
+ {
+ DoSetProperty( Toolkit::MeshVisual::Property::USE_MIPMAPPING, keyValue.second );
+ }
+ else if( keyValue.first == USE_SOFT_NORMALS_NAME )
+ {
+ DoSetProperty( Toolkit::MeshVisual::Property::USE_SOFT_NORMALS, keyValue.second );
+ }
+ else if( keyValue.first == LIGHT_POSITION_NAME )
+ {
+ DoSetProperty( Toolkit::MeshVisual::Property::LIGHT_POSITION, keyValue.second );
+ }
+ }
}
- Property::Value* materialUrl = propertyMap.Find( Toolkit::MeshVisual::Property::MATERIAL_URL, MATERIAL_URL_NAME );
- if( !materialUrl || !materialUrl->Get( mMaterialUrl ) || mMaterialUrl.empty() )
+ if( mMaterialUrl.empty() )
{
mUseTexture = false;
}
- Property::Value* imagesUrl = propertyMap.Find( Toolkit::MeshVisual::Property::TEXTURES_PATH, TEXTURES_PATH_NAME );
- if( !imagesUrl || !imagesUrl->Get( mTexturesPath ) )
+ if( mLightPosition == Vector3::ZERO )
{
- //Default behaviour is to assume files are in the same directory,
- // or have their locations detailed in full when supplied.
- mTexturesPath.clear();
- }
-
- Property::Value* shadingMode = propertyMap.Find( Toolkit::MeshVisual::Property::SHADING_MODE, SHADING_MODE_NAME );
- if( shadingMode )
- {
- Scripting::GetEnumerationProperty( *shadingMode, SHADING_MODE_TABLE, SHADING_MODE_TABLE_COUNT, mShadingMode );
- }
-
- Property::Value* useMipmapping = propertyMap.Find( Toolkit::MeshVisual::Property::USE_MIPMAPPING, USE_MIPMAPPING_NAME );
- if( useMipmapping )
- {
- useMipmapping->Get( mUseMipmapping );
- }
+ // Default behaviour is to place the light directly in front of the object,
+ // at a reasonable distance to light everything on screen.
+ Stage stage = Stage::GetCurrent();
- Property::Value* useSoftNormals = propertyMap.Find( Toolkit::MeshVisual::Property::USE_SOFT_NORMALS, USE_SOFT_NORMALS_NAME );
- if( useSoftNormals )
- {
- useSoftNormals->Get( mUseSoftNormals );
+ mLightPosition = Vector3( stage.GetSize().width / 2, stage.GetSize().height / 2, stage.GetSize().width * 5 );
}
+}
- Property::Value* lightPosition = propertyMap.Find( Toolkit::MeshVisual::Property::LIGHT_POSITION, LIGHT_POSITION_NAME );
- if( lightPosition )
+void MeshVisual::DoSetProperty( Property::Index index, const Property::Value& value )
+{
+ switch( index )
{
- if( !lightPosition->Get( mLightPosition ) )
+ case Toolkit::MeshVisual::Property::OBJECT_URL:
{
- DALI_LOG_ERROR( "Invalid value passed for light position in MeshRenderer object.\n" );
- mLightPosition = Vector3::ZERO;
+ if( !value.Get( mObjectUrl ) )
+ {
+ DALI_LOG_ERROR("MeshVisual: property objectUrl is the wrong type, use STRING\n");
+ }
+ break;
+ }
+ case Toolkit::MeshVisual::Property::MATERIAL_URL:
+ {
+ if( ! value.Get( mMaterialUrl ) )
+ {
+ DALI_LOG_ERROR("MeshVisual: property materialUrl is the wrong type, use STRING\n");
+ }
+ break;
+ }
+ case Toolkit::MeshVisual::Property::TEXTURES_PATH:
+ {
+ if( ! value.Get( mTexturesPath ) )
+ {
+ mTexturesPath.clear();
+ }
+ break;
+ }
+ case Toolkit::MeshVisual::Property::SHADING_MODE:
+ {
+ Scripting::GetEnumerationProperty( value, SHADING_MODE_TABLE, SHADING_MODE_TABLE_COUNT, mShadingMode );
+ break;
+ }
+ case Toolkit::MeshVisual::Property::USE_MIPMAPPING:
+ {
+ if( !value.Get( mUseMipmapping ) )
+ {
+ DALI_LOG_ERROR("MeshVisual: property useMipmapping is the wrong type, use BOOLEAN\n");
+ }
+ break;
+ }
+ case Toolkit::MeshVisual::Property::USE_SOFT_NORMALS:
+ {
+ if( !value.Get( mUseSoftNormals ) )
+ {
+ DALI_LOG_ERROR("MeshVisual: property useSoftNormals is the wrong type, use BOOLEAN\n");
+ }
+ break;
+ }
+ case Toolkit::MeshVisual::Property::LIGHT_POSITION:
+ {
+ if( !value.Get( mLightPosition ) )
+ {
+ mLightPosition = Vector3::ZERO;
+ DALI_LOG_ERROR("MeshVisual: property lightPosition is the wrong type, use VECTOR3\n");
+ }
+ break;
}
- }
- else
- {
- //Default behaviour is to place the light directly in front of the object,
- // at a reasonable distance to light everything on screen.
- Stage stage = Stage::GetCurrent();
-
- mLightPosition = Vector3( stage.GetSize().width / 2, stage.GetSize().height / 2, stage.GetSize().width * 5 );
}
}
*/
bool LoadTextures();
+ /**
+ * Helper method to set individual values by index key.
+ * @param[in] index The index key of the value
+ * @param[in] value The value
+ */
+ void DoSetProperty( Property::Index index, const Property::Value& value );
+
private:
// Undefined
varying mediump vec2 vTexCoord;\n
uniform sampler2D sTexture;\n
uniform lowp vec4 uColor;\n
- \n
+ uniform lowp vec4 mixColor;\n
+ uniform lowp float preMultipliedAlpha;\n
+ lowp vec4 visualMixColor()\n
+ {\n
+ return vec4( mixColor.rgb * mix( 1.0, mixColor.a, preMultipliedAlpha ), mixColor.a );\n
+ }\n
void main()\n
{\n
- gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
+ gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * visualMixColor();\n
}\n
);
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
//Property names
const char * const PRIMITIVE_SHAPE( "shape" );
-const char * const SHAPE_COLOR( "mixColor" );
const char * const SLICES( "slices" );
const char * const STACKS( "stacks" );
const char * const SCALE_TOP_RADIUS( "scaleTopRadius" );
//Shader properties
const char * const OBJECT_MATRIX_UNIFORM_NAME( "uObjectMatrix" );
-const char * const COLOR_UNIFORM_NAME( "mixColor" );
const char * const OBJECT_DIMENSIONS_UNIFORM_NAME( "uObjectDimensions" );
const char * const STAGE_OFFSET_UNIFORM_NAME( "uStageOffset" );
vec3 originFlipY = vec3(origin.x, -origin.y, 0.0);
vec3 anchorPointFlipY = vec3( anchorPoint.x, -anchorPoint.y, 0.0);
vec3 offset = vec3( ( offset / uSize.xy ) * offsetSizeMode.xy + offset * (1.0-offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);\n
+
return vec4( (aPosition + anchorPointFlipY)*scaleFactor + (offset + originFlipY)*uSize, 1.0 );\n
}\n
vec4 vertexPosition = uObjectMatrix * normalisedVertexPosition;\n
vertexPosition = uMvpMatrix * vertexPosition;\n
- //Illumination in Model-View space - Transform attributes and uniforms\n
- vec4 mvVertexPosition = uModelView * normalisedVertexPosition;\n
- vec3 normal = uNormalMatrix * mat3( uObjectMatrix ) * aNormal;\n
+ //Illumination in Model-View space - Transform attributes and uniforms\n
+ vec4 mvVertexPosition = uModelView * normalisedVertexPosition;\n
+ vec3 normal = uNormalMatrix * mat3( uObjectMatrix ) * aNormal;\n
- vec4 mvLightPosition = vec4( ( lightPosition.xy - uStageOffset ), lightPosition.z, 1.0 );\n
- mvLightPosition = uViewMatrix * mvLightPosition;\n
- vec3 vectorToLight = normalize( mvLightPosition.xyz - mvVertexPosition.xyz );\n
+ vec4 mvLightPosition = vec4( ( lightPosition.xy - uStageOffset ), lightPosition.z, 1.0 );\n
+ mvLightPosition = uViewMatrix * mvLightPosition;\n
+ vec3 vectorToLight = normalize( mvLightPosition.xyz - mvVertexPosition.xyz );\n
- float lightDiffuse = max( dot( vectorToLight, normal ), 0.0 );\n
- vIllumination = vec3( lightDiffuse * 0.5 + 0.5 );\n
+ float lightDiffuse = max( dot( vectorToLight, normal ), 0.0 );\n
+ vIllumination = vec3( lightDiffuse * 0.5 + 0.5 );\n
- gl_Position = vertexPosition;\n
+ gl_Position = vertexPosition;\n
}\n
);
PrimitiveVisual::PrimitiveVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
- mColor( DEFAULT_COLOR ),
mScaleDimensions( Vector3::ONE ),
mScaleTopRadius( DEFAULT_SCALE_TOP_RADIUS ),
mScaleBottomRadius( DEFAULT_SCALE_BOTTOM_RADIUS ),
mStacks( DEFAULT_STACKS ),
mPrimitiveType( Toolkit::PrimitiveVisual::Shape::SPHERE )
{
+ mImpl->mMixColor = DEFAULT_COLOR;
}
PrimitiveVisual::~PrimitiveVisual()
DALI_LOG_ERROR( "Fail to provide shape to the PrimitiveVisual object.\n" );
}
- //Read in other potential properties.
-
- Property::Value* color = propertyMap.Find( Toolkit::PrimitiveVisual::Property::MIX_COLOR, SHAPE_COLOR );
- if( color && !color->Get( mColor ) )
+ // By virtue of DoSetProperties being called last, this will override
+ // anything set by DevelVisual::Property::MIX_COLOR
+ Property::Value* colorValue = propertyMap.Find( Toolkit::PrimitiveVisual::Property::MIX_COLOR, MIX_COLOR );
+ if( colorValue )
{
- DALI_LOG_ERROR( "Invalid type for color in PrimitiveVisual.\n" );
+ Vector4 color;
+ if( colorValue->Get( color ) )
+ {
+ SetMixColor( color );
+ }
}
Property::Value* slices = propertyMap.Find( Toolkit::PrimitiveVisual::Property::SLICES, SLICES );
{
map.Clear();
map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::PRIMITIVE );
+ map.Insert( Toolkit::PrimitiveVisual::Property::MIX_COLOR, mImpl->mMixColor );
map.Insert( Toolkit::PrimitiveVisual::Property::SHAPE, mPrimitiveType );
- map.Insert( Toolkit::PrimitiveVisual::Property::MIX_COLOR, mColor );
map.Insert( Toolkit::PrimitiveVisual::Property::SLICES, mSlices );
map.Insert( Toolkit::PrimitiveVisual::Property::STACKS, mStacks );
map.Insert( Toolkit::PrimitiveVisual::Property::SCALE_TOP_RADIUS, mScaleTopRadius );
mImpl->mRenderer = Renderer::New( mGeometry, mShader );
mImpl->mRenderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK );
- //Register transform properties
+ // Register transform properties
mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
+
+ mImpl->mMixColorIndex = DevelHandle::RegisterProperty( mImpl->mRenderer, Toolkit::PrimitiveVisual::Property::MIX_COLOR, MIX_COLOR, mImpl->mMixColor );
}
void PrimitiveVisual::UpdateShaderUniforms()
mShader.RegisterProperty( STAGE_OFFSET_UNIFORM_NAME, Vector2( width, height ) / 2.0f );
mShader.RegisterProperty( LIGHT_POSITION_UNIFORM_NAME, mLightPosition );
mShader.RegisterProperty( OBJECT_MATRIX_UNIFORM_NAME, scaleMatrix );
- DevelHandle::RegisterProperty( mShader, Toolkit::PrimitiveVisual::Property::MIX_COLOR, COLOR_UNIFORM_NAME, mColor );
mShader.RegisterProperty( OBJECT_DIMENSIONS_UNIFORM_NAME, mObjectDimensions );
}
}
void PrimitiveVisual::CreateConic( Vector<Vertex>& vertices, Vector<unsigned short>& indices, float scaleTopRadius,
- float scaleBottomRadius, float scaleHeight, int slices )
+ float scaleBottomRadius, float scaleHeight, int slices )
{
ComputeConicVertices( vertices, scaleTopRadius, scaleBottomRadius, scaleHeight, slices );
FormConicTriangles( indices, scaleTopRadius, scaleBottomRadius, slices );
}
void PrimitiveVisual::CreateBevelledCube( Vector<Vertex>& vertices, Vector<unsigned short>& indices,
- Vector3 dimensions, float bevelPercentage, float bevelSmoothness )
+ Vector3 dimensions, float bevelPercentage, float bevelSmoothness )
{
float maxDimension = std::max( std::max( dimensions.x, dimensions.y ), dimensions.z );
dimensions = dimensions / maxDimension;
}
void PrimitiveVisual::ComputeCircleTables( Vector<float>& sinTable, Vector<float>& cosTable, int divisions,
- bool halfCircle )
+ bool halfCircle )
{
if( divisions < 0 )
{
}
void PrimitiveVisual::ComputeConicVertices( Vector<Vertex>& vertices, float scaleTopRadius,
- float scaleBottomRadius, float scaleHeight, int slices )
+ float scaleBottomRadius, float scaleHeight, int slices )
{
int vertexIndex = 0; //Track progress through vertices.
Vector<float> sinTable;
}
void PrimitiveVisual::FormConicTriangles( Vector<unsigned short>& indices, float scaleTopRadius,
- float scaleBottomRadius, int slices )
+ float scaleBottomRadius, int slices )
{
int indiceIndex = 0; //Track progress through indices.
int numTriangles = 0;
}
void PrimitiveVisual::ComputeBevelledCubeVertices( Vector<Vertex>& vertices, Vector3 dimensions,
- float bevelPercentage, float bevelSmoothness )
+ float bevelPercentage, float bevelSmoothness )
{
int numPositions = 24;
int numFaces = 26;
Shader mShader;
Geometry mGeometry;
- Vector4 mColor; //Color of shape.
Vector3 mObjectDimensions; //Dimensions of shape, scaled to be between 0.0 and 1.0.
Vector3 mSceneCenter;
uniform sampler2D sTexture;\n
uniform mediump vec4 uAtlasRect;\n
uniform lowp vec4 uColor;\n
+ uniform lowp vec4 mixColor;\n
\n
void main()\n
{\n
mediump vec2 texCoord = clamp( mix( uAtlasRect.xy, uAtlasRect.zw, vTexCoord ), uAtlasRect.xy, uAtlasRect.zw );\n
- gl_FragColor = texture2D( sTexture, texCoord ) * uColor;\n
+ gl_FragColor = texture2D( sTexture, texCoord ) * uColor * mixColor;\n
}\n
);
Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
- Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_ATLAS_CLAMP );
- mFactoryCache.SaveShader( VisualFactoryCache::IMAGE_SHADER_ATLAS_DEFAULT_WRAP, shader );
+ Shader shader = mFactoryCache.GetShader( VisualFactoryCache::TEXT_SHADER );
+ if( ! shader )
+ {
+ shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_ATLAS_CLAMP );
+ shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
- shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
+ mFactoryCache.SaveShader( VisualFactoryCache::TEXT_SHADER, shader );
+ }
mImpl->mRenderer = Renderer::New( geometry, shader );
mImpl->mRenderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, Toolkit::DepthIndex::TEXT );
Internal::Visual::Base::Impl::Impl()
: mCustomShader( NULL ),
+ mBlendSlotDelegate( NULL ),
mTransform(),
+ mMixColor( Color::WHITE ),
mControlSize( Vector2::ZERO ),
mDepthIndex( 0.0f ),
+ mMixColorIndex( Property::INVALID_INDEX ),
mFlags( 0 )
{
}
Internal::Visual::Base::Impl::~Impl()
{
delete mCustomShader;
+ delete mBlendSlotDelegate;
}
Internal::Visual::Base::Impl::CustomShader::CustomShader( const Property::Map& map )
mOrigin = Toolkit::Align::CENTER;
mAnchorPoint = Toolkit::Align::CENTER;
+ UpdatePropertyMap( map );
+}
+
+void Internal::Visual::Base::Impl::Transform::UpdatePropertyMap( const Property::Map& map )
+{
for( Property::Map::SizeType i(0); i<map.Count(); ++i )
{
KeyValuePair keyValue = map.GetKeyValue( i );
struct Transform
{
+ /**
+ * Default constructor ensures the visual fills the control
+ */
Transform();
+
+ /**
+ * Use the property map to set zero or more of the transform
+ * attributes, and sets the remaining attributes to their default
+ * values.
+ */
void SetPropertyMap( const Property::Map& map );
+
+ /**
+ * Add the transform attributes to the map (using integer keys)
+ */
void GetPropertyMap( Property::Map& map ) const;
+
+ /**
+ * Update zero or more attributes from the property map.
+ */
+ void UpdatePropertyMap( const Property::Map& map );
+
+ /**
+ * Register or set the uniform properties onto the renderer
+ */
void RegisterUniforms( Renderer renderer, Toolkit::Direction::Type direction );
+
+ /**
+ * Convert the control size and the transform attributes into the actual
+ * size of the visual.
+ */
Vector2 GetVisualSize( const Vector2& controlSize );
Vector2 mOffset;
Toolkit::Align::Type mAnchorPoint;
};
- Renderer mRenderer;
- CustomShader* mCustomShader;
- std::string mName;
- Transform mTransform;
- Size mControlSize;
- float mDepthIndex;
- int mFlags;
+ Renderer mRenderer;
+ CustomShader* mCustomShader;
+ SlotDelegate<Visual::Base>* mBlendSlotDelegate; ///< Used to own mix color animation connection
+ std::string mName;
+ Transform mTransform;
+ Vector4 mMixColor;
+ Size mControlSize;
+ float mDepthIndex;
+ Property::Index mMixColorIndex;
+ int mFlags;
};
} // namespace Visual
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
// EXTERNAL HEADER
#include <dali/public-api/common/dali-common.h>
+#include <dali/devel-api/object/handle-devel.h>
#include <dali/integration-api/debug.h>
//INTERNAL HEARDER
const KeyValuePair& pair = propertyMap.GetKeyValue( i );
const Property::Key& key = pair.first;
const Property::Value& value = pair.second;
- switch( key.indexKey )
+
+ Property::Key matchKey = key;
+ if( matchKey.type == Property::Key::STRING )
+ {
+ if( matchKey == CUSTOM_SHADER )
+ {
+ matchKey = Property::Key( DevelVisual::Property::SHADER );
+ }
+ else if( matchKey == TRANSFORM )
+ {
+ matchKey = Property::Key( DevelVisual::Property::TRANSFORM );
+ }
+ else if( matchKey == PREMULTIPLIED_ALPHA )
+ {
+ matchKey = Property::Key( DevelVisual::Property::PREMULTIPLIED_ALPHA );
+ }
+ else if( matchKey == MIX_COLOR )
+ {
+ matchKey = Property::Key( DevelVisual::Property::MIX_COLOR );
+ }
+ }
+
+ switch( matchKey.indexKey )
{
case DevelVisual::Property::SHADER:
{
}
break;
}
+
+ case DevelVisual::Property::MIX_COLOR:
+ {
+ Vector4 mixColor;
+ if( value.Get( mixColor ) )
+ {
+ SetMixColor( mixColor );
+ }
+ break;
+ }
}
}
if( mImpl->mRenderer )
{
+ RegisterMixColor();
+
mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, IsPreMultipliedAlphaEnabled());
mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex );
mImpl->mFlags |= Impl::IS_ON_STAGE; // Only sets the flag if renderer exists
if( IsOnStage() )
{
DoSetOffStage( actor );
-
+ mImpl->mMixColorIndex = Property::INVALID_INDEX;
mImpl->mFlags &= ~Impl::IS_ON_STAGE;
}
}
bool premultipliedAlpha( IsPreMultipliedAlphaEnabled() );
map.Insert( DevelVisual::Property::PREMULTIPLIED_ALPHA, premultipliedAlpha );
+
+ // Note, Color and Primitive will also insert their own mix color into the map
+ // which is ok, because they have a different key value range.
+ map.Insert( DevelVisual::Property::MIX_COLOR, GetMixColor() );
}
void Visual::Base::EnablePreMultipliedAlpha( bool preMultipled )
return mImpl->mFlags & Impl::IS_FROM_CACHE;
}
+void Visual::Base::RegisterMixColor()
+{
+ // Only register if not already registered.
+ // (Color and Primitive visuals will register their own and save to this index)
+ if( mImpl->mMixColorIndex == Property::INVALID_INDEX )
+ {
+ mImpl->mMixColorIndex = DevelHandle::RegisterProperty(
+ mImpl->mRenderer,
+ Toolkit::DevelVisual::Property::MIX_COLOR,
+ MIX_COLOR,
+ mImpl->mMixColor );
+
+ if( mImpl->mMixColor.a < 1.f )
+ {
+ mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
+ }
+
+ float preMultipliedAlpha = 0.0f;
+ if( IsPreMultipliedAlphaEnabled() )
+ {
+ preMultipliedAlpha = 1.0f;
+ }
+ mImpl->mRenderer.RegisterProperty( "preMultipliedAlpha", preMultipliedAlpha );
+ }
+}
+
+void Visual::Base::SetMixColor( const Vector4& color )
+{
+ mImpl->mMixColor = color;
+
+ if( mImpl->mRenderer )
+ {
+ mImpl->mRenderer.SetProperty( mImpl->mMixColorIndex, color );
+ if( color.a < 1.f )
+ {
+ mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
+ }
+ }
+}
+
+const Vector4& Visual::Base::GetMixColor() const
+{
+ return mImpl->mMixColor;
+}
+
Renderer Visual::Base::GetRenderer()
{
return mImpl->mRenderer;
}
+
+Property::Index Visual::Base::GetPropertyIndex( Property::Key key )
+{
+ Property::Index index = DevelHandle::GetPropertyIndex( mImpl->mRenderer, key );
+
+ if( index == Property::INVALID_INDEX )
+ {
+ // Is it a shader property?
+ Shader shader = mImpl->mRenderer.GetShader();
+ index = DevelHandle::GetPropertyIndex( shader, key );
+ if( index != Property::INVALID_INDEX )
+ {
+ // Yes - we should register it in the Renderer so it can be set / animated
+ // independently, as shaders are shared across multiple renderers.
+ std::string keyName;
+ Property::Index keyIndex( Property::INVALID_KEY );
+ if( key.type == Property::Key::INDEX )
+ {
+ keyName = shader.GetPropertyName( index );
+ keyIndex = key.indexKey;
+ }
+ else
+ {
+ keyName = key.stringKey;
+ // Leave keyIndex as INVALID_KEY - it can still be registered against the string key.
+ }
+ Property::Value value = shader.GetProperty( index );
+ index = DevelHandle::RegisterProperty( mImpl->mRenderer, keyIndex, keyName, value );
+ }
+ }
+ return index;
+}
+
+void Visual::Base::SetupTransition(
+ Dali::Animation& transition,
+ Internal::TransitionData::Animator& animator,
+ Property::Index index )
+{
+ if( index != Property::INVALID_INDEX )
+ {
+ if( mImpl->mRenderer )
+ {
+ if( animator.animate == false )
+ {
+ mImpl->mRenderer.SetProperty( index, animator.targetValue );
+ }
+ else
+ {
+ if( animator.initialValue.GetType() != Property::NONE )
+ {
+ mImpl->mRenderer.SetProperty( index, animator.initialValue );
+ }
+
+ if( ! transition )
+ {
+ transition = Dali::Animation::New( 0.1f );
+ }
+
+ transition.AnimateTo( Property( mImpl->mRenderer, index ),
+ animator.targetValue,
+ animator.alphaFunction,
+ TimePeriod( animator.timePeriodDelay,
+ animator.timePeriodDuration ) );
+ }
+ }
+ }
+}
+
+void Visual::Base::AnimateProperty(
+ Dali::Animation& transition,
+ Internal::TransitionData::Animator& animator )
+{
+#if defined(DEBUG_ENABLED)
+ {
+ std::ostringstream oss;
+ oss << "Visual::Base::AnimateProperty(Visual:" << mImpl->mName << " Property:" << animator.propertyKey << " Target: " << animator.targetValue << std::endl;
+ DALI_LOG_INFO( gVisualBaseLogFilter, Debug::General, oss.str().c_str() );
+ }
+#endif
+
+ Property::Index index = Property::INVALID_INDEX;
+
+ bool isMixColor = false;
+ bool isMixColorOpaque = true;
+
+ // Get the property index
+ if( animator.propertyKey == Toolkit::DevelVisual::Property::MIX_COLOR ||
+ animator.propertyKey == MIX_COLOR )
+ {
+ isMixColor = true;
+ index = mImpl->mMixColorIndex;
+
+ Vector4 initialColor;
+ if( animator.initialValue.Get(initialColor) ) // if there is an initial color, test it
+ {
+ isMixColorOpaque = initialColor.a >= 1.0f;
+ }
+ else
+ {
+ isMixColorOpaque = mImpl->mMixColor.a >= 1.0f; // otherwise, test the current color
+ }
+ }
+ else if( mImpl->mRenderer )
+ {
+ index = GetPropertyIndex( animator.propertyKey );
+ }
+
+ // Set target value into data store
+ if( animator.targetValue.GetType() != Property::NONE )
+ {
+ if( isMixColor )
+ {
+ animator.targetValue.Get( mImpl->mMixColor );
+ }
+ else
+ {
+ // Note: there may be several of these calls if more than one
+ // transform property is animated.
+ Property::Map map;
+ if( animator.propertyKey.type == Property::Key::INDEX )
+ {
+ map.Add( animator.propertyKey.indexKey, animator.targetValue );
+ }
+ else
+ {
+ map.Add( animator.propertyKey.stringKey, animator.targetValue );
+ }
+
+ mImpl->mTransform.UpdatePropertyMap( map );
+ }
+ }
+
+ if( index != Property::INVALID_INDEX )
+ {
+ SetupTransition( transition, animator, index );
+
+ // For mix color, ensure the blend mode is on if the initial or final values are not opaque,
+ // and that it is turned off after the animation ends if the final value is opaque
+ if( isMixColor && (!isMixColorOpaque || mImpl->mMixColor.a < 1.0f) )
+ {
+ mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
+
+ if( animator.animate == 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
*/
// EXTERNAL INCLUDES
+#include <dali/public-api/animation/animation.h>
#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/images/image-operations.h>
#include <dali/public-api/object/base-object.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
-#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
+#include <dali-toolkit/internal/visuals/transition-data-impl.h>
+#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
namespace Dali
{
*/
Renderer GetRenderer();
+ /**
+ * Sets the mix color of the visual.
+ * @param[in] mixColor The new mix color
+ */
+ void SetMixColor( const Vector4& color );
+
+ /**
+ * Gets the mix color of the visual.
+ * @return The mix color
+ */
+ const Vector4& GetMixColor() const;
+
+ /**
+ * Animate the property if it exists in the visual or renderer.
+ *
+ * If it's a visual property such as mix color or a transform property,
+ * saves the target value to the local data.
+ *
+ * If the visual isn't staged (i.e. it doesn't have a renderer),
+ * then this will not add an animation.
+ *
+ * @param[in] transition The animation to create or attach to
+ * @param[in] animator The animation parameters of the property.
+ */
+ void AnimateProperty( Dali::Animation& transition,
+ Internal::TransitionData::Animator& animator );
+
protected:
/**
private:
+ /**
+ * Register the mix color uniform on the Renderer and store the property index.
+ * Note, this is not used by Color or Primitive Visuals, which will use their
+ * own property index.
+ */
+ void RegisterMixColor();
+
+ /**
+ * Find the matching property on the renderer or shader. If it's a shader
+ * property, register it on the renderer in order to animate it for this
+ * visual independently.
+ * @param[in] key The key to match.
+ * @return the matching index, or INVALID_INDEX if it's not found
+ */
+ Property::Index GetPropertyIndex( Property::Key key );
+
+ /**
+ * Set up the transition. If no animation is required, then
+ * transition will be untouched.
+ *
+ * @param[in] transition The transition to use or set up.
+ * @param[in] animator The animation data to use
+ * @param[in] index The property index on the renderer to animate
+ */
+ void SetupTransition( Dali::Animation& transition,
+ Internal::TransitionData::Animator& animator,
+ Property::Index index );
+
+ /**
+ * When a mix color animation has finished, ensure the blend mode is set back
+ * to the right value for the target opacity.
+ */
+ void OnMixColorFinished( Animation& animation );
+
// Undefined
Base( const Visual::Base& visual );
IMAGE_SHADER_ATLAS_CUSTOM_WRAP,
NINE_PATCH_SHADER,
SVG_SHADER,
+ TEXT_SHADER,
WIREFRAME_SHADER,
SHADER_TYPE_MAX = WIREFRAME_SHADER
};
const char * const CUSTOM_SHADER_HINTS( "hints" );
// Transform
-extern const char * const TRANSFORM( "transform" );
-extern const char * const SIZE( "size" );
-extern const char * const OFFSET( "offset" );
-extern const char * const OFFSET_SIZE_MODE( "offsetSizeMode" );
-extern const char * const ORIGIN( "origin" );
-extern const char * const ANCHOR_POINT( "anchorPoint" );
+const char * const TRANSFORM( "transform" );
+const char * const SIZE( "size" );
+const char * const OFFSET( "offset" );
+const char * const OFFSET_SIZE_MODE( "offsetSizeMode" );
+const char * const ORIGIN( "origin" );
+const char * const ANCHOR_POINT( "anchorPoint" );
// Premultipled alpha
-extern const char * const PREMULTIPLIED_ALPHA( "premultipliedAlpha" );
+const char * const PREMULTIPLIED_ALPHA( "premultipliedAlpha" );
+
+// Mix color
+const char * const MIX_COLOR( "mixColor" );
// Image visual
const char * const IMAGE_URL_NAME( "url" );
// Premultiplied alpha
extern const char * const PREMULTIPLIED_ALPHA;
+// Mix color
+extern const char * const MIX_COLOR;
+
// Image visual
extern const char * const IMAGE_URL_NAME;
extern const char * const ATLAS_RECT_UNIFORM_NAME;
const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(\n
uniform lowp vec4 uColor;\n
+uniform lowp vec4 mixColor;\n
\n
void main()\n
{\n
- gl_FragColor = uColor;\n
+ gl_FragColor = uColor*mixColor;\n
}\n
);
void WireframeVisual::DoSetProperties( const Property::Map& propertyMap )
{
- // no properties supported at the moment
+ Property::Value* mixValue = propertyMap.Find( Toolkit::DevelVisual::Property::MIX_COLOR, MIX_COLOR );
+ if( mixValue )
+ {
+ Vector4 mixColor;
+ mixValue->Get( mixColor );
+ SetMixColor( mixColor );
+ }
}
void WireframeVisual::DoSetOnStage( Actor& actor )
#include <dali-toolkit/internal/styling/style-manager-impl.h>
#include <dali-toolkit/internal/visuals/color/color-visual.h>
#include <dali-toolkit/internal/visuals/transition-data-impl.h>
+#include <dali-toolkit/internal/visuals/visual-string-constants.h>
#include <dali-toolkit/devel-api/align-enums.h>
#include <dali-toolkit/internal/controls/tooltip/tooltip.h>
Toolkit::Visual::Base visual;
bool enabled;
- RegisteredVisual( Property::Index aIndex, Toolkit::Visual::Base &aVisual, bool aEnabled) :
- index(aIndex), visual(aVisual), enabled(aEnabled) {}
-};
-
-struct HandleIndex
-{
- Handle handle; ///< a handle to the target object
- Property::Index index; ///< The index of a property provided by the referenced object
-
- HandleIndex( )
- : handle(),
- index( Property::INVALID_INDEX )
- {
- }
-
- HandleIndex( Handle& handle, Property::Index index )
- : handle( handle ),
- index( index )
+ RegisteredVisual( Property::Index aIndex, Toolkit::Visual::Base &aVisual, bool aEnabled)
+ : index(aIndex), visual(aVisual), enabled(aEnabled)
{
}
};
-
typedef Dali::OwnerContainer< RegisteredVisual* > RegisteredVisualContainer;
/**
return false;
}
-HandleIndex GetVisualProperty(
- Internal::Control& controlImpl,
+Toolkit::Visual::Base GetVisualByName(
RegisteredVisualContainer& visuals,
- const std::string& visualName,
- Property::Key propertyKey )
+ const std::string& visualName )
{
-#if defined(DEBUG_ENABLED)
- std::ostringstream oss;
- oss << "Control::GetVisualProperty(" << visualName << ", " << propertyKey << ")" << std::endl;
- DALI_LOG_INFO( gLogFilter, Debug::General, oss.str().c_str() );
-#endif
+ Toolkit::Visual::Base visualHandle;
- // Find visualName in the control
RegisteredVisualContainer::Iterator iter;
for ( iter = visuals.Begin(); iter != visuals.End(); iter++ )
{
Toolkit::Visual::Base visual = (*iter)->visual;
if( visual && visual.GetName() == visualName )
{
- Internal::Visual::Base& visualImpl = GetImplementation(visual);
- Renderer renderer = visualImpl.GetRenderer();
- if( renderer )
- {
- Property::Index index = DevelHandle::GetPropertyIndex( renderer, propertyKey );
- if( index != Property::INVALID_INDEX )
- {
- return HandleIndex( renderer, index );
- }
- }
+ visualHandle = visual;
+ break;
}
}
-
- std::ostringstream noRenderers;
- noRenderers << propertyKey;
- DALI_LOG_WARNING( "Control::GetVisualProperty(%s, %s) No renderers\n", visualName.c_str(), noRenderers.str().c_str() );
- Handle handle;
- return HandleIndex( handle, Property::INVALID_INDEX );
+ return visualHandle;
}
void SetDefaultTransform( Property::Map& propertyMap )
{
Toolkit::GetImplementation(visual).SetOnStage( self );
}
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::RegisterVisual number of registered visuals(%d)\n", mImpl->mVisuals.Size() );
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::RegisterVisual() Registered %s(%d), enabled:%s\n", visual.GetName().c_str(), index, enabled?"T":"F" );
}
void Control::UnregisterVisual( Property::Index index )
{
if ( (*iter)->enabled == enable )
{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Visual Already enabled set (%s) \n", enable?"enabled":"disabled");
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Visual %s(%d) already %s\n", (*iter)->visual.GetName().c_str(), index, enable?"enabled":"disabled");
return;
}
{
if ( enable )
{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Setting Visual(%d) on stage \n", index );
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Setting %s(%d) on stage \n", (*iter)->visual.GetName().c_str(), index );
Toolkit::GetImplementation((*iter)->visual).SetOnStage( parentActor );
}
else
{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Setting Visual(%d) off stage \n", index );
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Setting %s(%d) off stage \n", (*iter)->visual.GetName().c_str(), index );
Toolkit::GetImplementation((*iter)->visual).SetOffStage( parentActor ); // No need to call if control not staged.
}
}
iter != end; ++iter )
{
TransitionData::Animator* animator = (*iter);
- HandleIndex handleIndex;
- // Attempt to find the object name as a child actor
- Actor child = Self().FindChildByName( animator->objectName );
- if( child )
+ Toolkit::Visual::Base visual = GetVisualByName( mImpl->mVisuals, animator->objectName );
+
+ if( visual )
{
- Property::Index propertyIndex = DevelHandle::GetPropertyIndex( child, animator->propertyKey );
- handleIndex = HandleIndex( child, propertyIndex );
+ Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
+ visualImpl.AnimateProperty( transition, *animator );
}
else
{
- handleIndex = GetVisualProperty( *this, mImpl->mVisuals,
- animator->objectName,
- animator->propertyKey );
- }
-
- if( handleIndex.handle && handleIndex.index != Property::INVALID_INDEX )
- {
- if( animator->animate == false )
- {
- if( animator->targetValue.GetType() != Property::NONE )
- {
- handleIndex.handle.SetProperty( handleIndex.index, animator->targetValue );
- }
- }
- else
+ // Otherwise, try any actor children of control (Including the control)
+ Actor child = Self().FindChildByName( animator->objectName );
+ if( child )
{
- if( animator->initialValue.GetType() != Property::NONE )
+ Property::Index propertyIndex = DevelHandle::GetPropertyIndex( child, animator->propertyKey );
+ if( propertyIndex != Property::INVALID_INDEX )
{
- handleIndex.handle.SetProperty( handleIndex.index, animator->initialValue );
- }
-
- if( ! transition )
- {
- // Create an animation with a default .1 second duration - the animators
- // will automatically force it to the 'right' duration.
- transition = Dali::Animation::New( 0.1f );
+ if( animator->animate == false )
+ {
+ if( animator->targetValue.GetType() != Property::NONE )
+ {
+ child.SetProperty( propertyIndex, animator->targetValue );
+ }
+ }
+ else // animate the property
+ {
+ if( animator->initialValue.GetType() != Property::NONE )
+ {
+ child.SetProperty( propertyIndex, animator->initialValue );
+ }
+
+ if( ! transition )
+ {
+ transition = Dali::Animation::New( 0.1f );
+ }
+
+ transition.AnimateTo( Property( child, propertyIndex ),
+ animator->targetValue,
+ animator->alphaFunction,
+ TimePeriod( animator->timePeriodDelay,
+ animator->timePeriodDuration ) );
+ }
}
-
- transition.AnimateTo( Property( handleIndex.handle, handleIndex.index ),
- animator->targetValue,
- animator->alphaFunction,
- TimePeriod( animator->timePeriodDelay,
- animator->timePeriodDuration ) );
}
}
}
/**
* @brief Create a transition effect on the control.
*
+ * Only generates an animation if the properties described in the transition
+ * data are staged (e.g. the visual is Enabled and the control is on stage).
+ * Otherwise the target values are stored, and will get set onto the properties
+ * when the visual is next staged.
+ *
* @SINCE_1_2.12
*
* @param[in] transitionData The transition data describing the effect to create
{
position = WrapInDomain(position, mDomain.min, mDomain.max);
}
- page = std::max(static_cast<double>(0.0f), floor((position - mDomain.min) / mSpacing + 0.5f));
+ page = std::max(static_cast<double>(0.0f), static_cast<double>(floor((position - mDomain.min) / mSpacing + 0.5f)));
if(wrap)
{
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 21;
+const unsigned int TOOLKIT_MICRO_VERSION = 22;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
/**
* @brief Move the focus to prev focused actor
*
- * @SINCE_1_2.17
+ * @SINCE_1_2.19
*/
void MoveFocusBackward();
Name: dali-addon
Summary: DALi module for Node.JS
-Version: 1.2.21
+Version: 1.2.22
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.2.21
+Version: 1.2.22
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-2-Clause and MIT
all-local: libNDalic.so NDali.dll
-libNDalic.so: automatic/cpp/dali_wrap.o manual/cpp/keyboard_focus_manager_wrap.o manual/cpp/view-wrapper-impl-wrap.o manual/cpp/callbackbase_wrap.o
- g++ -shared automatic/cpp/dali_wrap.o manual/cpp/keyboard_focus_manager_wrap.o manual/cpp/view-wrapper-impl-wrap.o manual/cpp/callbackbase_wrap.o -o libNDalic.so $(DALICORE_LIBS) $(DALIADAPTOR_LIBS) $(DALITOOLKIT_LIBS)
+libNDalic.so: automatic/cpp/dali_wrap.o manual/cpp/keyboard_focus_manager_wrap.o manual/cpp/view-wrapper-impl-wrap.o manual/cpp/callbackbase_wrap.o manual/cpp/devel-property-wrap.o
+ g++ -shared automatic/cpp/dali_wrap.o manual/cpp/keyboard_focus_manager_wrap.o manual/cpp/view-wrapper-impl-wrap.o manual/cpp/callbackbase_wrap.o manual/cpp/devel-property-wrap.o -o libNDalic.so $(DALICORE_LIBS) $(DALIADAPTOR_LIBS) $(DALITOOLKIT_LIBS)
automatic/cpp/dali_wrap.o: $(BUILT_SOURCES)
g++ -c -fpic $(CXXFLAGS) $(DALICORE_CFLAGS) $(DALIADAPTOR_CFLAGS) $(DALITOOLKIT_CFLAGS) automatic/cpp/dali_wrap.cpp -o automatic/cpp/dali_wrap.o
manual/cpp/callbackbase_wrap.o: $(BUILT_SOURCES)
g++ -c -fpic $(CXXFLAGS) $(DALICORE_CFLAGS) $(DALIADAPTOR_CFLAGS) $(DALITOOLKIT_CFLAGS) manual/cpp/callbackbase_wrap.cpp -o manual/cpp/callbackbase_wrap.o
+manual/cpp/devel-property-wrap.o: $(BUILT_SOURCES)
+ g++ -c -fpic $(CXXFLAGS) $(DALICORE_CFLAGS) $(DALIADAPTOR_CFLAGS) $(DALITOOLKIT_CFLAGS) manual/cpp/devel-property-wrap.cpp -o manual/cpp/devel-property-wrap.o
+
NDali.dll: $(BUILT_SOURCES)
$(MCS) -nologo -target:library -out:NDali.dll automatic/csharp/*.cs manual/csharp/*.cs views/*.cs
%include name-changed.i
%include property-value.i
%include dali-operator.i
+%include devel-properties.i
+
%include dali-core.i
%include dali-adaptor.i
%include dali-toolkit.i
--- /dev/null
+/*
+ * Copyright (c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%typemap(cscode) Dali::Actor::Property %{
+ public static readonly int BATCH_PARENT = NDalicManualPINVOKE.Actor_Property_BATCH_PARENT_get();
+ public static readonly int SIBLING_ORDER = NDalicManualPINVOKE.Actor_Property_SIBLING_ORDER_get();
+%}
+
+%typemap(cscode) Dali::Renderer::Property %{
+ public static readonly int BATCHING_ENABLED = NDalicManualPINVOKE.Renderer_Property_BATCHING_ENABLED_get();
+%}
+
+%typemap(cscode) Dali::Renderer %{
+ public bool BatchingEnabled
+ {
+ get
+ {
+ bool temp = false;
+ GetProperty( Renderer.Property.BATCHING_ENABLED).Get( ref temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( Renderer.Property.BATCHING_ENABLED, new Dali.Property.Value( value ) );
+ }
+ }
+%}
+
+%typemap(cscode) Dali::Toolkit::Control::Property %{
+ public static readonly int TOOLTIP = NDalicManualPINVOKE.View_Property_TOOLTIP_get();
+%}
+
+%typemap(cscode) Dali::Toolkit::ItemView::Property %{
+ public static readonly int LAYOUT = NDalicManualPINVOKE.ItemView_Property_LAYOUT_get();
+%}
+
+%typemap(cscode) Dali::Toolkit::ItemView %{
+ public Dali.Property.Array Layout
+ {
+ get
+ {
+ Dali.Property.Array temp = new Dali.Property.Array();
+ GetProperty( ItemView.Property.LAYOUT).Get( temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( ItemView.Property.LAYOUT, new Dali.Property.Value( value ) );
+ }
+ }
+%}
+
+%typemap(cscode) Dali::Toolkit::Button::Property %{
+ public static readonly int UNSELECTED_VISUAL = NDalicManualPINVOKE.Button_Property_UNSELECTED_VISUAL_get();
+ public static readonly int SELECTED_VISUAL = NDalicManualPINVOKE.Button_Property_SELECTED_VISUAL_get();
+ public static readonly int DISABLED_SELECTED_VISUAL = NDalicManualPINVOKE.Button_Property_DISABLED_SELECTED_VISUAL_get();
+ public static readonly int DISABLED_UNSELECTED_VISUAL = NDalicManualPINVOKE.Button_Property_DISABLED_UNSELECTED_VISUAL_get();
+ public static readonly int UNSELECTED_BACKGROUND_VISUAL = NDalicManualPINVOKE.Button_Property_UNSELECTED_BACKGROUND_VISUAL_get();
+ public static readonly int SELECTED_BACKGROUND_VISUAL = NDalicManualPINVOKE.Button_Property_SELECTED_BACKGROUND_VISUAL_get();
+ public static readonly int DISABLED_UNSELECTED_BACKGROUND_VISUAL = NDalicManualPINVOKE.Button_Property_DISABLED_UNSELECTED_BACKGROUND_VISUAL_get();
+ public static readonly int DISABLED_SELECTED_BACKGROUND_VISUAL = NDalicManualPINVOKE.Button_Property_DISABLED_SELECTED_BACKGROUND_VISUAL_get();
+ public static readonly int LABEL_RELATIVE_ALIGNMENT = NDalicManualPINVOKE.Button_Property_LABEL_RELATIVE_ALIGNMENT_get();
+ public static readonly int LABEL_PADDING = NDalicManualPINVOKE.Button_Property_LABEL_PADDING_get();
+ public static readonly int VISUAL_PADDING = NDalicManualPINVOKE.Button_Property_VISUAL_PADDING_get();
+%}
+
}
}
+ public bool BatchParent
+ {
+ get
+ {
+ bool temp = false;
+ GetProperty( Actor.Property.BATCH_PARENT).Get( ref temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( Actor.Property.BATCH_PARENT, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public int SiblingOrder
+ {
+ get
+ {
+ int temp = 0;
+ GetProperty( Actor.Property.SIBLING_ORDER).Get( ref temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( Actor.Property.SIBLING_ORDER, new Dali.Property.Value( value ) );
+ }
+ }
+
public void Show()
{
SetVisible(true);
{
SetVisible(false);
}
-
%}
%enddef
return ret;
}
+ public Dali.Property.Map UnselectedVisual
+ {
+ get
+ {
+ Dali.Property.Map temp = new Dali.Property.Map();
+ GetProperty( Button.Property.UNSELECTED_VISUAL).Get( temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( Button.Property.UNSELECTED_VISUAL, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public Dali.Property.Map SelectedVisual
+ {
+ get
+ {
+ Dali.Property.Map temp = new Dali.Property.Map();
+ GetProperty( Button.Property.SELECTED_VISUAL).Get( temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( Button.Property.SELECTED_VISUAL, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public Dali.Property.Map DisabledSelectedVisual
+ {
+ get
+ {
+ Dali.Property.Map temp = new Dali.Property.Map();
+ GetProperty( Button.Property.DISABLED_SELECTED_VISUAL).Get( temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( Button.Property.DISABLED_SELECTED_VISUAL, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public Dali.Property.Map DisabledUnselectedVisual
+ {
+ get
+ {
+ Dali.Property.Map temp = new Dali.Property.Map();
+ GetProperty( Button.Property.DISABLED_UNSELECTED_VISUAL).Get( temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( Button.Property.DISABLED_UNSELECTED_VISUAL, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public Dali.Property.Map UnselectedBackgroundVisual
+ {
+ get
+ {
+ Dali.Property.Map temp = new Dali.Property.Map();
+ GetProperty( Button.Property.UNSELECTED_BACKGROUND_VISUAL).Get( temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( Button.Property.UNSELECTED_BACKGROUND_VISUAL, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public Dali.Property.Map SelectedBackgroundVisual
+ {
+ get
+ {
+ Dali.Property.Map temp = new Dali.Property.Map();
+ GetProperty( Button.Property.SELECTED_BACKGROUND_VISUAL).Get( temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( Button.Property.SELECTED_BACKGROUND_VISUAL, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public Dali.Property.Map DisabledUnselectedBackgroundVisual
+ {
+ get
+ {
+ Dali.Property.Map temp = new Dali.Property.Map();
+ GetProperty( Button.Property.DISABLED_UNSELECTED_BACKGROUND_VISUAL).Get( temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( Button.Property.DISABLED_UNSELECTED_BACKGROUND_VISUAL, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public Dali.Property.Map DisabledSelectedBackgroundVisual
+ {
+ get
+ {
+ Dali.Property.Map temp = new Dali.Property.Map();
+ GetProperty( Button.Property.DISABLED_SELECTED_BACKGROUND_VISUAL).Get( temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( Button.Property.DISABLED_SELECTED_BACKGROUND_VISUAL, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public string LabelRelativeAlignment
+ {
+ get
+ {
+ string temp;
+ GetProperty( Button.Property.LABEL_RELATIVE_ALIGNMENT).Get( out temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( Button.Property.LABEL_RELATIVE_ALIGNMENT, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public Vector4 LabelPadding
+ {
+ get
+ {
+ Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
+ GetProperty( Button.Property.LABEL_PADDING).Get( temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( Button.Property.LABEL_PADDING, new Dali.Property.Value( value ) );
+ }
+ }
+
+ public Vector4 VisualPadding
+ {
+ get
+ {
+ Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
+ GetProperty( Button.Property.VISUAL_PADDING).Get( temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( Button.Property.VISUAL_PADDING, new Dali.Property.Value( value ) );
+ }
+ }
%}
%enddef
%define CONTROL_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
%typemap(cscode) NameSpace::ClassName %{
-
/**
* @brief Event arguments that passed via KeyInputFocusGained signal
*
return ret;
}
- %}
-
- %enddef
+ public Dali.Property.Map Tooltip
+ {
+ get
+ {
+ Dali.Property.Map temp = new Dali.Property.Map();
+ GetProperty( View.Property.TOOLTIP).Get( temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( View.Property.TOOLTIP, new Dali.Property.Value( value ) );
+ }
+ }
+ %}
+%enddef
%define DALI_CONTROL_EVENTHANDLER_PARAM( NameSpace, ClassName)
CONTROL_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
CONTROL_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
- %enddef
+%enddef
- namespace Dali
+namespace Dali
{
DALI_CONTROL_EVENTHANDLER_PARAM( Dali::Toolkit, Control);
}
--- /dev/null
+/*
+ * Copyright (c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef CSHARP_DEVEL_PROPERTY
+#define CSHARP_DEVEL_PROPERTY
+#endif
+
+#include "common.h"
+
+#include <dali/devel-api/actors/actor-devel.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/devel-api/controls/scrollable/item-view/item-view-devel.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SWIGEXPORT int SWIGSTDCALL CSharp_Actor_Property_BATCH_PARENT_get() {
+ int jresult ;
+ int result;
+
+ result = (int)Dali::DevelActor::Property::BATCH_PARENT;
+ jresult = (int)result;
+ return jresult;
+}
+
+SWIGEXPORT int SWIGSTDCALL CSharp_Actor_Property_SIBLING_ORDER_get() {
+ int jresult ;
+ int result;
+
+ result = (int)Dali::DevelActor::Property::SIBLING_ORDER;
+ jresult = (int)result;
+ return jresult;
+}
+
+SWIGEXPORT int SWIGSTDCALL CSharp_Renderer_Property_BATCHING_ENABLED_get() {
+ int jresult ;
+ int result;
+
+ result = (int)Dali::DevelRenderer::Property::BATCHING_ENABLED;
+ jresult = (int)result;
+ return jresult;
+}
+
+SWIGEXPORT int SWIGSTDCALL CSharp_View_Property_TOOLTIP_get() {
+ int jresult ;
+ int result;
+
+ result = (int)Dali::Toolkit::DevelControl::Property::TOOLTIP;
+ jresult = (int)result;
+ return jresult;
+}
+
+SWIGEXPORT int SWIGSTDCALL CSharp_ItemView_Property_LAYOUT_get() {
+ int jresult ;
+ int result;
+
+ result = (int)Dali::Toolkit::DevelItemView::Property::LAYOUT;
+ jresult = (int)result;
+ return jresult;
+}
+
+SWIGEXPORT int SWIGSTDCALL CSharp_Button_Property_UNSELECTED_VISUAL_get() {
+ int jresult ;
+ int result;
+
+ result = (int)Dali::Toolkit::DevelButton::Property::UNSELECTED_VISUAL;
+ jresult = (int)result;
+ return jresult;
+}
+
+SWIGEXPORT int SWIGSTDCALL CSharp_Button_Property_SELECTED_VISUAL_get() {
+ int jresult ;
+ int result;
+
+ result = (int)Dali::Toolkit::DevelButton::Property::SELECTED_VISUAL;
+ jresult = (int)result;
+ return jresult;
+}
+
+SWIGEXPORT int SWIGSTDCALL CSharp_Button_Property_DISABLED_SELECTED_VISUAL_get() {
+ int jresult ;
+ int result;
+
+ result = (int)Dali::Toolkit::DevelButton::Property::DISABLED_SELECTED_VISUAL;
+ jresult = (int)result;
+ return jresult;
+}
+
+SWIGEXPORT int SWIGSTDCALL CSharp_Button_Property_DISABLED_UNSELECTED_VISUAL_get() {
+ int jresult ;
+ int result;
+
+ result = (int)Dali::Toolkit::DevelButton::Property::DISABLED_UNSELECTED_VISUAL;
+ jresult = (int)result;
+ return jresult;
+}
+
+SWIGEXPORT int SWIGSTDCALL CSharp_Button_Property_UNSELECTED_BACKGROUND_VISUAL_get() {
+ int jresult ;
+ int result;
+
+ result = (int)Dali::Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL;
+ jresult = (int)result;
+ return jresult;
+}
+
+SWIGEXPORT int SWIGSTDCALL CSharp_Button_Property_SELECTED_BACKGROUND_VISUAL_get() {
+ int jresult ;
+ int result;
+
+ result = (int)Dali::Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL;
+ jresult = (int)result;
+ return jresult;
+}
+
+SWIGEXPORT int SWIGSTDCALL CSharp_Button_Property_DISABLED_UNSELECTED_BACKGROUND_VISUAL_get() {
+ int jresult ;
+ int result;
+
+ result = (int)Dali::Toolkit::DevelButton::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL;
+ jresult = (int)result;
+ return jresult;
+}
+
+SWIGEXPORT int SWIGSTDCALL CSharp_Button_Property_DISABLED_SELECTED_BACKGROUND_VISUAL_get() {
+ int jresult ;
+ int result;
+
+ result = (int)Dali::Toolkit::DevelButton::Property::DISABLED_SELECTED_BACKGROUND_VISUAL;
+ jresult = (int)result;
+ return jresult;
+}
+
+SWIGEXPORT int SWIGSTDCALL CSharp_Button_Property_LABEL_RELATIVE_ALIGNMENT_get() {
+ int jresult ;
+ int result;
+
+ result = (int)Dali::Toolkit::DevelButton::Property::LABEL_RELATIVE_ALIGNMENT;
+ jresult = (int)result;
+ return jresult;
+}
+
+SWIGEXPORT int SWIGSTDCALL CSharp_Button_Property_LABEL_PADDING_get() {
+ int jresult ;
+ int result;
+
+ result = (int)Dali::Toolkit::DevelButton::Property::LABEL_PADDING;
+ jresult = (int)result;
+ return jresult;
+}
+
+SWIGEXPORT int SWIGSTDCALL CSharp_Button_Property_VISUAL_PADDING_get() {
+ int jresult ;
+ int result;
+
+ result = (int)Dali::Toolkit::DevelButton::Property::VISUAL_PADDING;
+ jresult = (int)result;
+ return jresult;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
[global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Dali_MakeCallback")]
public static extern global::System.IntPtr MakeCallback(global::System.Runtime.InteropServices.HandleRef jarg1);
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Actor_Property_BATCH_PARENT_get")]
+ public static extern int Actor_Property_BATCH_PARENT_get();
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Actor_Property_SIBLING_ORDER_get")]
+ public static extern int Actor_Property_SIBLING_ORDER_get();
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Renderer_Property_BATCHING_ENABLED_get")]
+ public static extern int Renderer_Property_BATCHING_ENABLED_get();
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_View_Property_TOOLTIP_get")]
+ public static extern int View_Property_TOOLTIP_get();
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_ItemView_Property_LAYOUT_get")]
+ public static extern int ItemView_Property_LAYOUT_get();
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Button_Property_UNSELECTED_VISUAL_get")]
+ public static extern int Button_Property_UNSELECTED_VISUAL_get();
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Button_Property_SELECTED_VISUAL_get")]
+ public static extern int Button_Property_SELECTED_VISUAL_get();
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Button_Property_DISABLED_SELECTED_VISUAL_get")]
+ public static extern int Button_Property_DISABLED_SELECTED_VISUAL_get();
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Button_Property_DISABLED_UNSELECTED_VISUAL_get")]
+ public static extern int Button_Property_DISABLED_UNSELECTED_VISUAL_get();
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Button_Property_UNSELECTED_BACKGROUND_VISUAL_get")]
+ public static extern int Button_Property_UNSELECTED_BACKGROUND_VISUAL_get();
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Button_Property_SELECTED_BACKGROUND_VISUAL_get")]
+ public static extern int Button_Property_SELECTED_BACKGROUND_VISUAL_get();
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Button_Property_DISABLED_UNSELECTED_BACKGROUND_VISUAL_get")]
+ public static extern int Button_Property_DISABLED_UNSELECTED_BACKGROUND_VISUAL_get();
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Button_Property_DISABLED_SELECTED_BACKGROUND_VISUAL_get")]
+ public static extern int Button_Property_DISABLED_SELECTED_BACKGROUND_VISUAL_get();
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Button_Property_LABEL_RELATIVE_ALIGNMENT_get")]
+ public static extern int Button_Property_LABEL_RELATIVE_ALIGNMENT_get();
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Button_Property_LABEL_PADDING_get")]
+ public static extern int Button_Property_LABEL_PADDING_get();
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Button_Property_VISUAL_PADDING_get")]
+ public static extern int Button_Property_VISUAL_PADDING_get();
}
}