Commit f0916c53adcd3815fc6ca7f7bb6562b7db5ba520
[dali_1.0.39] Merge branch 'tizen'
Change-Id: I50aa9e717979370e80fb0312e68d4ec9c7f843ae
Showing
30 changed files
with
351 additions
and
273 deletions
com.samsung.dali-demo.xml
| @@ -85,6 +85,9 @@ | @@ -85,6 +85,9 @@ | ||
| 85 | <ui-application appid="text-field.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-field.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 85 | <ui-application appid="text-field.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-field.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 86 | <label>Text Label</label> | 86 | <label>Text Label</label> |
| 87 | </ui-application> | 87 | </ui-application> |
| 88 | + <ui-application appid="text-message-field.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-message-field.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ||
| 89 | + <label>Text Label</label> | ||
| 90 | + </ui-application> | ||
| 88 | <ui-application appid="logging.example" exec="/usr/apps/com.samsung.dali-demo/bin/logging.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 91 | <ui-application appid="logging.example" exec="/usr/apps/com.samsung.dali-demo/bin/logging.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 89 | <label>Logging</label> | 92 | <label>Logging</label> |
| 90 | </ui-application> | 93 | </ui-application> |
demo/dali-table-view.cpp
| @@ -123,21 +123,21 @@ const float IMAGE_BORDER_BOTTOM = IMAGE_BORDER_LEFT; | @@ -123,21 +123,21 @@ const float IMAGE_BORDER_BOTTOM = IMAGE_BORDER_LEFT; | ||
| 123 | struct AnimateBubbleConstraint | 123 | struct AnimateBubbleConstraint |
| 124 | { | 124 | { |
| 125 | public: | 125 | public: |
| 126 | - AnimateBubbleConstraint( const Vector3& initialPos, float scale, float size ) | 126 | + AnimateBubbleConstraint( const Vector3& initialPos, float scale ) |
| 127 | : mInitialX( initialPos.x ), | 127 | : mInitialX( initialPos.x ), |
| 128 | - mScale( scale ), | ||
| 129 | - mShapeSize( size ) | 128 | + mScale( scale ) |
| 130 | { | 129 | { |
| 131 | } | 130 | } |
| 132 | 131 | ||
| 133 | void operator()( Vector3& position, const PropertyInputContainer& inputs ) | 132 | void operator()( Vector3& position, const PropertyInputContainer& inputs ) |
| 134 | { | 133 | { |
| 135 | const Vector3& parentSize = inputs[1]->GetVector3(); | 134 | const Vector3& parentSize = inputs[1]->GetVector3(); |
| 135 | + const Vector3& childSize = inputs[2]->GetVector3(); | ||
| 136 | 136 | ||
| 137 | // Wrap bubbles verically. | 137 | // Wrap bubbles verically. |
| 138 | - if( position.y + mShapeSize * 0.5f < -parentSize.y * 0.5f ) | 138 | + if( position.y + childSize.y * 0.5f < -parentSize.y * 0.5f ) |
| 139 | { | 139 | { |
| 140 | - position.y = parentSize.y * 0.5f + mShapeSize * 0.5f; | 140 | + position.y = parentSize.y * 0.5f + childSize.y * 0.5f; |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | // Bubbles X position moves parallax to horizontal | 143 | // Bubbles X position moves parallax to horizontal |
| @@ -267,7 +267,6 @@ void DaliTableView::Initialize( Application& application ) | @@ -267,7 +267,6 @@ void DaliTableView::Initialize( Application& application ) | ||
| 267 | 267 | ||
| 268 | // scrollview occupying the majority of the screen | 268 | // scrollview occupying the majority of the screen |
| 269 | mScrollView = ScrollView::New(); | 269 | mScrollView = ScrollView::New(); |
| 270 | - mScrollView.SetRelayoutEnabled( true ); | ||
| 271 | 270 | ||
| 272 | mScrollView.SetAnchorPoint( AnchorPoint::CENTER ); | 271 | mScrollView.SetAnchorPoint( AnchorPoint::CENTER ); |
| 273 | mScrollView.SetParentOrigin( ParentOrigin::CENTER ); | 272 | mScrollView.SetParentOrigin( ParentOrigin::CENTER ); |
| @@ -297,7 +296,6 @@ void DaliTableView::Initialize( Application& application ) | @@ -297,7 +296,6 @@ void DaliTableView::Initialize( Application& application ) | ||
| 297 | 296 | ||
| 298 | // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show | 297 | // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show |
| 299 | Actor bubbleContainer = Actor::New(); | 298 | Actor bubbleContainer = Actor::New(); |
| 300 | - bubbleContainer.SetRelayoutEnabled( true ); | ||
| 301 | bubbleContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 299 | bubbleContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 302 | bubbleContainer.SetAnchorPoint( AnchorPoint::CENTER ); | 300 | bubbleContainer.SetAnchorPoint( AnchorPoint::CENTER ); |
| 303 | bubbleContainer.SetParentOrigin( ParentOrigin::CENTER ); | 301 | bubbleContainer.SetParentOrigin( ParentOrigin::CENTER ); |
| @@ -324,17 +322,18 @@ void DaliTableView::Initialize( Application& application ) | @@ -324,17 +322,18 @@ void DaliTableView::Initialize( Application& application ) | ||
| 324 | // Remove constraints for inner cube effect | 322 | // Remove constraints for inner cube effect |
| 325 | ApplyCubeEffectToActors(); | 323 | ApplyCubeEffectToActors(); |
| 326 | 324 | ||
| 327 | - // Set initial orientation | ||
| 328 | - unsigned int degrees = application.GetOrientation().GetDegrees(); | ||
| 329 | - Rotate( degrees ); | ||
| 330 | - | ||
| 331 | Dali::Window winHandle = application.GetWindow(); | 325 | Dali::Window winHandle = application.GetWindow(); |
| 332 | winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT ); | 326 | winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT ); |
| 333 | winHandle.RemoveAvailableOrientation( Dali::Window::LANDSCAPE ); | 327 | winHandle.RemoveAvailableOrientation( Dali::Window::LANDSCAPE ); |
| 334 | winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT_INVERSE ); | 328 | winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT_INVERSE ); |
| 335 | winHandle.RemoveAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE ); | 329 | winHandle.RemoveAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE ); |
| 336 | 330 | ||
| 331 | + // Set initial orientation | ||
| 337 | Dali::Orientation orientation = winHandle.GetOrientation(); | 332 | Dali::Orientation orientation = winHandle.GetOrientation(); |
| 333 | + | ||
| 334 | + unsigned int degrees = winHandle.GetOrientation().GetDegrees(); | ||
| 335 | + Rotate( degrees ); | ||
| 336 | + | ||
| 338 | orientation.ChangedSignal().Connect( this, &DaliTableView::OrientationChanged ); | 337 | orientation.ChangedSignal().Connect( this, &DaliTableView::OrientationChanged ); |
| 339 | 338 | ||
| 340 | winHandle.ShowIndicator( Dali::Window::INVISIBLE ); | 339 | winHandle.ShowIndicator( Dali::Window::INVISIBLE ); |
| @@ -491,7 +490,6 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit | @@ -491,7 +490,6 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit | ||
| 491 | content.SetName( name ); | 490 | content.SetName( name ); |
| 492 | content.SetAnchorPoint( AnchorPoint::CENTER ); | 491 | content.SetAnchorPoint( AnchorPoint::CENTER ); |
| 493 | content.SetParentOrigin( ParentOrigin::CENTER ); | 492 | content.SetParentOrigin( ParentOrigin::CENTER ); |
| 494 | - content.SetRelayoutEnabled( true ); | ||
| 495 | content.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 493 | content.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 496 | content.SetSizeModeFactor( sizeMultiplier ); | 494 | content.SetSizeModeFactor( sizeMultiplier ); |
| 497 | 495 | ||
| @@ -745,19 +743,18 @@ void DaliTableView::InitialiseBackgroundActors( Actor actor ) | @@ -745,19 +743,18 @@ void DaliTableView::InitialiseBackgroundActors( Actor actor ) | ||
| 745 | { | 743 | { |
| 746 | Actor child = actor.GetChildAt( i ); | 744 | Actor child = actor.GetChildAt( i ); |
| 747 | 745 | ||
| 748 | - const Vector3 childSize = child.GetTargetSize(); | ||
| 749 | - | ||
| 750 | // Calculate a random position | 746 | // Calculate a random position |
| 751 | Vector3 childPos( Random::Range( -size.x * 0.5f * BACKGROUND_SPREAD_SCALE, size.x * 0.5f * BACKGROUND_SPREAD_SCALE ), | 747 | Vector3 childPos( Random::Range( -size.x * 0.5f * BACKGROUND_SPREAD_SCALE, size.x * 0.5f * BACKGROUND_SPREAD_SCALE ), |
| 752 | - Random::Range( -size.y * 0.5f - childSize.height, size.y * 0.5f + childSize.height ), | 748 | + Random::Range( -size.y, size.y ), |
| 753 | Random::Range( BUBBLE_MIN_Z, BUBBLE_MAX_Z ) ); | 749 | Random::Range( BUBBLE_MIN_Z, BUBBLE_MAX_Z ) ); |
| 754 | 750 | ||
| 755 | child.SetPosition( childPos ); | 751 | child.SetPosition( childPos ); |
| 756 | 752 | ||
| 757 | // Define bubble horizontal parallax and vertical wrapping | 753 | // Define bubble horizontal parallax and vertical wrapping |
| 758 | - Constraint animConstraint = Constraint::New < Vector3 > ( child, Actor::Property::POSITION, AnimateBubbleConstraint( childPos, Random::Range( -0.85f, 0.25f ), childSize.height ) ); | 754 | + Constraint animConstraint = Constraint::New < Vector3 > ( child, Actor::Property::POSITION, AnimateBubbleConstraint( childPos, Random::Range( -0.85f, 0.25f ) ) ); |
| 759 | animConstraint.AddSource( Source( mScrollView, ScrollView::Property::SCROLL_POSITION ) ); | 755 | animConstraint.AddSource( Source( mScrollView, ScrollView::Property::SCROLL_POSITION ) ); |
| 760 | animConstraint.AddSource( Dali::ParentSource( Dali::Actor::Property::SIZE ) ); | 756 | animConstraint.AddSource( Dali::ParentSource( Dali::Actor::Property::SIZE ) ); |
| 757 | + animConstraint.AddSource( Dali::LocalSource( Dali::Actor::Property::SIZE ) ); | ||
| 761 | animConstraint.Apply(); | 758 | animConstraint.Apply(); |
| 762 | 759 | ||
| 763 | // Kickoff animation | 760 | // Kickoff animation |
| @@ -778,7 +775,6 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage dis | @@ -778,7 +775,6 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage dis | ||
| 778 | Vector4 randColour( hue, hue * 0.5, 0.0f, Random::Range( 0.3f, 0.6f )); | 775 | Vector4 randColour( hue, hue * 0.5, 0.0f, Random::Range( 0.3f, 0.6f )); |
| 779 | 776 | ||
| 780 | ImageActor dfActor = ImageActor::New( distanceField ); | 777 | ImageActor dfActor = ImageActor::New( distanceField ); |
| 781 | - dfActor.SetRelayoutEnabled( false ); | ||
| 782 | dfActor.SetSize( Vector2( randSize, randSize ) ); | 778 | dfActor.SetSize( Vector2( randSize, randSize ) ); |
| 783 | dfActor.SetParentOrigin( ParentOrigin::CENTER ); | 779 | dfActor.SetParentOrigin( ParentOrigin::CENTER ); |
| 784 | 780 | ||
| @@ -884,7 +880,7 @@ void DaliTableView::PauseAnimation() | @@ -884,7 +880,7 @@ void DaliTableView::PauseAnimation() | ||
| 884 | { | 880 | { |
| 885 | Animation anim = *animIter; | 881 | Animation anim = *animIter; |
| 886 | 882 | ||
| 887 | - anim.Pause(); | 883 | + anim.Stop(); |
| 888 | } | 884 | } |
| 889 | 885 | ||
| 890 | mBackgroundAnimsPlaying = false; | 886 | mBackgroundAnimsPlaying = false; |
| @@ -1007,8 +1003,6 @@ void DaliTableView::OnLogoTapped( Dali::Actor actor, const Dali::TapGesture& tap | @@ -1007,8 +1003,6 @@ void DaliTableView::OnLogoTapped( Dali::Actor actor, const Dali::TapGesture& tap | ||
| 1007 | mVersionPopup.HideTail(); | 1003 | mVersionPopup.HideTail(); |
| 1008 | mVersionPopup.OutsideTouchedSignal().Connect( this, &DaliTableView::HideVersionPopup ); | 1004 | mVersionPopup.OutsideTouchedSignal().Connect( this, &DaliTableView::HideVersionPopup ); |
| 1009 | mVersionPopup.HiddenSignal().Connect( this, &DaliTableView::PopupHidden ); | 1005 | mVersionPopup.HiddenSignal().Connect( this, &DaliTableView::PopupHidden ); |
| 1010 | - | ||
| 1011 | - mVersionPopup.MarkDirtyForRelayout(); | ||
| 1012 | } | 1006 | } |
| 1013 | 1007 | ||
| 1014 | mVersionPopup.Show(); | 1008 | mVersionPopup.Show(); |
examples/animated-shapes/animated-shapes-example.cpp
| @@ -60,8 +60,7 @@ public: | @@ -60,8 +60,7 @@ public: | ||
| 60 | stage.Add( mView ); | 60 | stage.Add( mView ); |
| 61 | 61 | ||
| 62 | //Set background image for the view | 62 | //Set background image for the view |
| 63 | - ImageAttributes attributes; | ||
| 64 | - Image image = ResourceImage::New( BACKGROUND_IMAGE, attributes ); | 63 | + Image image = ResourceImage::New( BACKGROUND_IMAGE ); |
| 65 | 64 | ||
| 66 | 65 | ||
| 67 | Dali::ImageActor backgroundImageActor = Dali::ImageActor::New( image ); | 66 | Dali::ImageActor backgroundImageActor = Dali::ImageActor::New( image ); |
examples/blocks/blocks-example.cpp
| @@ -176,8 +176,8 @@ struct WobbleConstraint | @@ -176,8 +176,8 @@ struct WobbleConstraint | ||
| 176 | * | 176 | * |
| 177 | * @param[in] deviation The max. deviation of wobble effect in degrees. | 177 | * @param[in] deviation The max. deviation of wobble effect in degrees. |
| 178 | */ | 178 | */ |
| 179 | - WobbleConstraint(float deviation) | ||
| 180 | - : mDeviation(Radian(Degree(deviation))) | 179 | + WobbleConstraint( Degree deviation ) |
| 180 | + : mDeviation( deviation ) | ||
| 181 | { | 181 | { |
| 182 | 182 | ||
| 183 | } | 183 | } |
| @@ -196,7 +196,7 @@ struct WobbleConstraint | @@ -196,7 +196,7 @@ struct WobbleConstraint | ||
| 196 | current = Quaternion(mDeviation * f, Vector3::ZAXIS); | 196 | current = Quaternion(mDeviation * f, Vector3::ZAXIS); |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | - const float mDeviation; ///< Deviation factor in radians. | 199 | + Radian mDeviation; ///< Deviation factor in radians. |
| 200 | }; | 200 | }; |
| 201 | 201 | ||
| 202 | } // unnamed namespace | 202 | } // unnamed namespace |
| @@ -285,7 +285,7 @@ private: | @@ -285,7 +285,7 @@ private: | ||
| 285 | mPaddleImage.SetSize( mPaddleFullSize ); | 285 | mPaddleImage.SetSize( mPaddleFullSize ); |
| 286 | 286 | ||
| 287 | mWobbleProperty = mPaddle.RegisterProperty(WOBBLE_PROPERTY_NAME, 0.0f); | 287 | mWobbleProperty = mPaddle.RegisterProperty(WOBBLE_PROPERTY_NAME, 0.0f); |
| 288 | - Constraint wobbleConstraint = Constraint::New<Quaternion>( mPaddle, Actor::Property::ORIENTATION, WobbleConstraint(10.0f)); | 288 | + Constraint wobbleConstraint = Constraint::New<Quaternion>( mPaddle, Actor::Property::ORIENTATION, WobbleConstraint(Degree( 10.0f ))); |
| 289 | wobbleConstraint.AddSource( LocalSource(mWobbleProperty) ); | 289 | wobbleConstraint.AddSource( LocalSource(mWobbleProperty) ); |
| 290 | wobbleConstraint.Apply(); | 290 | wobbleConstraint.Apply(); |
| 291 | 291 | ||
| @@ -358,8 +358,8 @@ private: | @@ -358,8 +358,8 @@ private: | ||
| 358 | mLevelContainer = Actor::New(); | 358 | mLevelContainer = Actor::New(); |
| 359 | mLevelContainer.SetAnchorPoint( AnchorPoint::CENTER ); | 359 | mLevelContainer.SetAnchorPoint( AnchorPoint::CENTER ); |
| 360 | mLevelContainer.SetParentOrigin( ParentOrigin::CENTER ); | 360 | mLevelContainer.SetParentOrigin( ParentOrigin::CENTER ); |
| 361 | - mLevelContainer.SetRelayoutEnabled( true ); | ||
| 362 | mLevelContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 361 | mLevelContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 362 | + | ||
| 363 | mContentLayer.Add( mLevelContainer ); | 363 | mContentLayer.Add( mLevelContainer ); |
| 364 | 364 | ||
| 365 | mBrickCount = 0; | 365 | mBrickCount = 0; |
| @@ -524,14 +524,10 @@ private: | @@ -524,14 +524,10 @@ private: | ||
| 524 | Vector2 stageSize(Stage::GetCurrent().GetSize()); | 524 | Vector2 stageSize(Stage::GetCurrent().GetSize()); |
| 525 | const Vector2 brickSize(BRICK_SIZE * Vector2(stageSize.x, stageSize.x)); | 525 | const Vector2 brickSize(BRICK_SIZE * Vector2(stageSize.x, stageSize.x)); |
| 526 | 526 | ||
| 527 | - ImageAttributes attr; | ||
| 528 | - attr.SetSize( 128, 64 ); | ||
| 529 | - attr.SetScalingMode( ImageAttributes::ScaleToFill ); | ||
| 530 | - Image img = ResourceImage::New(BRICK_IMAGE_PATH[type], attr); | 527 | + Image img = ResourceImage::New( BRICK_IMAGE_PATH[type], Dali::ImageDimensions( 128, 64 ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); |
| 531 | ImageActor brick = ImageActor::New(img); | 528 | ImageActor brick = ImageActor::New(img); |
| 532 | brick.SetParentOrigin(ParentOrigin::TOP_LEFT); | 529 | brick.SetParentOrigin(ParentOrigin::TOP_LEFT); |
| 533 | brick.SetAnchorPoint(AnchorPoint::CENTER); | 530 | brick.SetAnchorPoint(AnchorPoint::CENTER); |
| 534 | - brick.SetRelayoutEnabled( false ); | ||
| 535 | brick.SetSize( brickSize ); | 531 | brick.SetSize( brickSize ); |
| 536 | brick.SetPosition( Vector3( position ) ); | 532 | brick.SetPosition( Vector3( position ) ); |
| 537 | 533 | ||
| @@ -563,7 +559,6 @@ private: | @@ -563,7 +559,6 @@ private: | ||
| 563 | ImageActor actor = ImageActor::New(img); | 559 | ImageActor actor = ImageActor::New(img); |
| 564 | actor.SetParentOrigin(ParentOrigin::TOP_LEFT); | 560 | actor.SetParentOrigin(ParentOrigin::TOP_LEFT); |
| 565 | actor.SetAnchorPoint(AnchorPoint::CENTER); | 561 | actor.SetAnchorPoint(AnchorPoint::CENTER); |
| 566 | - actor.SetRelayoutEnabled( false ); | ||
| 567 | return actor; | 562 | return actor; |
| 568 | } | 563 | } |
| 569 | 564 |
examples/bubble-effect/bubble-effect-example.cpp
| @@ -53,19 +53,15 @@ const unsigned int DEFAULT_NUMBER_OF_BUBBLES( 1000 ); | @@ -53,19 +53,15 @@ const unsigned int DEFAULT_NUMBER_OF_BUBBLES( 1000 ); | ||
| 53 | /** | 53 | /** |
| 54 | * @brief Load an image, scaled-down to no more than the stage dimensions. | 54 | * @brief Load an image, scaled-down to no more than the stage dimensions. |
| 55 | * | 55 | * |
| 56 | - * Uses image scaling mode ImageAttributes::ScaleToFill to resize the image at | 56 | + * Uses image scaling mode FittingMode::SCALE_TO_FILL to resize the image at |
| 57 | * load time to cover the entire stage with pixels with no borders, | 57 | * load time to cover the entire stage with pixels with no borders, |
| 58 | - * and filter mode ImageAttributes::BoxThenLinear to sample the image with | 58 | + * and filter mode BOX_THEN_LINEAR to sample the image with |
| 59 | * maximum quality. | 59 | * maximum quality. |
| 60 | */ | 60 | */ |
| 61 | ResourceImage LoadStageFillingImage( const char * const imagePath ) | 61 | ResourceImage LoadStageFillingImage( const char * const imagePath ) |
| 62 | { | 62 | { |
| 63 | Size stageSize = Stage::GetCurrent().GetSize(); | 63 | Size stageSize = Stage::GetCurrent().GetSize(); |
| 64 | - ImageAttributes attributes; | ||
| 65 | - attributes.SetSize( stageSize.x, stageSize.y ); | ||
| 66 | - attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); | ||
| 67 | - attributes.SetScalingMode( ImageAttributes::ScaleToFill ); | ||
| 68 | - return ResourceImage::New( imagePath, attributes ); | 64 | + return ResourceImage::New( imagePath, Dali::ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); |
| 69 | } | 65 | } |
| 70 | 66 | ||
| 71 | }// end LOCAL_STUFF | 67 | }// end LOCAL_STUFF |
examples/builder/examples.cpp
| @@ -287,7 +287,6 @@ public: | @@ -287,7 +287,6 @@ public: | ||
| 287 | mFiles.clear(); | 287 | mFiles.clear(); |
| 288 | 288 | ||
| 289 | mItemView = ItemView::New(*this); | 289 | mItemView = ItemView::New(*this); |
| 290 | - mItemView.SetRelayoutEnabled( false ); | ||
| 291 | stage.Add( mItemView ); | 290 | stage.Add( mItemView ); |
| 292 | mItemView.SetParentOrigin(ParentOrigin::CENTER); | 291 | mItemView.SetParentOrigin(ParentOrigin::CENTER); |
| 293 | mItemView.SetAnchorPoint(AnchorPoint::CENTER); | 292 | mItemView.SetAnchorPoint(AnchorPoint::CENTER); |
| @@ -469,9 +468,6 @@ public: | @@ -469,9 +468,6 @@ public: | ||
| 469 | } | 468 | } |
| 470 | 469 | ||
| 471 | builder.AddActors( layer ); | 470 | builder.AddActors( layer ); |
| 472 | - | ||
| 473 | - // Force relayout on layer | ||
| 474 | - layer.RelayoutRequestTree(); | ||
| 475 | } | 471 | } |
| 476 | 472 | ||
| 477 | 473 |
examples/buttons/buttons-example.cpp
| @@ -214,8 +214,8 @@ class ButtonsController: public ConnectionTracker | @@ -214,8 +214,8 @@ class ButtonsController: public ConnectionTracker | ||
| 214 | mBigImage3 = ResourceImage::New( BIG_IMAGE_3 ); | 214 | mBigImage3 = ResourceImage::New( BIG_IMAGE_3 ); |
| 215 | 215 | ||
| 216 | mImage = ImageActor::New( mBigImage1 ); | 216 | mImage = ImageActor::New( mBigImage1 ); |
| 217 | - mImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); | ||
| 218 | - mImage.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::WIDTH ); | 217 | + mImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 218 | + mImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); | ||
| 219 | radioGroup2Background.AddChild( mImage, Toolkit::TableView::CellPosition( 0, 1, 2, 1 ) ); | 219 | radioGroup2Background.AddChild( mImage, Toolkit::TableView::CellPosition( 0, 1, 2, 1 ) ); |
| 220 | 220 | ||
| 221 | // The enable/disable radio group | 221 | // The enable/disable radio group |
| @@ -349,7 +349,6 @@ class ButtonsController: public ConnectionTracker | @@ -349,7 +349,6 @@ class ButtonsController: public ConnectionTracker | ||
| 349 | 349 | ||
| 350 | contentTable.Add( toggleBackground ); | 350 | contentTable.Add( toggleBackground ); |
| 351 | 351 | ||
| 352 | - | ||
| 353 | Toolkit::PushButton toggleButton = Toolkit::PushButton::New(); | 352 | Toolkit::PushButton toggleButton = Toolkit::PushButton::New(); |
| 354 | toggleButton.SetTogglableButton( true ); | 353 | toggleButton.SetTogglableButton( true ); |
| 355 | toggleButton.SetLabel( "Unselected" ); | 354 | toggleButton.SetLabel( "Unselected" ); |
examples/cluster/cluster-example.cpp
| @@ -186,7 +186,7 @@ struct CarouselEffectOrientationConstraint | @@ -186,7 +186,7 @@ struct CarouselEffectOrientationConstraint | ||
| 186 | void operator()( Vector2& current, const PropertyInputContainer& inputs ) | 186 | void operator()( Vector2& current, const PropertyInputContainer& inputs ) |
| 187 | { | 187 | { |
| 188 | Vector3 axis; | 188 | Vector3 axis; |
| 189 | - float angle; | 189 | + Radian angle; |
| 190 | inputs[0]->GetQuaternion().ToAxisAngle( axis, angle ); | 190 | inputs[0]->GetQuaternion().ToAxisAngle( axis, angle ); |
| 191 | 191 | ||
| 192 | current.x = cosf(angle); | 192 | current.x = cosf(angle); |
| @@ -242,7 +242,7 @@ struct ShearEffectConstraint | @@ -242,7 +242,7 @@ struct ShearEffectConstraint | ||
| 242 | // Channel this shear value into either the X or Y axis depending on | 242 | // Channel this shear value into either the X or Y axis depending on |
| 243 | // the component mask passed in. | 243 | // the component mask passed in. |
| 244 | Vector3 axis; | 244 | Vector3 axis; |
| 245 | - float angle; | 245 | + Radian angle; |
| 246 | inputs[1]->GetQuaternion().ToAxisAngle( axis, angle ); | 246 | inputs[1]->GetQuaternion().ToAxisAngle( axis, angle ); |
| 247 | Vector2 direction( cosf(angle), sinf(angle) ); | 247 | Vector2 direction( cosf(angle), sinf(angle) ); |
| 248 | float yield = direction.x * mComponentMask.x + direction.y * mComponentMask.y; | 248 | float yield = direction.x * mComponentMask.x + direction.y * mComponentMask.y; |
| @@ -477,7 +477,6 @@ public: | @@ -477,7 +477,6 @@ public: | ||
| 477 | 477 | ||
| 478 | // create and setup the scroll view... | 478 | // create and setup the scroll view... |
| 479 | mScrollView = ScrollView::New(); | 479 | mScrollView = ScrollView::New(); |
| 480 | - mScrollView.SetRelayoutEnabled( false ); | ||
| 481 | mScrollView.SetSize(stageSize); | 480 | mScrollView.SetSize(stageSize); |
| 482 | 481 | ||
| 483 | // attach Wobble Effect to ScrollView | 482 | // attach Wobble Effect to ScrollView |
| @@ -489,7 +488,6 @@ public: | @@ -489,7 +488,6 @@ public: | ||
| 489 | mScrollView.SetParentOrigin(ParentOrigin::CENTER); | 488 | mScrollView.SetParentOrigin(ParentOrigin::CENTER); |
| 490 | 489 | ||
| 491 | // Scale ScrollView to fit parent (mContentLayer) | 490 | // Scale ScrollView to fit parent (mContentLayer) |
| 492 | - mScrollView.SetRelayoutEnabled( true ); | ||
| 493 | mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 491 | mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 494 | 492 | ||
| 495 | // Add the scroll view to the content layer | 493 | // Add the scroll view to the content layer |
| @@ -511,32 +509,30 @@ public: | @@ -511,32 +509,30 @@ public: | ||
| 511 | /** | 509 | /** |
| 512 | * Helper to create the cluster actors | 510 | * Helper to create the cluster actors |
| 513 | */ | 511 | */ |
| 514 | - Cluster CreateClusterActor(ClusterType clusterType, ClusterStyle style) | 512 | + Cluster CreateClusterActor(ClusterType clusterType, ClusterStyle style, Vector3& clusterSize) |
| 515 | { | 513 | { |
| 516 | // Create the cluster actor with the given cluster style | 514 | // Create the cluster actor with the given cluster style |
| 517 | Cluster clusterActor = Cluster::New(style); | 515 | Cluster clusterActor = Cluster::New(style); |
| 518 | clusterActor.SetParentOrigin(ParentOrigin::CENTER); | 516 | clusterActor.SetParentOrigin(ParentOrigin::CENTER); |
| 519 | clusterActor.SetAnchorPoint(AnchorPoint::CENTER); | 517 | clusterActor.SetAnchorPoint(AnchorPoint::CENTER); |
| 520 | - clusterActor.SetRelayoutEnabled( false ); | ||
| 521 | 518 | ||
| 522 | Vector2 stageSize = Dali::Stage::GetCurrent().GetSize(); | 519 | Vector2 stageSize = Dali::Stage::GetCurrent().GetSize(); |
| 523 | float minStageDimension = std::min(stageSize.x, stageSize.y); | 520 | float minStageDimension = std::min(stageSize.x, stageSize.y); |
| 524 | - clusterActor.SetSize(minStageDimension * CLUSTER_RELATIVE_SIZE, minStageDimension * CLUSTER_RELATIVE_SIZE, 0.0f); | 521 | + |
| 522 | + clusterSize.x = minStageDimension * CLUSTER_RELATIVE_SIZE; | ||
| 523 | + clusterSize.y = minStageDimension * CLUSTER_RELATIVE_SIZE; | ||
| 524 | + | ||
| 525 | + clusterActor.SetSize( clusterSize ); | ||
| 525 | 526 | ||
| 526 | DALI_ASSERT_ALWAYS(clusterType < CLUSTER_COUNT); | 527 | DALI_ASSERT_ALWAYS(clusterType < CLUSTER_COUNT); |
| 527 | const char **paths = IMAGE_GROUPS[clusterType]; | 528 | const char **paths = IMAGE_GROUPS[clusterType]; |
| 528 | DALI_ASSERT_ALWAYS(paths); | 529 | DALI_ASSERT_ALWAYS(paths); |
| 529 | 530 | ||
| 530 | // Add a background image to the cluster, limiting the loaded size by | 531 | // Add a background image to the cluster, limiting the loaded size by |
| 531 | - // fitting it inside a quarter of the stage area with the conservative Box | 532 | + // fitting it inside a quarter of the stage area with the conservative BOX |
| 532 | // filter mode: | 533 | // filter mode: |
| 533 | - Dali::ImageAttributes backgroundAttributes; | ||
| 534 | - backgroundAttributes.SetSize( Stage::GetCurrent().GetSize() * 0.5f ); | ||
| 535 | - backgroundAttributes.SetFilterMode( Dali::ImageAttributes::Box ); | ||
| 536 | - backgroundAttributes.SetScalingMode( Dali::ImageAttributes::ShrinkToFit ); | ||
| 537 | - Image bg = ResourceImage::New( CLUSTER_BACKGROUND_IMAGE_PATH ); | 534 | + Image bg = ResourceImage::New( CLUSTER_BACKGROUND_IMAGE_PATH, Dali::ImageDimensions( stageSize.x * 0.5f, stageSize.y * 0.5f ), Dali::FittingMode::SHRINK_TO_FIT, Dali::SamplingMode::BOX ); |
| 538 | ImageActor image = ImageActor::New(bg); | 535 | ImageActor image = ImageActor::New(bg); |
| 539 | - image.SetRelayoutEnabled( false ); | ||
| 540 | clusterActor.SetBackgroundImage(image); | 536 | clusterActor.SetBackgroundImage(image); |
| 541 | 537 | ||
| 542 | // Add actors (pictures) as the children of the cluster | 538 | // Add actors (pictures) as the children of the cluster |
| @@ -563,14 +559,11 @@ public: | @@ -563,14 +559,11 @@ public: | ||
| 563 | actor.SetAnchorPoint( AnchorPoint::CENTER ); | 559 | actor.SetAnchorPoint( AnchorPoint::CENTER ); |
| 564 | 560 | ||
| 565 | // Load the thumbnail at quarter of screen width or standard size if that is smaller: | 561 | // Load the thumbnail at quarter of screen width or standard size if that is smaller: |
| 566 | - ImageAttributes attribs = ImageAttributes::New(); | ||
| 567 | Size stageQuarter = Stage::GetCurrent().GetSize() * 0.25f; | 562 | Size stageQuarter = Stage::GetCurrent().GetSize() * 0.25f; |
| 568 | - attribs.SetSize( std::min( stageQuarter.x, CLUSTER_IMAGE_THUMBNAIL_WIDTH), std::min( stageQuarter.y, CLUSTER_IMAGE_THUMBNAIL_HEIGHT ) ); | ||
| 569 | - attribs.SetFilterMode( Dali::ImageAttributes::BoxThenLinear ); | ||
| 570 | - attribs.SetScalingMode(Dali::ImageAttributes::ShrinkToFit ); | 563 | + const ImageDimensions requestedDims = ImageDimensions( std::min( stageQuarter.x, CLUSTER_IMAGE_THUMBNAIL_WIDTH ), std::min( stageQuarter.y, CLUSTER_IMAGE_THUMBNAIL_HEIGHT ) ); |
| 571 | 564 | ||
| 572 | // Add a shadow image child actor | 565 | // Add a shadow image child actor |
| 573 | - Image shadowImage = ResourceImage::New( CLUSTER_SHADOW_IMAGE_PATH, attribs ); | 566 | + Image shadowImage = ResourceImage::New( CLUSTER_SHADOW_IMAGE_PATH, requestedDims, Dali::FittingMode::SHRINK_TO_FIT, Dali::SamplingMode::BOX ); |
| 574 | ImageActor shadowActor = ImageActor::New(shadowImage); | 567 | ImageActor shadowActor = ImageActor::New(shadowImage); |
| 575 | 568 | ||
| 576 | // Shadow is not exactly located on the center of the image, so it is moved to a little | 569 | // Shadow is not exactly located on the center of the image, so it is moved to a little |
| @@ -585,7 +578,7 @@ public: | @@ -585,7 +578,7 @@ public: | ||
| 585 | actor.Add( shadowActor ); | 578 | actor.Add( shadowActor ); |
| 586 | 579 | ||
| 587 | // Add a picture image actor to actor (with equal size to the parent). | 580 | // Add a picture image actor to actor (with equal size to the parent). |
| 588 | - Image image = ResourceImage::New( imagePath, attribs ); | 581 | + Image image = ResourceImage::New( imagePath, requestedDims, Dali::FittingMode::SHRINK_TO_FIT, Dali::SamplingMode::BOX ); |
| 589 | ImageActor imageActor = ImageActor::New( image ); | 582 | ImageActor imageActor = ImageActor::New( image ); |
| 590 | imageActor.SetParentOrigin( ParentOrigin::CENTER ); | 583 | imageActor.SetParentOrigin( ParentOrigin::CENTER ); |
| 591 | imageActor.SetAnchorPoint( AnchorPoint::CENTER ); | 584 | imageActor.SetAnchorPoint( AnchorPoint::CENTER ); |
| @@ -629,19 +622,18 @@ public: | @@ -629,19 +622,18 @@ public: | ||
| 629 | mScrollView.Add(pageView); | 622 | mScrollView.Add(pageView); |
| 630 | pageView.SetParentOrigin(ParentOrigin::CENTER); | 623 | pageView.SetParentOrigin(ParentOrigin::CENTER); |
| 631 | pageView.SetPosition(Vector3(stageSize.width * column, 0.0f, 0.0f)); | 624 | pageView.SetPosition(Vector3(stageSize.width * column, 0.0f, 0.0f)); |
| 632 | - pageView.SetRelayoutEnabled( true ); | ||
| 633 | pageView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 625 | pageView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 634 | 626 | ||
| 635 | // Create cluster actors, add them to scroll view, and set the shear effect with the given center point. | 627 | // Create cluster actors, add them to scroll view, and set the shear effect with the given center point. |
| 636 | - Cluster cluster = CreateClusterActor(clusterType, style); | 628 | + Vector3 clusterSize; |
| 629 | + Cluster cluster = CreateClusterActor( clusterType, style, clusterSize ); | ||
| 637 | cluster.SetParentOrigin(ParentOrigin::TOP_LEFT); | 630 | cluster.SetParentOrigin(ParentOrigin::TOP_LEFT); |
| 638 | cluster.SetAnchorPoint(AnchorPoint::TOP_LEFT); | 631 | cluster.SetAnchorPoint(AnchorPoint::TOP_LEFT); |
| 639 | cluster.SetPosition( clusterPosition ); | 632 | cluster.SetPosition( clusterPosition ); |
| 640 | 633 | ||
| 641 | pageView.Add(cluster); | 634 | pageView.Add(cluster); |
| 642 | - Vector3 clusterSize = cluster.GetCurrentSize(); | ||
| 643 | 635 | ||
| 644 | - mClusterInfo.push_back(ClusterInfo( cluster, mClusterCount, clusterPosition, clusterSize )); | 636 | + mClusterInfo.push_back( ClusterInfo( cluster, mClusterCount, clusterPosition, clusterSize ) ); |
| 645 | 637 | ||
| 646 | mClusterCount++; | 638 | mClusterCount++; |
| 647 | } | 639 | } |
examples/cube-transition-effect/cube-transition-effect-example.cpp
| @@ -91,19 +91,15 @@ const int VIEWINGTIME = 2000; // 2 seconds | @@ -91,19 +91,15 @@ const int VIEWINGTIME = 2000; // 2 seconds | ||
| 91 | /** | 91 | /** |
| 92 | * @brief Load an image, scaled-down to no more than the stage dimensions. | 92 | * @brief Load an image, scaled-down to no more than the stage dimensions. |
| 93 | * | 93 | * |
| 94 | - * Uses image scaling mode ImageAttributes::ScaleToFill to resize the image at | 94 | + * Uses image scaling mode SCALE_TO_FILL to resize the image at |
| 95 | * load time to cover the entire stage with pixels with no borders, | 95 | * load time to cover the entire stage with pixels with no borders, |
| 96 | - * and filter mode ImageAttributes::BoxThenLinear to sample the image with | 96 | + * and filter mode BOX_THEN_LINEAR to sample the image with |
| 97 | * maximum quality. | 97 | * maximum quality. |
| 98 | */ | 98 | */ |
| 99 | ResourceImage LoadStageFillingImage( const char * const imagePath ) | 99 | ResourceImage LoadStageFillingImage( const char * const imagePath ) |
| 100 | { | 100 | { |
| 101 | Size stageSize = Stage::GetCurrent().GetSize(); | 101 | Size stageSize = Stage::GetCurrent().GetSize(); |
| 102 | - ImageAttributes attributes; | ||
| 103 | - attributes.SetSize( stageSize.x, stageSize.y ); | ||
| 104 | - attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); | ||
| 105 | - attributes.SetScalingMode( ImageAttributes::ScaleToFill ); | ||
| 106 | - return ResourceImage::New( imagePath, attributes ); | 102 | + return ResourceImage::New( imagePath, ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); |
| 107 | } | 103 | } |
| 108 | 104 | ||
| 109 | } // namespace | 105 | } // namespace |
| @@ -330,7 +326,6 @@ void CubeTransitionApp::GoToNextImage() | @@ -330,7 +326,6 @@ void CubeTransitionApp::GoToNextImage() | ||
| 330 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION); | 326 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION); |
| 331 | mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 327 | mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 332 | mNextImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); | 328 | mNextImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); |
| 333 | - mNextImage.SetRelayoutEnabled( false ); | ||
| 334 | mCurrentEffect.SetTargetImage(mNextImage); | 329 | mCurrentEffect.SetTargetImage(mNextImage); |
| 335 | if( image.GetLoadingState() == ResourceLoadingSucceeded ) | 330 | if( image.GetLoadingState() == ResourceLoadingSucceeded ) |
| 336 | { | 331 | { |
examples/dissolve-effect/dissolve-effect-example.cpp
| @@ -77,19 +77,15 @@ const float INITIAL_DEPTH = -10.0f; | @@ -77,19 +77,15 @@ const float INITIAL_DEPTH = -10.0f; | ||
| 77 | /** | 77 | /** |
| 78 | * @brief Load an image, scaled-down to no more than the stage dimensions. | 78 | * @brief Load an image, scaled-down to no more than the stage dimensions. |
| 79 | * | 79 | * |
| 80 | - * Uses image scaling mode ImageAttributes::ScaleToFill to resize the image at | 80 | + * Uses image scaling mode SCALE_TO_FILL to resize the image at |
| 81 | * load time to cover the entire stage with pixels with no borders, | 81 | * load time to cover the entire stage with pixels with no borders, |
| 82 | - * and filter mode ImageAttributes::BoxThenLinear to sample the image with | 82 | + * and filter mode BOX_THEN_LINEAR to sample the image with |
| 83 | * maximum quality. | 83 | * maximum quality. |
| 84 | */ | 84 | */ |
| 85 | ResourceImage LoadStageFillingImage( const char * const imagePath ) | 85 | ResourceImage LoadStageFillingImage( const char * const imagePath ) |
| 86 | { | 86 | { |
| 87 | Size stageSize = Stage::GetCurrent().GetSize(); | 87 | Size stageSize = Stage::GetCurrent().GetSize(); |
| 88 | - ImageAttributes attributes; | ||
| 89 | - attributes.SetSize( stageSize.x, stageSize.y ); | ||
| 90 | - attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); | ||
| 91 | - attributes.SetScalingMode( ImageAttributes::ScaleToFill ); | ||
| 92 | - return ResourceImage::New( imagePath, attributes ); | 88 | + return ResourceImage::New( imagePath, ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); |
| 93 | } | 89 | } |
| 94 | 90 | ||
| 95 | } // namespace | 91 | } // namespace |
| @@ -254,7 +250,6 @@ void DissolveEffectApp::OnInit( Application& application ) | @@ -254,7 +250,6 @@ void DissolveEffectApp::OnInit( Application& application ) | ||
| 254 | 250 | ||
| 255 | // show the first image | 251 | // show the first image |
| 256 | mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) ); | 252 | mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) ); |
| 257 | - mCurrentImage.SetRelayoutEnabled( false ); | ||
| 258 | mCurrentImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); | 253 | mCurrentImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); |
| 259 | mCurrentImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 254 | mCurrentImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 260 | mCurrentImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); | 255 | mCurrentImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); |
| @@ -285,7 +280,6 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture& gesture ) | @@ -285,7 +280,6 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture& gesture ) | ||
| 285 | 280 | ||
| 286 | Image image = LoadStageFillingImage( IMAGES[ mIndex ] ); | 281 | Image image = LoadStageFillingImage( IMAGES[ mIndex ] ); |
| 287 | mNextImage = ImageActor::New( image ); | 282 | mNextImage = ImageActor::New( image ); |
| 288 | - mNextImage.SetRelayoutEnabled( false ); | ||
| 289 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); | 283 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); |
| 290 | mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 284 | mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 291 | mNextImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); | 285 | mNextImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); |
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
| @@ -27,7 +27,7 @@ | @@ -27,7 +27,7 @@ | ||
| 27 | * The functions CreateImage and CreateImageActor below show how to build an | 27 | * The functions CreateImage and CreateImageActor below show how to build an |
| 28 | * image using a scaling mode to have %Dali resize it during loading. | 28 | * image using a scaling mode to have %Dali resize it during loading. |
| 29 | * | 29 | * |
| 30 | - * This demo defaults to the ScaleToFill mode of ImageAttributes which makes | 30 | + * This demo defaults to the SCALE_TO_FILL mode of ImageAttributes which makes |
| 31 | * sure that every pixel in the loaded image is filled with a source colour | 31 | * sure that every pixel in the loaded image is filled with a source colour |
| 32 | * from the image's central region while losing the minimum number of pixels | 32 | * from the image's central region while losing the minimum number of pixels |
| 33 | * from its periphery. | 33 | * from its periphery. |
| @@ -77,7 +77,7 @@ const unsigned GRID_CELL_PADDING = 4; | @@ -77,7 +77,7 @@ const unsigned GRID_CELL_PADDING = 4; | ||
| 77 | /** The aspect ratio of cells in the image grid. */ | 77 | /** The aspect ratio of cells in the image grid. */ |
| 78 | const float CELL_ASPECT_RATIO = 1.33333333333333333333f; | 78 | const float CELL_ASPECT_RATIO = 1.33333333333333333333f; |
| 79 | 79 | ||
| 80 | -const ImageAttributes::ScalingMode DEFAULT_SCALING_MODE = ImageAttributes::ScaleToFill; | 80 | +const Dali::FittingMode::Type DEFAULT_SCALING_MODE = Dali::FittingMode::SCALE_TO_FILL; |
| 81 | 81 | ||
| 82 | /** The number of times to spin an image on touching, each spin taking a second.*/ | 82 | /** The number of times to spin an image on touching, each spin taking a second.*/ |
| 83 | const float SPIN_DURATION = 1.0f; | 83 | const float SPIN_DURATION = 1.0f; |
| @@ -172,19 +172,15 @@ const unsigned NUM_IMAGE_PATHS = sizeof(IMAGE_PATHS) / sizeof(IMAGE_PATHS[0]) - | @@ -172,19 +172,15 @@ const unsigned NUM_IMAGE_PATHS = sizeof(IMAGE_PATHS) / sizeof(IMAGE_PATHS[0]) - | ||
| 172 | * @param[in] filename The path of the image. | 172 | * @param[in] filename The path of the image. |
| 173 | * @param[in] width The width of the image in pixels. | 173 | * @param[in] width The width of the image in pixels. |
| 174 | * @param[in] height The height of the image in pixels. | 174 | * @param[in] height The height of the image in pixels. |
| 175 | - * @param[in] scalingMode The mode to use when scaling the image to fit the desired dimensions. | 175 | + * @param[in] fittingMode The mode to use when scaling the image to fit the desired dimensions. |
| 176 | */ | 176 | */ |
| 177 | -Image CreateImage(const std::string& filename, unsigned int width, unsigned int height, ImageAttributes::ScalingMode scalingMode ) | 177 | +Image CreateImage(const std::string& filename, unsigned int width, unsigned int height, Dali::FittingMode::Type fittingMode ) |
| 178 | { | 178 | { |
| 179 | #ifdef DEBUG_PRINT_DIAGNOSTICS | 179 | #ifdef DEBUG_PRINT_DIAGNOSTICS |
| 180 | - fprintf( stderr, "CreateImage(%s, %u, %u, scalingMode=%u)\n", filename.c_str(), width, height, unsigned( scalingMode ) ); | 180 | + fprintf( stderr, "CreateImage(%s, %u, %u, fittingMode=%u)\n", filename.c_str(), width, height, unsigned( fittingMode ) ); |
| 181 | #endif | 181 | #endif |
| 182 | - ImageAttributes attributes; | 182 | + Image image = ResourceImage::New( filename, ImageDimensions( width, height ), fittingMode, Dali::SamplingMode::BOX_THEN_LINEAR ); |
| 183 | 183 | ||
| 184 | - attributes.SetSize( width, height ); | ||
| 185 | - attributes.SetScalingMode( scalingMode ); | ||
| 186 | - attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); | ||
| 187 | - Image image = ResourceImage::New( filename, attributes ); | ||
| 188 | return image; | 184 | return image; |
| 189 | } | 185 | } |
| 190 | 186 | ||
| @@ -194,11 +190,11 @@ Image CreateImage(const std::string& filename, unsigned int width, unsigned int | @@ -194,11 +190,11 @@ Image CreateImage(const std::string& filename, unsigned int width, unsigned int | ||
| 194 | * @param[in] filename The path of the image. | 190 | * @param[in] filename The path of the image. |
| 195 | * @param[in] width The width of the image in pixels. | 191 | * @param[in] width The width of the image in pixels. |
| 196 | * @param[in] height The height of the image in pixels. | 192 | * @param[in] height The height of the image in pixels. |
| 197 | - * @param[in] scalingMode The mode to use when scaling the image to fit the desired dimensions. | 193 | + * @param[in] fittingMode The mode to use when scaling the image to fit the desired dimensions. |
| 198 | */ | 194 | */ |
| 199 | -ImageActor CreateImageActor(const std::string& filename, unsigned int width, unsigned int height, ImageAttributes::ScalingMode scalingMode ) | 195 | +ImageActor CreateImageActor(const std::string& filename, unsigned int width, unsigned int height, Dali::FittingMode::Type fittingMode ) |
| 200 | { | 196 | { |
| 201 | - Image img = CreateImage( filename, width, height, scalingMode ); | 197 | + Image img = CreateImage( filename, width, height, fittingMode ); |
| 202 | ImageActor actor = ImageActor::New( img ); | 198 | ImageActor actor = ImageActor::New( img ); |
| 203 | actor.SetName( filename ); | 199 | actor.SetName( filename ); |
| 204 | actor.SetParentOrigin(ParentOrigin::CENTER); | 200 | actor.SetParentOrigin(ParentOrigin::CENTER); |
| @@ -208,22 +204,22 @@ ImageActor CreateImageActor(const std::string& filename, unsigned int width, uns | @@ -208,22 +204,22 @@ ImageActor CreateImageActor(const std::string& filename, unsigned int width, uns | ||
| 208 | } | 204 | } |
| 209 | 205 | ||
| 210 | /** Cycle the scaling mode options. */ | 206 | /** Cycle the scaling mode options. */ |
| 211 | -ImageAttributes::ScalingMode NextMode( const ImageAttributes::ScalingMode oldMode ) | 207 | +Dali::FittingMode::Type NextMode( const Dali::FittingMode::Type oldMode ) |
| 212 | { | 208 | { |
| 213 | - ImageAttributes::ScalingMode newMode = ImageAttributes::ShrinkToFit; | 209 | + Dali::FittingMode::Type newMode = FittingMode::SHRINK_TO_FIT; |
| 214 | switch ( oldMode ) | 210 | switch ( oldMode ) |
| 215 | { | 211 | { |
| 216 | - case ImageAttributes::ShrinkToFit: | ||
| 217 | - newMode = ImageAttributes::ScaleToFill; | 212 | + case FittingMode::SHRINK_TO_FIT: |
| 213 | + newMode = FittingMode::SCALE_TO_FILL; | ||
| 218 | break; | 214 | break; |
| 219 | - case ImageAttributes::ScaleToFill: | ||
| 220 | - newMode = ImageAttributes::FitWidth; | 215 | + case FittingMode::SCALE_TO_FILL: |
| 216 | + newMode = FittingMode::FIT_WIDTH; | ||
| 221 | break; | 217 | break; |
| 222 | - case ImageAttributes::FitWidth: | ||
| 223 | - newMode = ImageAttributes::FitHeight; | 218 | + case FittingMode::FIT_WIDTH: |
| 219 | + newMode = FittingMode::FIT_HEIGHT; | ||
| 224 | break; | 220 | break; |
| 225 | - case ImageAttributes::FitHeight: | ||
| 226 | - newMode = ImageAttributes::ShrinkToFit; | 221 | + case FittingMode::FIT_HEIGHT: |
| 222 | + newMode = FittingMode::SHRINK_TO_FIT; | ||
| 227 | break; | 223 | break; |
| 228 | } | 224 | } |
| 229 | return newMode; | 225 | return newMode; |
| @@ -273,7 +269,7 @@ public: | @@ -273,7 +269,7 @@ public: | ||
| 273 | : mApplication( application ), | 269 | : mApplication( application ), |
| 274 | mScrolling( false ) | 270 | mScrolling( false ) |
| 275 | { | 271 | { |
| 276 | - std::cout << "ImageScalingScaleToFillController::ImageScalingScaleToFillController" << std::endl; | 272 | + std::cout << "ImageScalingIrregularGridController::ImageScalingIrregularGridController" << std::endl; |
| 277 | 273 | ||
| 278 | // Connect to the Application's Init signal | 274 | // Connect to the Application's Init signal |
| 279 | mApplication.InitSignal().Connect( this, &ImageScalingIrregularGridController::Create ); | 275 | mApplication.InitSignal().Connect( this, &ImageScalingIrregularGridController::Create ); |
| @@ -289,7 +285,7 @@ public: | @@ -289,7 +285,7 @@ public: | ||
| 289 | */ | 285 | */ |
| 290 | void Create( Application& application ) | 286 | void Create( Application& application ) |
| 291 | { | 287 | { |
| 292 | - std::cout << "ImageScalingScaleToFillController::Create" << std::endl; | 288 | + std::cout << "ImageScalingIrregularGridController::Create" << std::endl; |
| 293 | 289 | ||
| 294 | DemoHelper::RequestThemeChange(); | 290 | DemoHelper::RequestThemeChange(); |
| 295 | 291 | ||
| @@ -326,13 +322,13 @@ public: | @@ -326,13 +322,13 @@ public: | ||
| 326 | /** | 322 | /** |
| 327 | * Build the main part of the application's view. | 323 | * Build the main part of the application's view. |
| 328 | */ | 324 | */ |
| 329 | - void PopulateContentLayer( const ImageAttributes::ScalingMode scalingMode ) | 325 | + void PopulateContentLayer( const Dali::FittingMode::Type fittingMode ) |
| 330 | { | 326 | { |
| 331 | Stage stage = Stage::GetCurrent(); | 327 | Stage stage = Stage::GetCurrent(); |
| 332 | Vector2 stageSize = stage.GetSize(); | 328 | Vector2 stageSize = stage.GetSize(); |
| 333 | 329 | ||
| 334 | float fieldHeight; | 330 | float fieldHeight; |
| 335 | - Actor imageField = BuildImageField( stageSize.x, GRID_WIDTH, GRID_MAX_HEIGHT, scalingMode, fieldHeight ); | 331 | + Actor imageField = BuildImageField( stageSize.x, GRID_WIDTH, GRID_MAX_HEIGHT, fittingMode, fieldHeight ); |
| 336 | 332 | ||
| 337 | mScrollView = ScrollView::New(); | 333 | mScrollView = ScrollView::New(); |
| 338 | 334 | ||
| @@ -375,7 +371,7 @@ public: | @@ -375,7 +371,7 @@ public: | ||
| 375 | Actor BuildImageField( const float fieldWidth, | 371 | Actor BuildImageField( const float fieldWidth, |
| 376 | const unsigned gridWidth, | 372 | const unsigned gridWidth, |
| 377 | const unsigned maxGridHeight, | 373 | const unsigned maxGridHeight, |
| 378 | - ImageAttributes::ScalingMode scalingMode, | 374 | + Dali::FittingMode::Type fittingMode, |
| 379 | float & outFieldHeight ) | 375 | float & outFieldHeight ) |
| 380 | { | 376 | { |
| 381 | // Generate the list of image configurations to be fitted into the field: | 377 | // Generate the list of image configurations to be fitted into the field: |
| @@ -423,7 +419,6 @@ public: | @@ -423,7 +419,6 @@ public: | ||
| 423 | // coordinates in a frame defined by a parent actor: | 419 | // coordinates in a frame defined by a parent actor: |
| 424 | 420 | ||
| 425 | Actor gridActor = Actor::New(); | 421 | Actor gridActor = Actor::New(); |
| 426 | - gridActor.SetRelayoutEnabled( true ); | ||
| 427 | gridActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 422 | gridActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 428 | gridActor.SetParentOrigin( ParentOrigin::CENTER ); | 423 | gridActor.SetParentOrigin( ParentOrigin::CENTER ); |
| 429 | gridActor.SetAnchorPoint( AnchorPoint::CENTER ); | 424 | gridActor.SetAnchorPoint( AnchorPoint::CENTER ); |
| @@ -443,11 +438,11 @@ public: | @@ -443,11 +438,11 @@ public: | ||
| 443 | const Vector2 imageRegionCorner = gridOrigin + cellSize * Vector2( imageSource.cellX, imageSource.cellY ); | 438 | const Vector2 imageRegionCorner = gridOrigin + cellSize * Vector2( imageSource.cellX, imageSource.cellY ); |
| 444 | const Vector2 imagePosition = imageRegionCorner + Vector2( GRID_CELL_PADDING , GRID_CELL_PADDING ) + imageSize * 0.5f; | 439 | const Vector2 imagePosition = imageRegionCorner + Vector2( GRID_CELL_PADDING , GRID_CELL_PADDING ) + imageSize * 0.5f; |
| 445 | 440 | ||
| 446 | - ImageActor image = CreateImageActor( imageSource.configuration.path, imageSize.x, imageSize.y, scalingMode ); | 441 | + ImageActor image = CreateImageActor( imageSource.configuration.path, imageSize.x, imageSize.y, fittingMode ); |
| 447 | image.SetPosition( Vector3( imagePosition.x, imagePosition.y, 0 ) ); | 442 | image.SetPosition( Vector3( imagePosition.x, imagePosition.y, 0 ) ); |
| 448 | image.SetSize( imageSize ); | 443 | image.SetSize( imageSize ); |
| 449 | image.TouchedSignal().Connect( this, &ImageScalingIrregularGridController::OnTouchImage ); | 444 | image.TouchedSignal().Connect( this, &ImageScalingIrregularGridController::OnTouchImage ); |
| 450 | - mScalingModes[image.GetId()] = scalingMode; | 445 | + mFittingModes[image.GetId()] = fittingMode; |
| 451 | mSizes[image.GetId()] = imageSize; | 446 | mSizes[image.GetId()] = imageSize; |
| 452 | 447 | ||
| 453 | gridActor.Add( image ); | 448 | gridActor.Add( image ); |
| @@ -475,14 +470,14 @@ public: | @@ -475,14 +470,14 @@ public: | ||
| 475 | 470 | ||
| 476 | // Change the scaling mode: | 471 | // Change the scaling mode: |
| 477 | const unsigned id = actor.GetId(); | 472 | const unsigned id = actor.GetId(); |
| 478 | - ImageAttributes::ScalingMode newMode = NextMode( mScalingModes[id] ); | 473 | + Dali::FittingMode::Type newMode = NextMode( mFittingModes[id] ); |
| 479 | const Vector2 imageSize = mSizes[actor.GetId()]; | 474 | const Vector2 imageSize = mSizes[actor.GetId()]; |
| 480 | 475 | ||
| 481 | ImageActor imageActor = ImageActor::DownCast( actor ); | 476 | ImageActor imageActor = ImageActor::DownCast( actor ); |
| 482 | Image oldImage = imageActor.GetImage(); | 477 | Image oldImage = imageActor.GetImage(); |
| 483 | Image newImage = CreateImage( ResourceImage::DownCast(oldImage).GetUrl(), imageSize.width + 0.5f, imageSize.height + 0.5f, newMode ); | 478 | Image newImage = CreateImage( ResourceImage::DownCast(oldImage).GetUrl(), imageSize.width + 0.5f, imageSize.height + 0.5f, newMode ); |
| 484 | imageActor.SetImage( newImage ); | 479 | imageActor.SetImage( newImage ); |
| 485 | - mScalingModes[id] = newMode; | 480 | + mFittingModes[id] = newMode; |
| 486 | } | 481 | } |
| 487 | } | 482 | } |
| 488 | return false; | 483 | return false; |
| @@ -520,14 +515,14 @@ public: | @@ -520,14 +515,14 @@ public: | ||
| 520 | { | 515 | { |
| 521 | // Cycle the scaling mode options: | 516 | // Cycle the scaling mode options: |
| 522 | const Vector2 imageSize = mSizes[gridImageActor.GetId()]; | 517 | const Vector2 imageSize = mSizes[gridImageActor.GetId()]; |
| 523 | - ImageAttributes::ScalingMode newMode = NextMode( mScalingModes[gridImageActor.GetId()] ); | 518 | + Dali::FittingMode::Type newMode = NextMode( mFittingModes[gridImageActor.GetId()] ); |
| 524 | Image oldImage = gridImageActor.GetImage(); | 519 | Image oldImage = gridImageActor.GetImage(); |
| 525 | Image newImage = CreateImage(ResourceImage::DownCast(oldImage).GetUrl(), imageSize.width, imageSize.height, newMode ); | 520 | Image newImage = CreateImage(ResourceImage::DownCast(oldImage).GetUrl(), imageSize.width, imageSize.height, newMode ); |
| 526 | gridImageActor.SetImage( newImage ); | 521 | gridImageActor.SetImage( newImage ); |
| 527 | 522 | ||
| 528 | - mScalingModes[gridImageActor.GetId()] = newMode; | 523 | + mFittingModes[gridImageActor.GetId()] = newMode; |
| 529 | 524 | ||
| 530 | - SetTitle( std::string( newMode == ImageAttributes::ShrinkToFit ? "ShrinkToFit" : newMode == ImageAttributes::ScaleToFill ? "ScaleToFill" : newMode == ImageAttributes::FitWidth ? "FitWidth" : "FitHeight" ) ); | 525 | + SetTitle( std::string( newMode == FittingMode::SHRINK_TO_FIT ? "SHRINK_TO_FIT" : newMode == FittingMode::SCALE_TO_FILL ? "SCALE_TO_FILL" : newMode == FittingMode::FIT_WIDTH ? "FIT_WIDTH" : "FIT_HEIGHT" ) ); |
| 531 | } | 526 | } |
| 532 | } | 527 | } |
| 533 | return true; | 528 | return true; |
| @@ -579,7 +574,7 @@ private: | @@ -579,7 +574,7 @@ private: | ||
| 579 | Actor mGridActor; ///< The container for the grid of images | 574 | Actor mGridActor; ///< The container for the grid of images |
| 580 | ScrollView mScrollView; ///< ScrollView UI Component | 575 | ScrollView mScrollView; ///< ScrollView UI Component |
| 581 | bool mScrolling; ///< ScrollView scrolling state (true = scrolling, false = stationary) | 576 | bool mScrolling; ///< ScrollView scrolling state (true = scrolling, false = stationary) |
| 582 | - std::map<unsigned, ImageAttributes::ScalingMode> mScalingModes; ///< Stores the current scaling mode of each image, keyed by image actor id. | 577 | + std::map<unsigned, Dali::FittingMode::Type> mFittingModes; ///< Stores the current scaling mode of each image, keyed by image actor id. |
| 583 | std::map<unsigned, Vector2> mSizes; ///< Stores the current size of each image, keyed by image actor id. | 578 | std::map<unsigned, Vector2> mSizes; ///< Stores the current size of each image, keyed by image actor id. |
| 584 | }; | 579 | }; |
| 585 | 580 |
examples/item-view/item-view-example.cpp
| @@ -314,7 +314,6 @@ public: | @@ -314,7 +314,6 @@ public: | ||
| 314 | // Create the item view actor | 314 | // Create the item view actor |
| 315 | mImageAtlas = CreateImageAtlas(); | 315 | mImageAtlas = CreateImageAtlas(); |
| 316 | mItemView = ItemView::New(*this); | 316 | mItemView = ItemView::New(*this); |
| 317 | - mItemView.SetRelayoutEnabled( false ); | ||
| 318 | mItemView.SetParentOrigin(ParentOrigin::CENTER); | 317 | mItemView.SetParentOrigin(ParentOrigin::CENTER); |
| 319 | mItemView.SetAnchorPoint(AnchorPoint::CENTER); | 318 | mItemView.SetAnchorPoint(AnchorPoint::CENTER); |
| 320 | 319 | ||
| @@ -905,7 +904,6 @@ public: // From ItemFactory | @@ -905,7 +904,6 @@ public: // From ItemFactory | ||
| 905 | // Add a checkbox child actor; invisible until edit-mode is enabled | 904 | // Add a checkbox child actor; invisible until edit-mode is enabled |
| 906 | 905 | ||
| 907 | ImageActor checkbox = ImageActor::New( mWhiteImage ); | 906 | ImageActor checkbox = ImageActor::New( mWhiteImage ); |
| 908 | - checkbox.SetRelayoutEnabled( false ); | ||
| 909 | checkbox.SetName( "CheckBox" ); | 907 | checkbox.SetName( "CheckBox" ); |
| 910 | checkbox.SetColor( Vector4(0.0f,0.0f,0.0f,0.6f) ); | 908 | checkbox.SetColor( Vector4(0.0f,0.0f,0.0f,0.6f) ); |
| 911 | checkbox.SetParentOrigin( ParentOrigin::TOP_RIGHT ); | 909 | checkbox.SetParentOrigin( ParentOrigin::TOP_RIGHT ); |
| @@ -922,7 +920,6 @@ public: // From ItemFactory | @@ -922,7 +920,6 @@ public: // From ItemFactory | ||
| 922 | actor.Add( checkbox ); | 920 | actor.Add( checkbox ); |
| 923 | 921 | ||
| 924 | ImageActor tick = ImageActor::New( ResourceImage::New(SELECTED_IMAGE) ); | 922 | ImageActor tick = ImageActor::New( ResourceImage::New(SELECTED_IMAGE) ); |
| 925 | - tick.SetRelayoutEnabled( false ); | ||
| 926 | tick.SetColorMode( USE_OWN_COLOR ); | 923 | tick.SetColorMode( USE_OWN_COLOR ); |
| 927 | tick.SetName( "Tick" ); | 924 | tick.SetName( "Tick" ); |
| 928 | tick.SetParentOrigin( ParentOrigin::TOP_RIGHT ); | 925 | tick.SetParentOrigin( ParentOrigin::TOP_RIGHT ); |
| @@ -1010,7 +1007,6 @@ private: | @@ -1010,7 +1007,6 @@ private: | ||
| 1010 | slider.Add( text ); | 1007 | slider.Add( text ); |
| 1011 | 1008 | ||
| 1012 | Actor textContainer = Actor::New(); | 1009 | Actor textContainer = Actor::New(); |
| 1013 | - textContainer.SetRelayoutEnabled( true ); | ||
| 1014 | textContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 1010 | textContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 1015 | mAlphaFunctionText = TextLabel::New( ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex] ); | 1011 | mAlphaFunctionText = TextLabel::New( ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex] ); |
| 1016 | mAlphaFunctionText.SetAnchorPoint( ParentOrigin::CENTER ); | 1012 | mAlphaFunctionText.SetAnchorPoint( ParentOrigin::CENTER ); |
| @@ -1029,7 +1025,6 @@ private: | @@ -1029,7 +1025,6 @@ private: | ||
| 1029 | text.SetSize( 0.0f, LABEL_TEXT_SIZE_Y ); | 1025 | text.SetSize( 0.0f, LABEL_TEXT_SIZE_Y ); |
| 1030 | textContainer.Add( text ); | 1026 | textContainer.Add( text ); |
| 1031 | 1027 | ||
| 1032 | - mMenu.MarkDirtyForRelayout(); | ||
| 1033 | mMenu.Show(); | 1028 | mMenu.Show(); |
| 1034 | mMenuShown = true; | 1029 | mMenuShown = true; |
| 1035 | } | 1030 | } |
examples/magnifier/magnifier-example.cpp
| @@ -219,14 +219,12 @@ public: | @@ -219,14 +219,12 @@ public: | ||
| 219 | 219 | ||
| 220 | // Create magnifier (controlled by human touch) | 220 | // Create magnifier (controlled by human touch) |
| 221 | Layer overlay = Layer::New(); | 221 | Layer overlay = Layer::New(); |
| 222 | - overlay.SetRelayoutEnabled( false ); | ||
| 223 | overlay.SetSensitive(false); | 222 | overlay.SetSensitive(false); |
| 224 | overlay.SetParentOrigin( ParentOrigin::CENTER ); | 223 | overlay.SetParentOrigin( ParentOrigin::CENTER ); |
| 225 | overlay.SetSize(mStageSize); | 224 | overlay.SetSize(mStageSize); |
| 226 | Stage::GetCurrent().Add(overlay); | 225 | Stage::GetCurrent().Add(overlay); |
| 227 | 226 | ||
| 228 | mMagnifier = Toolkit::Magnifier::New(); | 227 | mMagnifier = Toolkit::Magnifier::New(); |
| 229 | - mMagnifier.SetRelayoutEnabled( false ); | ||
| 230 | mMagnifier.SetSourceActor( mView.GetBackgroundLayer() ); | 228 | mMagnifier.SetSourceActor( mView.GetBackgroundLayer() ); |
| 231 | mMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width | 229 | mMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width |
| 232 | mMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR ); | 230 | mMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR ); |
| @@ -234,7 +232,7 @@ public: | @@ -234,7 +232,7 @@ public: | ||
| 234 | overlay.Add( mMagnifier ); | 232 | overlay.Add( mMagnifier ); |
| 235 | 233 | ||
| 236 | // Apply constraint to animate the position of the magnifier. | 234 | // Apply constraint to animate the position of the magnifier. |
| 237 | - Constraint constraint = Constraint::New<Vector3>( mMagnifier, Actor::Property::POSITION, ConfinementConstraint(ParentOrigin::CENTER, Vector2::ONE * MAGNIFIER_INDENT, Vector2::ONE * MAGNIFIER_INDENT) ); | 235 | + Constraint constraint = Constraint::New<Vector3>( mMagnifier, Actor::Property::POSITION, ConfinementConstraint(Vector3( 0.5f, 0.5f, 0.0f ), Vector2::ONE * MAGNIFIER_INDENT, Vector2::ONE * MAGNIFIER_INDENT) ); |
| 238 | constraint.AddSource( LocalSource(Actor::Property::SIZE) ); | 236 | constraint.AddSource( LocalSource(Actor::Property::SIZE) ); |
| 239 | constraint.AddSource( LocalSource(Actor::Property::PARENT_ORIGIN) ); | 237 | constraint.AddSource( LocalSource(Actor::Property::PARENT_ORIGIN) ); |
| 240 | constraint.AddSource( LocalSource(Actor::Property::ANCHOR_POINT) ); | 238 | constraint.AddSource( LocalSource(Actor::Property::ANCHOR_POINT) ); |
| @@ -244,7 +242,6 @@ public: | @@ -244,7 +242,6 @@ public: | ||
| 244 | 242 | ||
| 245 | // Create bouncing magnifier automatically bounces around screen. | 243 | // Create bouncing magnifier automatically bounces around screen. |
| 246 | mBouncingMagnifier = Toolkit::Magnifier::New(); | 244 | mBouncingMagnifier = Toolkit::Magnifier::New(); |
| 247 | - mBouncingMagnifier.SetRelayoutEnabled( false ); | ||
| 248 | mBouncingMagnifier.SetSourceActor( mView.GetBackgroundLayer() ); | 245 | mBouncingMagnifier.SetSourceActor( mView.GetBackgroundLayer() ); |
| 249 | mBouncingMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width | 246 | mBouncingMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width |
| 250 | mBouncingMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR ); | 247 | mBouncingMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR ); |
examples/motion-blur/motion-blur-example.cpp
| @@ -92,18 +92,14 @@ const float ORIENTATION_DURATION = 0.5f; ///< Time to rotate to | @@ -92,18 +92,14 @@ const float ORIENTATION_DURATION = 0.5f; ///< Time to rotate to | ||
| 92 | /** | 92 | /** |
| 93 | * @brief Load an image, scaled-down to no more than the dimensions passed in. | 93 | * @brief Load an image, scaled-down to no more than the dimensions passed in. |
| 94 | * | 94 | * |
| 95 | - * Uses ImageAttributes::ShrinkToFit which ensures the resulting image is | 95 | + * Uses SHRINK_TO_FIT which ensures the resulting image is |
| 96 | * smaller than or equal to the specified dimensions while preserving its | 96 | * smaller than or equal to the specified dimensions while preserving its |
| 97 | * original aspect ratio. | 97 | * original aspect ratio. |
| 98 | */ | 98 | */ |
| 99 | ResourceImage LoadImageFittedInBox( const char * const imagePath, uint32_t maxWidth, uint32_t maxHeight ) | 99 | ResourceImage LoadImageFittedInBox( const char * const imagePath, uint32_t maxWidth, uint32_t maxHeight ) |
| 100 | { | 100 | { |
| 101 | // Load the image nicely scaled-down to fit within the specified max width and height: | 101 | // Load the image nicely scaled-down to fit within the specified max width and height: |
| 102 | - ImageAttributes attributes; | ||
| 103 | - attributes.SetSize( maxWidth, maxHeight); | ||
| 104 | - attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); | ||
| 105 | - attributes.SetScalingMode( ImageAttributes::ShrinkToFit ); | ||
| 106 | - return ResourceImage::New( imagePath, attributes ); | 102 | + return ResourceImage::New( imagePath, ImageDimensions( maxWidth, maxHeight ), FittingMode::SHRINK_TO_FIT, Dali::SamplingMode::BOX_THEN_LINEAR ); |
| 107 | } | 103 | } |
| 108 | 104 | ||
| 109 | } // unnamed namespace | 105 | } // unnamed namespace |
| @@ -193,8 +189,8 @@ public: | @@ -193,8 +189,8 @@ public: | ||
| 193 | winHandle.AddAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE ); | 189 | winHandle.AddAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE ); |
| 194 | 190 | ||
| 195 | // set initial orientation | 191 | // set initial orientation |
| 196 | - app.GetOrientation().ChangedSignal().Connect( this, &MotionBlurExampleApp::OnOrientationChanged ); | ||
| 197 | - unsigned int degrees = app.GetOrientation().GetDegrees(); | 192 | + winHandle.GetOrientation().ChangedSignal().Connect( this, &MotionBlurExampleApp::OnOrientationChanged ); |
| 193 | + unsigned int degrees = winHandle.GetOrientation().GetDegrees(); | ||
| 198 | Rotate( static_cast< DeviceOrientation >( degrees ) ); | 194 | Rotate( static_cast< DeviceOrientation >( degrees ) ); |
| 199 | 195 | ||
| 200 | 196 |
examples/motion-stretch/motion-stretch-example.cpp
| @@ -166,8 +166,8 @@ public: | @@ -166,8 +166,8 @@ public: | ||
| 166 | winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT_INVERSE ); | 166 | winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT_INVERSE ); |
| 167 | winHandle.AddAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE ); | 167 | winHandle.AddAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE ); |
| 168 | 168 | ||
| 169 | - app.GetOrientation().ChangedSignal().Connect( this, &MotionStretchExampleApp::OnOrientationChanged ); | ||
| 170 | - unsigned int degrees = app.GetOrientation().GetDegrees(); | 169 | + winHandle.GetOrientation().ChangedSignal().Connect( this, &MotionStretchExampleApp::OnOrientationChanged ); |
| 170 | + unsigned int degrees = winHandle.GetOrientation().GetDegrees(); | ||
| 171 | Rotate( static_cast< DeviceOrientation >( degrees ) ); | 171 | Rotate( static_cast< DeviceOrientation >( degrees ) ); |
| 172 | 172 | ||
| 173 | 173 |
examples/new-window/new-window-example.cpp
| @@ -222,8 +222,9 @@ FrameBufferImage NewWindowController::CreateMirrorImage(const char* imageName) | @@ -222,8 +222,9 @@ FrameBufferImage NewWindowController::CreateMirrorImage(const char* imageName) | ||
| 222 | ImageActor NewWindowController::CreateBlurredMirrorImage(const char* imageName) | 222 | ImageActor NewWindowController::CreateBlurredMirrorImage(const char* imageName) |
| 223 | { | 223 | { |
| 224 | FrameBufferImage fbo; | 224 | FrameBufferImage fbo; |
| 225 | - Image image = ResourceImage::New( imageName ); | ||
| 226 | - Vector2 FBOSize = ResourceImage::GetImageSize(imageName); | 225 | + Image image = ResourceImage::New(imageName); |
| 226 | + Uint16Pair intFboSize = ResourceImage::GetImageSize(imageName); | ||
| 227 | + Vector2 FBOSize = Vector2( intFboSize.GetWidth(), intFboSize.GetHeight() ); | ||
| 227 | fbo = FrameBufferImage::New( FBOSize.width, FBOSize.height, Pixel::RGBA8888); | 228 | fbo = FrameBufferImage::New( FBOSize.width, FBOSize.height, Pixel::RGBA8888); |
| 228 | GaussianBlurView gbv = GaussianBlurView::New(5, 2.0f, Pixel::RGBA8888, 0.5f, 0.5f, true); | 229 | GaussianBlurView gbv = GaussianBlurView::New(5, 2.0f, Pixel::RGBA8888, 0.5f, 0.5f, true); |
| 229 | gbv.SetBackgroundColor(Color::TRANSPARENT); | 230 | gbv.SetBackgroundColor(Color::TRANSPARENT); |
| @@ -241,7 +242,8 @@ ImageActor NewWindowController::CreateBlurredMirrorImage(const char* imageName) | @@ -241,7 +242,8 @@ ImageActor NewWindowController::CreateBlurredMirrorImage(const char* imageName) | ||
| 241 | FrameBufferImage NewWindowController::CreateFrameBufferForImage(const char* imageName, Image image, ShaderEffect shaderEffect) | 242 | FrameBufferImage NewWindowController::CreateFrameBufferForImage(const char* imageName, Image image, ShaderEffect shaderEffect) |
| 242 | { | 243 | { |
| 243 | Stage stage = Stage::GetCurrent(); | 244 | Stage stage = Stage::GetCurrent(); |
| 244 | - Vector2 FBOSize = ResourceImage::GetImageSize(imageName); | 245 | + Uint16Pair intFboSize = ResourceImage::GetImageSize(imageName); |
| 246 | + Vector2 FBOSize = Vector2(intFboSize.GetWidth(), intFboSize.GetHeight()); | ||
| 245 | 247 | ||
| 246 | FrameBufferImage framebuffer = FrameBufferImage::New(FBOSize.x, FBOSize.y ); | 248 | FrameBufferImage framebuffer = FrameBufferImage::New(FBOSize.x, FBOSize.y ); |
| 247 | 249 | ||
| @@ -264,7 +266,6 @@ FrameBufferImage NewWindowController::CreateFrameBufferForImage(const char* imag | @@ -264,7 +266,6 @@ FrameBufferImage NewWindowController::CreateFrameBufferForImage(const char* imag | ||
| 264 | cameraActor.SetNearClippingPlane(1.0f); | 266 | cameraActor.SetNearClippingPlane(1.0f); |
| 265 | cameraActor.SetAspectRatio(FBOSize.width / FBOSize.height); | 267 | cameraActor.SetAspectRatio(FBOSize.width / FBOSize.height); |
| 266 | cameraActor.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor | 268 | cameraActor.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor |
| 267 | - cameraActor.SetOrientation(Quaternion(M_PI, Vector3::YAXIS)); | ||
| 268 | cameraActor.SetPosition(0.0f, 0.0f, ((FBOSize.height * 0.5f) / tanf(Math::PI * 0.125f))); | 269 | cameraActor.SetPosition(0.0f, 0.0f, ((FBOSize.height * 0.5f) / tanf(Math::PI * 0.125f))); |
| 269 | stage.Add(cameraActor); | 270 | stage.Add(cameraActor); |
| 270 | 271 |
examples/page-turn-view/page-turn-view-example.cpp
| @@ -91,8 +91,6 @@ class PortraitPageFactory : public PageFactory | @@ -91,8 +91,6 @@ class PortraitPageFactory : public PageFactory | ||
| 91 | page = ImageActor::New( ResourceImage::New( PAGE_IMAGES_PORTRAIT[ (pageId-1) % NUMBER_OF_PORTRAIT_IMAGE ] ) ); | 91 | page = ImageActor::New( ResourceImage::New( PAGE_IMAGES_PORTRAIT[ (pageId-1) % NUMBER_OF_PORTRAIT_IMAGE ] ) ); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | - page.SetRelayoutEnabled( false ); | ||
| 95 | - | ||
| 96 | return page; | 94 | return page; |
| 97 | } | 95 | } |
| 98 | }; | 96 | }; |
| @@ -129,9 +127,6 @@ class LandscapePageFactory : public PageFactory | @@ -129,9 +127,6 @@ class LandscapePageFactory : public PageFactory | ||
| 129 | } | 127 | } |
| 130 | pageFront.Add(pageBack); | 128 | pageFront.Add(pageBack); |
| 131 | 129 | ||
| 132 | - pageFront.SetRelayoutEnabled( false ); | ||
| 133 | - pageBack.SetRelayoutEnabled( false ); | ||
| 134 | - | ||
| 135 | return pageFront; | 130 | return pageFront; |
| 136 | } | 131 | } |
| 137 | }; | 132 | }; |
| @@ -237,7 +232,6 @@ void PageTurnController::OnInit( Application& app ) | @@ -237,7 +232,6 @@ void PageTurnController::OnInit( Application& app ) | ||
| 237 | 232 | ||
| 238 | // Create default View. | 233 | // Create default View. |
| 239 | mView = View::New(); | 234 | mView = View::New(); |
| 240 | - mView.SetRelayoutEnabled( false ); | ||
| 241 | stage.Add( mView ); | 235 | stage.Add( mView ); |
| 242 | 236 | ||
| 243 | Dali::Window winHandle = app.GetWindow(); | 237 | Dali::Window winHandle = app.GetWindow(); |
| @@ -251,7 +245,6 @@ void PageTurnController::OnInit( Application& app ) | @@ -251,7 +245,6 @@ void PageTurnController::OnInit( Application& app ) | ||
| 251 | mView.OrientationAnimationStartedSignal().Connect( this, &PageTurnController::OnOrientationAnimationStarted ); | 245 | mView.OrientationAnimationStartedSignal().Connect( this, &PageTurnController::OnOrientationAnimationStarted ); |
| 252 | 246 | ||
| 253 | mPageTurnPortraitView = PageTurnPortraitView::New( mPortraitPageFactory, stageSize ); | 247 | mPageTurnPortraitView = PageTurnPortraitView::New( mPortraitPageFactory, stageSize ); |
| 254 | - mPageTurnPortraitView.SetRelayoutEnabled( false ); | ||
| 255 | mPageTurnPortraitView.SetSpineShadowParameter( Vector2(70.f, 30.f) ); | 248 | mPageTurnPortraitView.SetSpineShadowParameter( Vector2(70.f, 30.f) ); |
| 256 | mPageTurnPortraitView.PageTurnStartedSignal().Connect( this, &PageTurnController::OnPageStartedTurn ); | 249 | mPageTurnPortraitView.PageTurnStartedSignal().Connect( this, &PageTurnController::OnPageStartedTurn ); |
| 257 | mPageTurnPortraitView.PageTurnFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedTurn ); | 250 | mPageTurnPortraitView.PageTurnFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedTurn ); |
| @@ -260,7 +253,6 @@ void PageTurnController::OnInit( Application& app ) | @@ -260,7 +253,6 @@ void PageTurnController::OnInit( Application& app ) | ||
| 260 | mPageTurnPortraitView.SetPositionInheritanceMode( USE_PARENT_POSITION ); | 253 | mPageTurnPortraitView.SetPositionInheritanceMode( USE_PARENT_POSITION ); |
| 261 | 254 | ||
| 262 | mPageTurnLandscapeView = PageTurnLandscapeView::New( mLandscapePageFactory, Vector2(stageSize.y*0.5f, stageSize.x) ); | 255 | mPageTurnLandscapeView = PageTurnLandscapeView::New( mLandscapePageFactory, Vector2(stageSize.y*0.5f, stageSize.x) ); |
| 263 | - mPageTurnLandscapeView.SetRelayoutEnabled( false ); | ||
| 264 | mPageTurnLandscapeView.PageTurnStartedSignal().Connect( this, &PageTurnController::OnPageStartedTurn ); | 256 | mPageTurnLandscapeView.PageTurnStartedSignal().Connect( this, &PageTurnController::OnPageStartedTurn ); |
| 265 | mPageTurnLandscapeView.PageTurnFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedTurn ); | 257 | mPageTurnLandscapeView.PageTurnFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedTurn ); |
| 266 | mPageTurnLandscapeView.PagePanStartedSignal().Connect( this, &PageTurnController::OnPageStartedPan ); | 258 | mPageTurnLandscapeView.PagePanStartedSignal().Connect( this, &PageTurnController::OnPageStartedPan ); |
examples/path-animation/path-animation.cpp
| @@ -70,7 +70,6 @@ public: | @@ -70,7 +70,6 @@ public: | ||
| 70 | text.SetColor( Vector4(0.0f,0.0f,0.0f,1.0f)); | 70 | text.SetColor( Vector4(0.0f,0.0f,0.0f,1.0f)); |
| 71 | 71 | ||
| 72 | Slider slider = Slider::New(); | 72 | Slider slider = Slider::New(); |
| 73 | - slider.SetRelayoutEnabled( false ); | ||
| 74 | slider.SetAnchorPoint( AnchorPoint::CENTER_LEFT); | 73 | slider.SetAnchorPoint( AnchorPoint::CENTER_LEFT); |
| 75 | slider.SetParentOrigin( ParentOrigin::CENTER_RIGHT); | 74 | slider.SetParentOrigin( ParentOrigin::CENTER_RIGHT); |
| 76 | slider.SetProperty(Slider::Property::LOWER_BOUND, -1.0f ); | 75 | slider.SetProperty(Slider::Property::LOWER_BOUND, -1.0f ); |
| @@ -102,8 +101,8 @@ public: | @@ -102,8 +101,8 @@ public: | ||
| 102 | 101 | ||
| 103 | //TextInput | 102 | //TextInput |
| 104 | Dali::Layer controlsLayer = Dali::Layer::New(); | 103 | Dali::Layer controlsLayer = Dali::Layer::New(); |
| 105 | - controlsLayer.SetRelayoutEnabled( false ); | ||
| 106 | - controlsLayer.SetSize( stage.GetSize().x, stage.GetSize().y*0.3f, 0.0 ); | 104 | + controlsLayer.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 105 | + controlsLayer.SetSizeModeFactor( Vector3( 1.0f, 0.3f, 1.0f ) ); | ||
| 107 | controlsLayer.SetPosition( 0.0f, stage.GetSize().y*0.8f, 0.0f ); | 106 | controlsLayer.SetPosition( 0.0f, stage.GetSize().y*0.8f, 0.0f ); |
| 108 | controlsLayer.SetAnchorPoint( AnchorPoint::TOP_LEFT); | 107 | controlsLayer.SetAnchorPoint( AnchorPoint::TOP_LEFT); |
| 109 | controlsLayer.SetParentOrigin( ParentOrigin::TOP_LEFT); | 108 | controlsLayer.SetParentOrigin( ParentOrigin::TOP_LEFT); |
| @@ -202,7 +201,6 @@ public: | @@ -202,7 +201,6 @@ public: | ||
| 202 | if( !mControlPoint[index] ) | 201 | if( !mControlPoint[index] ) |
| 203 | { | 202 | { |
| 204 | mControlPoint[index] = Toolkit::CreateSolidColorActor(Vector4(1.0f,1.0f,1.0f,1.0f)); | 203 | mControlPoint[index] = Toolkit::CreateSolidColorActor(Vector4(1.0f,1.0f,1.0f,1.0f)); |
| 205 | - mControlPoint[index].SetRelayoutEnabled( false ); | ||
| 206 | mControlPoint[index].SetParentOrigin( ParentOrigin::TOP_LEFT); | 204 | mControlPoint[index].SetParentOrigin( ParentOrigin::TOP_LEFT); |
| 207 | mControlPoint[index].SetAnchorPoint( AnchorPoint::CENTER ); | 205 | mControlPoint[index].SetAnchorPoint( AnchorPoint::CENTER ); |
| 208 | mControlPoint[index].SetSize( 20.0f, 20.0f ); | 206 | mControlPoint[index].SetSize( 20.0f, 20.0f ); |
| @@ -224,7 +222,6 @@ public: | @@ -224,7 +222,6 @@ public: | ||
| 224 | if( !mControlPoint[index]) | 222 | if( !mControlPoint[index]) |
| 225 | { | 223 | { |
| 226 | mControlPoint[index] = Toolkit::CreateSolidColorActor(Vector4(1.0f,1.0f,1.0f,1.0f)); | 224 | mControlPoint[index] = Toolkit::CreateSolidColorActor(Vector4(1.0f,1.0f,1.0f,1.0f)); |
| 227 | - mControlPoint[index].SetRelayoutEnabled( false ); | ||
| 228 | mControlPoint[index].SetParentOrigin( ParentOrigin::TOP_LEFT); | 225 | mControlPoint[index].SetParentOrigin( ParentOrigin::TOP_LEFT); |
| 229 | mControlPoint[index].SetAnchorPoint( AnchorPoint::CENTER ); | 226 | mControlPoint[index].SetAnchorPoint( AnchorPoint::CENTER ); |
| 230 | mControlPoint[index].SetSize( 20.0f, 20.0f ); | 227 | mControlPoint[index].SetSize( 20.0f, 20.0f ); |
| @@ -470,10 +467,8 @@ public: | @@ -470,10 +467,8 @@ public: | ||
| 470 | DrawPath( 200u ); | 467 | DrawPath( 200u ); |
| 471 | 468 | ||
| 472 | //Actor | 469 | //Actor |
| 473 | - ImageAttributes attributes; | ||
| 474 | - Image img = ResourceImage::New(ACTOR_IMAGE, attributes ); | 470 | + Image img = ResourceImage::New(ACTOR_IMAGE); |
| 475 | mActor = ImageActor::New( img ); | 471 | mActor = ImageActor::New( img ); |
| 476 | - mActor.SetRelayoutEnabled( false ); | ||
| 477 | mActor.SetAnchorPoint( AnchorPoint::CENTER ); | 472 | mActor.SetAnchorPoint( AnchorPoint::CENTER ); |
| 478 | mActor.SetSize( 100, 50, 1 ); | 473 | mActor.SetSize( 100, 50, 1 ); |
| 479 | stage.Add( mActor ); | 474 | stage.Add( mActor ); |
examples/radial-menu/radial-menu-example.cpp
| @@ -149,7 +149,9 @@ void RadialMenuExample::OnInit(Application& app) | @@ -149,7 +149,9 @@ void RadialMenuExample::OnInit(Application& app) | ||
| 149 | Toolkit::Alignment::HorizontalRight, | 149 | Toolkit::Alignment::HorizontalRight, |
| 150 | DemoHelper::DEFAULT_PLAY_PADDING ); | 150 | DemoHelper::DEFAULT_PLAY_PADDING ); |
| 151 | 151 | ||
| 152 | - Vector2 imgSize = ResourceImage::GetImageSize(TEST_OUTER_RING_FILENAME); | 152 | + |
| 153 | + const Uint16Pair intImgSize = ResourceImage::GetImageSize(TEST_OUTER_RING_FILENAME); | ||
| 154 | + Vector2 imgSize = Vector2( intImgSize.GetWidth(), intImgSize.GetHeight() ); | ||
| 153 | Vector2 stageSize = stage.GetSize(); | 155 | Vector2 stageSize = stage.GetSize(); |
| 154 | float minStageDimension = std::min(stageSize.width, stageSize.height); | 156 | float minStageDimension = std::min(stageSize.width, stageSize.height); |
| 155 | 157 | ||
| @@ -248,8 +250,8 @@ RadialSweepView RadialMenuExample::CreateSweepView( std::string imageName, | @@ -248,8 +250,8 @@ RadialSweepView RadialMenuExample::CreateSweepView( std::string imageName, | ||
| 248 | mImageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); | 250 | mImageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); |
| 249 | 251 | ||
| 250 | // Create the stencil | 252 | // Create the stencil |
| 251 | - Vector2 imageSize = ResourceImage::GetImageSize(imageName); | ||
| 252 | - float diameter = std::max(imageSize.width, imageSize.height); | 253 | + const Uint16Pair imageSize = ResourceImage::GetImageSize(imageName); |
| 254 | + float diameter = std::max(imageSize.GetWidth(), imageSize.GetHeight()); | ||
| 253 | RadialSweepView radialSweepView = RadialSweepView::New(); | 255 | RadialSweepView radialSweepView = RadialSweepView::New(); |
| 254 | radialSweepView.SetDiameter( diameter ); | 256 | radialSweepView.SetDiameter( diameter ); |
| 255 | radialSweepView.SetInitialAngle( initialAngle ); | 257 | radialSweepView.SetInitialAngle( initialAngle ); |
examples/radial-menu/radial-sweep-view-impl.cpp
| @@ -26,10 +26,8 @@ namespace | @@ -26,10 +26,8 @@ namespace | ||
| 26 | * Method to project a point on a circle of radius halfSide at given | 26 | * Method to project a point on a circle of radius halfSide at given |
| 27 | * angle onto a square of side 2 * halfSide | 27 | * angle onto a square of side 2 * halfSide |
| 28 | */ | 28 | */ |
| 29 | -void CircleSquareProjection( Vector3& position, Degree angle, float halfSide ) | 29 | +void CircleSquareProjection( Vector3& position, Radian angle, float halfSide ) |
| 30 | { | 30 | { |
| 31 | - Radian angleInRadians(angle); | ||
| 32 | - | ||
| 33 | // 135 90 45 | 31 | // 135 90 45 |
| 34 | // +--+--+ | 32 | // +--+--+ |
| 35 | // | \|/ | | 33 | // | \|/ | |
| @@ -37,25 +35,25 @@ void CircleSquareProjection( Vector3& position, Degree angle, float halfSide ) | @@ -37,25 +35,25 @@ void CircleSquareProjection( Vector3& position, Degree angle, float halfSide ) | ||
| 37 | // | /|\ | | 35 | // | /|\ | |
| 38 | // +--+--+ | 36 | // +--+--+ |
| 39 | // 225 270 315 | 37 | // 225 270 315 |
| 40 | - if( angle >= 45.0f && angle < 135.0f ) | 38 | + if( angle >= Dali::ANGLE_45 && angle < Dali::ANGLE_135 ) |
| 41 | { | 39 | { |
| 42 | - position.x = halfSide * cosf(angleInRadians) / sinf(angleInRadians); | 40 | + position.x = halfSide * cosf(angle) / sinf(angle); |
| 43 | position.y = -halfSide; | 41 | position.y = -halfSide; |
| 44 | } | 42 | } |
| 45 | - else if( angle >= 135.0f && angle < 225.0f ) | 43 | + else if( angle >= Dali::ANGLE_135 && angle < Dali::ANGLE_225 ) |
| 46 | { | 44 | { |
| 47 | position.x = -halfSide; | 45 | position.x = -halfSide; |
| 48 | - position.y = halfSide * sinf(angleInRadians) / cosf(angleInRadians); | 46 | + position.y = halfSide * sinf(angle) / cosf(angle); |
| 49 | } | 47 | } |
| 50 | - else if( angle >= 225.0f && angle < 315.0f ) | 48 | + else if( angle >= Dali::ANGLE_225 && angle < Dali::ANGLE_315 ) |
| 51 | { | 49 | { |
| 52 | - position.x = -halfSide * cosf(angleInRadians) / sinf(angleInRadians); | 50 | + position.x = -halfSide * cosf(angle) / sinf(angle); |
| 53 | position.y = halfSide; | 51 | position.y = halfSide; |
| 54 | } | 52 | } |
| 55 | else | 53 | else |
| 56 | { | 54 | { |
| 57 | position.x = halfSide; | 55 | position.x = halfSide; |
| 58 | - position.y = -halfSide * sinf(angleInRadians) / cosf(angleInRadians); | 56 | + position.y = -halfSide * sinf(angle) / cosf(angle); |
| 59 | } | 57 | } |
| 60 | 58 | ||
| 61 | position.z = 0.0f; | 59 | position.z = 0.0f; |
| @@ -133,7 +131,7 @@ RadialSweepView RadialSweepViewImpl::New( float duration, float diameter, Degree | @@ -133,7 +131,7 @@ RadialSweepView RadialSweepViewImpl::New( float duration, float diameter, Degree | ||
| 133 | } | 131 | } |
| 134 | 132 | ||
| 135 | RadialSweepViewImpl::RadialSweepViewImpl( float duration, float diameter, Degree initialAngle, Degree finalAngle, Degree initialSector, Degree finalSector ) | 133 | RadialSweepViewImpl::RadialSweepViewImpl( float duration, float diameter, Degree initialAngle, Degree finalAngle, Degree initialSector, Degree finalSector ) |
| 136 | -: Control( CONTROL_BEHAVIOUR_NONE ), | 134 | +: Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ), |
| 137 | mDuration(duration), | 135 | mDuration(duration), |
| 138 | mDiameter(diameter), | 136 | mDiameter(diameter), |
| 139 | mInitialAngle(initialAngle), | 137 | mInitialAngle(initialAngle), |
| @@ -273,7 +271,7 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura | @@ -273,7 +271,7 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura | ||
| 273 | } | 271 | } |
| 274 | 272 | ||
| 275 | mStencilActor.SetOrientation( Degree(mInitialAngle), Vector3::ZAXIS ); | 273 | mStencilActor.SetOrientation( Degree(mInitialAngle), Vector3::ZAXIS ); |
| 276 | - mStencilActor.SetProperty( mRotationAngleIndex, static_cast<float>(mInitialSector) ); | 274 | + mStencilActor.SetProperty( mRotationAngleIndex, mInitialSector.degree ); |
| 277 | 275 | ||
| 278 | if( mRotateActors ) | 276 | if( mRotateActors ) |
| 279 | { | 277 | { |
| @@ -282,13 +280,13 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura | @@ -282,13 +280,13 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura | ||
| 282 | Actor actor = mLayer.GetChildAt(i); | 280 | Actor actor = mLayer.GetChildAt(i); |
| 283 | if( actor != mStencilActor ) | 281 | if( actor != mStencilActor ) |
| 284 | { | 282 | { |
| 285 | - anim.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( mInitialActorAngle ) ), Vector3::ZAXIS ) ); | 283 | + anim.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( mInitialActorAngle ), Vector3::ZAXIS ) ); |
| 286 | } | 284 | } |
| 287 | } | 285 | } |
| 288 | } | 286 | } |
| 289 | 287 | ||
| 290 | - anim.AnimateTo( Property( mStencilActor, mRotationAngleIndex ), static_cast<float>(mFinalSector), mEasingFunction, TimePeriod( offsetTime, duration ) ); | ||
| 291 | - anim.AnimateTo( Property( mStencilActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( mFinalAngle ) ), Vector3::ZAXIS ), mEasingFunction, TimePeriod( offsetTime, duration ) ); | 288 | + anim.AnimateTo( Property( mStencilActor, mRotationAngleIndex ), mFinalSector.degree, mEasingFunction, TimePeriod( offsetTime, duration ) ); |
| 289 | + anim.AnimateTo( Property( mStencilActor, Actor::Property::ORIENTATION ), Quaternion( Radian( mFinalAngle ), Vector3::ZAXIS ), mEasingFunction, TimePeriod( offsetTime, duration ) ); | ||
| 292 | 290 | ||
| 293 | if( mRotateActorsWithStencil ) | 291 | if( mRotateActorsWithStencil ) |
| 294 | { | 292 | { |
| @@ -297,7 +295,7 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura | @@ -297,7 +295,7 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura | ||
| 297 | Actor actor = mLayer.GetChildAt(i); | 295 | Actor actor = mLayer.GetChildAt(i); |
| 298 | if( actor != mStencilActor ) | 296 | if( actor != mStencilActor ) |
| 299 | { | 297 | { |
| 300 | - anim.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( mFinalAngle - mInitialAngle ) ), Vector3::ZAXIS ), mEasingFunction, TimePeriod( offsetTime, duration ) ); | 298 | + anim.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( mFinalAngle.degree - mInitialAngle.degree ) ), Vector3::ZAXIS ), mEasingFunction, TimePeriod( offsetTime, duration ) ); |
| 301 | } | 299 | } |
| 302 | } | 300 | } |
| 303 | } | 301 | } |
| @@ -308,7 +306,7 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura | @@ -308,7 +306,7 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura | ||
| 308 | Actor actor = mLayer.GetChildAt(i); | 306 | Actor actor = mLayer.GetChildAt(i); |
| 309 | if( actor != mStencilActor ) | 307 | if( actor != mStencilActor ) |
| 310 | { | 308 | { |
| 311 | - anim.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( mFinalActorAngle ) ), Vector3::ZAXIS ), mEasingFunction, TimePeriod( offsetTime, duration ) ); | 309 | + anim.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( mFinalActorAngle ), Vector3::ZAXIS ), mEasingFunction, TimePeriod( offsetTime, duration ) ); |
| 312 | } | 310 | } |
| 313 | } | 311 | } |
| 314 | } | 312 | } |
| @@ -357,10 +355,10 @@ void RadialSweepViewImpl::CreateStencil( Degree initialSector ) | @@ -357,10 +355,10 @@ void RadialSweepViewImpl::CreateStencil( Degree initialSector ) | ||
| 357 | mStencilActor.SetCullFace(CullNone); // Allow clockwise & anticlockwise faces | 355 | mStencilActor.SetCullFace(CullNone); // Allow clockwise & anticlockwise faces |
| 358 | 356 | ||
| 359 | mStartAngleIndex = mStencilActor.RegisterProperty("start-angle", Property::Value(0.0f)); | 357 | mStartAngleIndex = mStencilActor.RegisterProperty("start-angle", Property::Value(0.0f)); |
| 360 | - mRotationAngleIndex = mStencilActor.RegisterProperty("rotation-angle", Property::Value(initialSector)); | 358 | + mRotationAngleIndex = mStencilActor.RegisterProperty("rotation-angle", Property::Value(initialSector.degree)); |
| 361 | 359 | ||
| 362 | Source srcStart( mStencilActor, mStartAngleIndex ); | 360 | Source srcStart( mStencilActor, mStartAngleIndex ); |
| 363 | - Source srcRot( mStencilActor, mRotationAngleIndex ); | 361 | + Source srcRotation( mStencilActor, mRotationAngleIndex ); |
| 364 | 362 | ||
| 365 | // Constrain the vertices of the square mesh to sweep out a sector as the | 363 | // Constrain the vertices of the square mesh to sweep out a sector as the |
| 366 | // rotation angle is animated. | 364 | // rotation angle is animated. |
| @@ -371,27 +369,27 @@ void RadialSweepViewImpl::CreateStencil( Degree initialSector ) | @@ -371,27 +369,27 @@ void RadialSweepViewImpl::CreateStencil( Degree initialSector ) | ||
| 371 | 369 | ||
| 372 | constraint = Constraint::New<Vector3>( mMesh, mMesh.GetPropertyIndex(2, AnimatableVertex::Property::POSITION), SquareFanConstraint(0) ); | 370 | constraint = Constraint::New<Vector3>( mMesh, mMesh.GetPropertyIndex(2, AnimatableVertex::Property::POSITION), SquareFanConstraint(0) ); |
| 373 | constraint.AddSource( srcStart ); | 371 | constraint.AddSource( srcStart ); |
| 374 | - constraint.AddSource( srcRot ); | 372 | + constraint.AddSource( srcRotation ); |
| 375 | constraint.Apply(); | 373 | constraint.Apply(); |
| 376 | 374 | ||
| 377 | constraint = Constraint::New<Vector3>( mMesh, mMesh.GetPropertyIndex(3, AnimatableVertex::Property::POSITION), SquareFanConstraint(1) ); | 375 | constraint = Constraint::New<Vector3>( mMesh, mMesh.GetPropertyIndex(3, AnimatableVertex::Property::POSITION), SquareFanConstraint(1) ); |
| 378 | constraint.AddSource( srcStart ); | 376 | constraint.AddSource( srcStart ); |
| 379 | - constraint.AddSource( srcRot ); | 377 | + constraint.AddSource( srcRotation ); |
| 380 | constraint.Apply(); | 378 | constraint.Apply(); |
| 381 | 379 | ||
| 382 | constraint = Constraint::New<Vector3>( mMesh, mMesh.GetPropertyIndex(4, AnimatableVertex::Property::POSITION), SquareFanConstraint(2) ); | 380 | constraint = Constraint::New<Vector3>( mMesh, mMesh.GetPropertyIndex(4, AnimatableVertex::Property::POSITION), SquareFanConstraint(2) ); |
| 383 | constraint.AddSource( srcStart ); | 381 | constraint.AddSource( srcStart ); |
| 384 | - constraint.AddSource( srcRot ); | 382 | + constraint.AddSource( srcRotation ); |
| 385 | constraint.Apply(); | 383 | constraint.Apply(); |
| 386 | 384 | ||
| 387 | constraint = Constraint::New<Vector3>( mMesh, mMesh.GetPropertyIndex(5, AnimatableVertex::Property::POSITION), SquareFanConstraint(3) ); | 385 | constraint = Constraint::New<Vector3>( mMesh, mMesh.GetPropertyIndex(5, AnimatableVertex::Property::POSITION), SquareFanConstraint(3) ); |
| 388 | constraint.AddSource( srcStart ); | 386 | constraint.AddSource( srcStart ); |
| 389 | - constraint.AddSource( srcRot ); | 387 | + constraint.AddSource( srcRotation ); |
| 390 | constraint.Apply(); | 388 | constraint.Apply(); |
| 391 | 389 | ||
| 392 | constraint = Constraint::New<Vector3>( mMesh, mMesh.GetPropertyIndex(6, AnimatableVertex::Property::POSITION), SquareFanConstraint(4) ); | 390 | constraint = Constraint::New<Vector3>( mMesh, mMesh.GetPropertyIndex(6, AnimatableVertex::Property::POSITION), SquareFanConstraint(4) ); |
| 393 | constraint.AddSource( srcStart ); | 391 | constraint.AddSource( srcStart ); |
| 394 | - constraint.AddSource( srcRot ); | 392 | + constraint.AddSource( srcRotation ); |
| 395 | constraint.Apply(); | 393 | constraint.Apply(); |
| 396 | 394 | ||
| 397 | mStencilActor.SetDrawMode( DrawMode::STENCIL ); | 395 | mStencilActor.SetDrawMode( DrawMode::STENCIL ); |
examples/refraction-effect/refraction-effect-example.cpp
| @@ -71,19 +71,14 @@ struct LightOffsetConstraint | @@ -71,19 +71,14 @@ struct LightOffsetConstraint | ||
| 71 | /** | 71 | /** |
| 72 | * @brief Load an image, scaled-down to no more than the stage dimensions. | 72 | * @brief Load an image, scaled-down to no more than the stage dimensions. |
| 73 | * | 73 | * |
| 74 | - * Uses image scaling mode ImageAttributes::ScaleToFill to resize the image at | 74 | + * Uses image scaling mode SCALE_TO_FILL to resize the image at |
| 75 | * load time to cover the entire stage with pixels with no borders, | 75 | * load time to cover the entire stage with pixels with no borders, |
| 76 | - * and filter mode ImageAttributes::BoxThenLinear to sample the image with | ||
| 77 | - * maximum quality. | 76 | + * and filter mode BOX_THEN_LINEAR to sample the image with maximum quality. |
| 78 | */ | 77 | */ |
| 79 | ResourceImage LoadStageFillingImage( const char * const imagePath ) | 78 | ResourceImage LoadStageFillingImage( const char * const imagePath ) |
| 80 | { | 79 | { |
| 81 | Size stageSize = Stage::GetCurrent().GetSize(); | 80 | Size stageSize = Stage::GetCurrent().GetSize(); |
| 82 | - ImageAttributes attributes; | ||
| 83 | - attributes.SetSize( stageSize.x, stageSize.y ); | ||
| 84 | - attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); | ||
| 85 | - attributes.SetScalingMode( ImageAttributes::ScaleToFill ); | ||
| 86 | - return ResourceImage::New( imagePath, attributes ); | 81 | + return ResourceImage::New( imagePath, ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); |
| 87 | } | 82 | } |
| 88 | 83 | ||
| 89 | } // namespace | 84 | } // namespace |
examples/scroll-view/scroll-view-example.cpp
| @@ -228,7 +228,6 @@ private: | @@ -228,7 +228,6 @@ private: | ||
| 228 | Vector2 stageSize = stage.GetSize(); | 228 | Vector2 stageSize = stage.GetSize(); |
| 229 | 229 | ||
| 230 | mScrollView = ScrollView::New(); | 230 | mScrollView = ScrollView::New(); |
| 231 | - mScrollView.SetRelayoutEnabled( false ); | ||
| 232 | mScrollView.SetAnchorPoint(AnchorPoint::CENTER); | 231 | mScrollView.SetAnchorPoint(AnchorPoint::CENTER); |
| 233 | mScrollView.SetParentOrigin(ParentOrigin::CENTER); | 232 | mScrollView.SetParentOrigin(ParentOrigin::CENTER); |
| 234 | mContentLayer.Add( mScrollView ); | 233 | mContentLayer.Add( mScrollView ); |
| @@ -301,7 +300,6 @@ private: | @@ -301,7 +300,6 @@ private: | ||
| 301 | Actor CreatePage() | 300 | Actor CreatePage() |
| 302 | { | 301 | { |
| 303 | Actor page = Actor::New(); | 302 | Actor page = Actor::New(); |
| 304 | - page.SetRelayoutEnabled( true ); | ||
| 305 | page.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 303 | page.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 306 | page.SetParentOrigin( ParentOrigin::CENTER ); | 304 | page.SetParentOrigin( ParentOrigin::CENTER ); |
| 307 | page.SetAnchorPoint( AnchorPoint::CENTER ); | 305 | page.SetAnchorPoint( AnchorPoint::CENTER ); |
| @@ -454,7 +452,6 @@ private: | @@ -454,7 +452,6 @@ private: | ||
| 454 | void ApplyEffectToPage(Actor page) | 452 | void ApplyEffectToPage(Actor page) |
| 455 | { | 453 | { |
| 456 | page.RemoveConstraints(); | 454 | page.RemoveConstraints(); |
| 457 | - page.SetRelayoutEnabled( true ); | ||
| 458 | page.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 455 | page.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 459 | 456 | ||
| 460 | switch( mEffectMode ) | 457 | switch( mEffectMode ) |
| @@ -564,14 +561,9 @@ private: | @@ -564,14 +561,9 @@ private: | ||
| 564 | */ | 561 | */ |
| 565 | ImageActor CreateImage( const std::string& filename, unsigned int width = IMAGE_THUMBNAIL_WIDTH, unsigned int height = IMAGE_THUMBNAIL_HEIGHT ) | 562 | ImageActor CreateImage( const std::string& filename, unsigned int width = IMAGE_THUMBNAIL_WIDTH, unsigned int height = IMAGE_THUMBNAIL_HEIGHT ) |
| 566 | { | 563 | { |
| 567 | - ImageAttributes attributes; | 564 | + Image img = ResourceImage::New(filename, ImageDimensions( width, height ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); |
| 568 | 565 | ||
| 569 | - attributes.SetSize(width, height); | ||
| 570 | - attributes.SetScalingMode(ImageAttributes::ScaleToFill); | ||
| 571 | - attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); | ||
| 572 | - Image img = ResourceImage::New(filename, attributes); | ||
| 573 | ImageActor actor = ImageActor::New(img); | 566 | ImageActor actor = ImageActor::New(img); |
| 574 | - actor.SetRelayoutEnabled( false ); | ||
| 575 | actor.SetName( filename ); | 567 | actor.SetName( filename ); |
| 576 | actor.SetParentOrigin(ParentOrigin::CENTER); | 568 | actor.SetParentOrigin(ParentOrigin::CENTER); |
| 577 | actor.SetAnchorPoint(AnchorPoint::CENTER); | 569 | actor.SetAnchorPoint(AnchorPoint::CENTER); |
examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp
| @@ -33,7 +33,7 @@ const char* BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-default.png" ); | @@ -33,7 +33,7 @@ const char* BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-default.png" ); | ||
| 33 | const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" ); | 33 | const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" ); |
| 34 | 34 | ||
| 35 | const char* APPLICATION_TITLE_PAN_LIGHT( "Lighting: Pan Light" ); | 35 | const char* APPLICATION_TITLE_PAN_LIGHT( "Lighting: Pan Light" ); |
| 36 | -const char* APPLICATION_TITLE_PAN_OBJECT( "Lighting: Pan Object" ); | 36 | +const char* APPLICATION_TITLE_PAN_OBJECT( "Lighting: Rotate Object" ); |
| 37 | const char* APPLICATION_TITLE_PAN_SCENE( "Lighting: Pan Scene" ); | 37 | const char* APPLICATION_TITLE_PAN_SCENE( "Lighting: Pan Scene" ); |
| 38 | const char* APPLICATION_TITLE_ROTATE_SCENE( "Lighting: Rotate Scene" ); | 38 | const char* APPLICATION_TITLE_ROTATE_SCENE( "Lighting: Rotate Scene" ); |
| 39 | const char* CHANGE_EFFECT_IMAGE( DALI_IMAGE_DIR "icon-change.png" ); | 39 | const char* CHANGE_EFFECT_IMAGE( DALI_IMAGE_DIR "icon-change.png" ); |
| @@ -43,7 +43,6 @@ const char* SCENE_IMAGE_1( DALI_IMAGE_DIR "gallery-small-10.jpg"); | @@ -43,7 +43,6 @@ const char* SCENE_IMAGE_1( DALI_IMAGE_DIR "gallery-small-10.jpg"); | ||
| 43 | const char* SCENE_IMAGE_2( DALI_IMAGE_DIR "gallery-small-42.jpg"); | 43 | const char* SCENE_IMAGE_2( DALI_IMAGE_DIR "gallery-small-42.jpg"); |
| 44 | const char* SCENE_IMAGE_3( DALI_IMAGE_DIR "gallery-small-48.jpg"); | 44 | const char* SCENE_IMAGE_3( DALI_IMAGE_DIR "gallery-small-48.jpg"); |
| 45 | 45 | ||
| 46 | -const Quaternion JAUNTY_ROTATION(Math::PI/5.0f, Math::PI/5.0f, 0.0f); // Euler angles | ||
| 47 | const float MIN_PINCH_SCALE( 0.3f ); | 46 | const float MIN_PINCH_SCALE( 0.3f ); |
| 48 | const float MAX_PINCH_SCALE( 2.05f ); | 47 | const float MAX_PINCH_SCALE( 2.05f ); |
| 49 | 48 | ||
| @@ -55,6 +54,11 @@ const Vector3 FRONT_POINT( 0.0f, 0.0f, 20.0f); | @@ -55,6 +54,11 @@ const Vector3 FRONT_POINT( 0.0f, 0.0f, 20.0f); | ||
| 55 | 54 | ||
| 56 | const Vector2 DEFAULT_STAGE_SIZE( 480.0f, 800.0f ); | 55 | const Vector2 DEFAULT_STAGE_SIZE( 480.0f, 800.0f ); |
| 57 | 56 | ||
| 57 | +const float X_ROTATION_DISPLACEMENT_FACTOR = 60.f; | ||
| 58 | +const float Y_ROTATION_DISPLACEMENT_FACTOR = 60.f; | ||
| 59 | +const float LIGHT_PAN_X_DISPLACEMENT_FACTOR = 180.f; | ||
| 60 | +const float LIGHT_PAN_Y_DISPLACEMENT_FACTOR = 180.f; | ||
| 61 | + | ||
| 58 | } | 62 | } |
| 59 | 63 | ||
| 60 | /** | 64 | /** |
| @@ -74,12 +78,12 @@ public: | @@ -74,12 +78,12 @@ public: | ||
| 74 | : mApp(app), | 78 | : mApp(app), |
| 75 | mPaused(false), | 79 | mPaused(false), |
| 76 | mTranslation(Vector3::ZERO), | 80 | mTranslation(Vector3::ZERO), |
| 77 | - mLongitudinal(15.0f), | ||
| 78 | - mAxisTilt(30.0f), | ||
| 79 | - mLightLongitudinal(0.0f), | ||
| 80 | - mLightAxisTilt(0.0f), | ||
| 81 | - mObjectLongitudinal(0.0f), | ||
| 82 | - mObjectAxisTilt(0.0f), | 81 | + mSceneYRotation( Dali::ANGLE_30 * 0.5f ), |
| 82 | + mSceneXRotation( Dali::ANGLE_30 ), | ||
| 83 | + mLightYRotation(0.0f), | ||
| 84 | + mLightXRotation(0.0f), | ||
| 85 | + mObjectYRotation(0.0f), | ||
| 86 | + mObjectXRotation(0.0f), | ||
| 83 | mPinchScale(0.5f), | 87 | mPinchScale(0.5f), |
| 84 | mScaleAtPinchStart(0.5f), | 88 | mScaleAtPinchStart(0.5f), |
| 85 | mPanState(PAN_SCENE) | 89 | mPanState(PAN_SCENE) |
| @@ -94,18 +98,6 @@ public: | @@ -94,18 +98,6 @@ public: | ||
| 94 | } | 98 | } |
| 95 | 99 | ||
| 96 | public: | 100 | public: |
| 97 | - struct PositionInFrontOf | ||
| 98 | - { | ||
| 99 | - PositionInFrontOf() | ||
| 100 | - { | ||
| 101 | - } | ||
| 102 | - | ||
| 103 | - void operator()( Vector3& current, const PropertyInputContainer& inputs ) | ||
| 104 | - { | ||
| 105 | - current = inputs[0]->GetVector3(); | ||
| 106 | - current.z += 1.0f; | ||
| 107 | - } | ||
| 108 | - }; | ||
| 109 | 101 | ||
| 110 | struct RotationConstraint | 102 | struct RotationConstraint |
| 111 | { | 103 | { |
| @@ -116,8 +108,8 @@ public: | @@ -116,8 +108,8 @@ public: | ||
| 116 | 108 | ||
| 117 | void operator()( Quaternion& current, const PropertyInputContainer& inputs ) | 109 | void operator()( Quaternion& current, const PropertyInputContainer& inputs ) |
| 118 | { | 110 | { |
| 119 | - Degree angle( inputs[0]->GetFloat() ); | ||
| 120 | - current = Quaternion( Radian(angle) * mSign, Vector3::YAXIS ); | 111 | + Radian angle( inputs[0]->GetFloat() ); |
| 112 | + current = Quaternion( angle * mSign, Vector3::YAXIS ); | ||
| 121 | } | 113 | } |
| 122 | 114 | ||
| 123 | float mSign; | 115 | float mSign; |
| @@ -176,7 +168,7 @@ public: | @@ -176,7 +168,7 @@ public: | ||
| 176 | mView.SetPosition(Vector3(0.0f, 0.0f, -50)); | 168 | mView.SetPosition(Vector3(0.0f, 0.0f, -50)); |
| 177 | 169 | ||
| 178 | mContents.SetPosition(mTranslation); | 170 | mContents.SetPosition(mTranslation); |
| 179 | - mContents.SetOrientation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); | 171 | + mContents.SetOrientation( CalculateWorldRotation( mSceneXRotation, mSceneYRotation ) ); |
| 180 | mContents.SetScale(mPinchScale, mPinchScale, mPinchScale); | 172 | mContents.SetScale(mPinchScale, mPinchScale, mPinchScale); |
| 181 | 173 | ||
| 182 | mPanGestureDetector = PanGestureDetector::New(); | 174 | mPanGestureDetector = PanGestureDetector::New(); |
| @@ -200,7 +192,6 @@ public: | @@ -200,7 +192,6 @@ public: | ||
| 200 | mShadowView.SetName("Container"); | 192 | mShadowView.SetName("Container"); |
| 201 | mShadowView.SetParentOrigin(ParentOrigin::CENTER); | 193 | mShadowView.SetParentOrigin(ParentOrigin::CENTER); |
| 202 | mShadowView.SetAnchorPoint(AnchorPoint::CENTER); | 194 | mShadowView.SetAnchorPoint(AnchorPoint::CENTER); |
| 203 | - mShadowView.SetRelayoutEnabled( true ); | ||
| 204 | mShadowView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | 195 | mShadowView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 205 | mShadowView.SetPointLightFieldOfView( Math::PI / 2.0f); | 196 | mShadowView.SetPointLightFieldOfView( Math::PI / 2.0f); |
| 206 | mContents.Add(mShadowView); | 197 | mContents.Add(mShadowView); |
| @@ -220,7 +211,7 @@ public: | @@ -220,7 +211,7 @@ public: | ||
| 220 | mLightAnchor = Actor::New(); | 211 | mLightAnchor = Actor::New(); |
| 221 | mLightAnchor.SetParentOrigin(ParentOrigin::CENTER); | 212 | mLightAnchor.SetParentOrigin(ParentOrigin::CENTER); |
| 222 | mLightAnchor.SetAnchorPoint(AnchorPoint::CENTER); | 213 | mLightAnchor.SetAnchorPoint(AnchorPoint::CENTER); |
| 223 | - mLightAnchor.SetOrientation(CalculateWorldRotation(Radian(mLightLongitudinal), Radian(mLightAxisTilt))); | 214 | + mLightAnchor.SetOrientation( CalculateWorldRotation( mLightXRotation, mLightYRotation ) ); |
| 224 | 215 | ||
| 225 | // Work out a scaling factor as the initial light position was calculated for desktop | 216 | // Work out a scaling factor as the initial light position was calculated for desktop |
| 226 | // Need to scale light position as scene actor size is based on stage size (i.e. much bigger on device) | 217 | // Need to scale light position as scene actor size is based on stage size (i.e. much bigger on device) |
| @@ -271,7 +262,7 @@ public: | @@ -271,7 +262,7 @@ public: | ||
| 271 | mImageActor2.Add(mImageActor1); | 262 | mImageActor2.Add(mImageActor1); |
| 272 | mImageActor2.Add(mImageActor3); | 263 | mImageActor2.Add(mImageActor3); |
| 273 | 264 | ||
| 274 | - Property::Index angleIndex = mImageActor2.RegisterProperty("angle", Property::Value(30.0f)); | 265 | + Property::Index angleIndex = mImageActor2.RegisterProperty("angle", Property::Value( Dali::ANGLE_30 ) ); |
| 275 | Source angleSrc( mImageActor2, angleIndex ); | 266 | Source angleSrc( mImageActor2, angleIndex ); |
| 276 | 267 | ||
| 277 | Constraint constraint = Constraint::New<Quaternion>( mImageActor1, Actor::Property::ORIENTATION, RotationConstraint(-1.0f) ); | 268 | Constraint constraint = Constraint::New<Quaternion>( mImageActor1, Actor::Property::ORIENTATION, RotationConstraint(-1.0f) ); |
| @@ -286,7 +277,7 @@ public: | @@ -286,7 +277,7 @@ public: | ||
| 286 | 277 | ||
| 287 | // Want to animate angle from 30 => -30 and back again smoothly. | 278 | // Want to animate angle from 30 => -30 and back again smoothly. |
| 288 | 279 | ||
| 289 | - mSceneAnimation.AnimateTo( Property( mImageActor2, angleIndex ), Property::Value(-30.0f), AlphaFunctions::Sin ); | 280 | + mSceneAnimation.AnimateTo( Property( mImageActor2, angleIndex ), Property::Value(-Dali::ANGLE_30), AlphaFunctions::Sin ); |
| 290 | 281 | ||
| 291 | mSceneAnimation.SetLooping(true); | 282 | mSceneAnimation.SetLooping(true); |
| 292 | mSceneAnimation.Play(); | 283 | mSceneAnimation.Play(); |
| @@ -297,10 +288,10 @@ public: | @@ -297,10 +288,10 @@ public: | ||
| 297 | } | 288 | } |
| 298 | 289 | ||
| 299 | 290 | ||
| 300 | - Quaternion CalculateWorldRotation(Radian longitude, Radian axisTilt ) | 291 | + Quaternion CalculateWorldRotation( Radian XRotation, Radian YRotation ) |
| 301 | { | 292 | { |
| 302 | - Quaternion q(longitude, Vector3::YAXIS); | ||
| 303 | - Quaternion p(axisTilt, Vector3::XAXIS); | 293 | + Quaternion p( XRotation, Vector3::XAXIS ); |
| 294 | + Quaternion q( YRotation, Vector3::YAXIS ); | ||
| 304 | return p*q; | 295 | return p*q; |
| 305 | } | 296 | } |
| 306 | 297 | ||
| @@ -331,10 +322,11 @@ public: | @@ -331,10 +322,11 @@ public: | ||
| 331 | { | 322 | { |
| 332 | case PAN_LIGHT: | 323 | case PAN_LIGHT: |
| 333 | { | 324 | { |
| 334 | - mLightLongitudinal += gesture.displacement.x/4.0f; | ||
| 335 | - mLightAxisTilt -= gesture.displacement.y/6.0f; | ||
| 336 | - mLightAxisTilt = Clamp<float>(mLightAxisTilt, -90.0f, 90.0f); | ||
| 337 | - mLightAnchor.SetOrientation(CalculateWorldRotation(Radian(mLightLongitudinal), Radian(mLightAxisTilt))); | 325 | + mLightXRotation = mLightXRotation - gesture.displacement.y / LIGHT_PAN_X_DISPLACEMENT_FACTOR; // X displacement rotates around Y axis |
| 326 | + mLightXRotation = Clamp(mLightXRotation, -Dali::ANGLE_45, Dali::ANGLE_45 ); | ||
| 327 | + mLightYRotation = mLightYRotation + gesture.displacement.x / LIGHT_PAN_Y_DISPLACEMENT_FACTOR; // Y displacement rotates around X axis | ||
| 328 | + mLightYRotation = Clamp(mLightYRotation, -Dali::ANGLE_45, Dali::ANGLE_45 ); | ||
| 329 | + mLightAnchor.SetOrientation( CalculateWorldRotation( mLightXRotation, mLightYRotation ) ); | ||
| 338 | break; | 330 | break; |
| 339 | } | 331 | } |
| 340 | 332 | ||
| @@ -347,19 +339,19 @@ public: | @@ -347,19 +339,19 @@ public: | ||
| 347 | 339 | ||
| 348 | case ROTATE_SCENE: | 340 | case ROTATE_SCENE: |
| 349 | { | 341 | { |
| 350 | - mLongitudinal += gesture.displacement.x/4.0f; | ||
| 351 | - mAxisTilt -= gesture.displacement.y/6.0f; | ||
| 352 | - mAxisTilt = Clamp<float>(mAxisTilt, -90.0f, 90.0f); | ||
| 353 | - mContents.SetOrientation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); | 342 | + mSceneXRotation = mSceneXRotation - gesture.displacement.y / X_ROTATION_DISPLACEMENT_FACTOR; // X displacement rotates around Y axis |
| 343 | + mSceneXRotation = Clamp( mSceneXRotation, -Dali::ANGLE_90, Dali::ANGLE_90 ); | ||
| 344 | + mSceneYRotation = mSceneYRotation + gesture.displacement.x / Y_ROTATION_DISPLACEMENT_FACTOR; // Y displacement rotates around X axis | ||
| 345 | + mSceneYRotation = Clamp( mSceneYRotation, -Dali::ANGLE_90, Dali::ANGLE_90 ); | ||
| 346 | + mContents.SetOrientation( CalculateWorldRotation( mSceneXRotation, mSceneYRotation ) ); | ||
| 354 | break; | 347 | break; |
| 355 | } | 348 | } |
| 356 | 349 | ||
| 357 | - case PAN_OBJECT: | 350 | + case ROTATE_OBJECT: |
| 358 | { | 351 | { |
| 359 | - mObjectLongitudinal += gesture.displacement.x/4.0f; | ||
| 360 | - mObjectAxisTilt -= gesture.displacement.y/6.0f; | ||
| 361 | - mObjectAxisTilt = Clamp<float>(mObjectAxisTilt, -90.0f, 90.0f); | ||
| 362 | - mSceneActor.SetOrientation(CalculateWorldRotation(Radian(mObjectLongitudinal), Radian(mObjectAxisTilt))); | 352 | + mObjectXRotation = mObjectXRotation - gesture.displacement.y / X_ROTATION_DISPLACEMENT_FACTOR; // X displacement rotates around Y axis |
| 353 | + mObjectYRotation = mObjectYRotation + gesture.displacement.x / Y_ROTATION_DISPLACEMENT_FACTOR; // Y displacement rotates around X axis | ||
| 354 | + mSceneActor.SetOrientation( CalculateWorldRotation( mObjectXRotation, mObjectYRotation ) ); | ||
| 363 | break; | 355 | break; |
| 364 | } | 356 | } |
| 365 | } | 357 | } |
| @@ -422,10 +414,10 @@ public: | @@ -422,10 +414,10 @@ public: | ||
| 422 | mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_LIGHT) ); | 414 | mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_LIGHT) ); |
| 423 | break; | 415 | break; |
| 424 | case PAN_LIGHT: | 416 | case PAN_LIGHT: |
| 425 | - mPanState = PAN_OBJECT; | 417 | + mPanState = ROTATE_OBJECT; |
| 426 | mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_OBJECT) ); | 418 | mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_OBJECT) ); |
| 427 | break; | 419 | break; |
| 428 | - case PAN_OBJECT: | 420 | + case ROTATE_OBJECT: |
| 429 | mPanState = PAN_SCENE; | 421 | mPanState = PAN_SCENE; |
| 430 | mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_SCENE) ); | 422 | mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_SCENE) ); |
| 431 | break; | 423 | break; |
| @@ -443,9 +435,9 @@ public: | @@ -443,9 +435,9 @@ public: | ||
| 443 | mContents.SetPosition(mTranslation); | 435 | mContents.SetPosition(mTranslation); |
| 444 | 436 | ||
| 445 | // Align scene so that light anchor orientation is Z Axis | 437 | // Align scene so that light anchor orientation is Z Axis |
| 446 | - mAxisTilt = -mLightAxisTilt; | ||
| 447 | - mLongitudinal = -mLightLongitudinal; | ||
| 448 | - mContents.SetOrientation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); | 438 | + mSceneXRotation = -mLightXRotation; |
| 439 | + mSceneYRotation = -mLightYRotation; | ||
| 440 | + mContents.SetOrientation( CalculateWorldRotation( mSceneXRotation, mSceneYRotation ) ); | ||
| 449 | 441 | ||
| 450 | return true; | 442 | return true; |
| 451 | } | 443 | } |
| @@ -470,12 +462,12 @@ private: | @@ -470,12 +462,12 @@ private: | ||
| 470 | PinchGestureDetector mPinchGestureDetector; | 462 | PinchGestureDetector mPinchGestureDetector; |
| 471 | TapGestureDetector mTapGestureDetector; | 463 | TapGestureDetector mTapGestureDetector; |
| 472 | Vector3 mTranslation; | 464 | Vector3 mTranslation; |
| 473 | - Degree mLongitudinal; | ||
| 474 | - Degree mAxisTilt; | ||
| 475 | - Degree mLightLongitudinal; | ||
| 476 | - Degree mLightAxisTilt; | ||
| 477 | - Degree mObjectLongitudinal; | ||
| 478 | - Degree mObjectAxisTilt; | 465 | + Radian mSceneYRotation; |
| 466 | + Radian mSceneXRotation; | ||
| 467 | + Radian mLightYRotation; | ||
| 468 | + Radian mLightXRotation; | ||
| 469 | + Radian mObjectYRotation; | ||
| 470 | + Radian mObjectXRotation; | ||
| 479 | float mPinchScale; | 471 | float mPinchScale; |
| 480 | float mScaleAtPinchStart; | 472 | float mScaleAtPinchStart; |
| 481 | 473 | ||
| @@ -489,7 +481,7 @@ private: | @@ -489,7 +481,7 @@ private: | ||
| 489 | PAN_SCENE, | 481 | PAN_SCENE, |
| 490 | ROTATE_SCENE, | 482 | ROTATE_SCENE, |
| 491 | PAN_LIGHT, | 483 | PAN_LIGHT, |
| 492 | - PAN_OBJECT | 484 | + ROTATE_OBJECT |
| 493 | }; | 485 | }; |
| 494 | 486 | ||
| 495 | PanState mPanState; | 487 | PanState mPanState; |
examples/text-field/text-field-example.cpp
| @@ -87,8 +87,10 @@ public: | @@ -87,8 +87,10 @@ public: | ||
| 87 | mContainer.Add( field ); | 87 | mContainer.Add( field ); |
| 88 | 88 | ||
| 89 | field.SetProperty( TextField::Property::TEXT, "Hello" ); | 89 | field.SetProperty( TextField::Property::TEXT, "Hello" ); |
| 90 | + field.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect<int>( BORDER_WIDTH, BORDER_WIDTH, stageSize.width - BORDER_WIDTH*2, stageSize.height - BORDER_WIDTH*2 ) ); | ||
| 90 | 91 | ||
| 91 | Property::Value fieldText = field.GetProperty( TextField::Property::TEXT ); | 92 | Property::Value fieldText = field.GetProperty( TextField::Property::TEXT ); |
| 93 | + | ||
| 92 | std::cout << "Displaying text: " << fieldText.Get< std::string >() << std::endl; | 94 | std::cout << "Displaying text: " << fieldText.Get< std::string >() << std::endl; |
| 93 | } | 95 | } |
| 94 | 96 |
examples/text-message-field/text-message-field-example.cpp
0 โ 100644
| 1 | +/* | ||
| 2 | + * Copyright (c) 2015 Samsung Electronics Co., Ltd. | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + * | ||
| 16 | + */ | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * @file message-field-example.cpp | ||
| 20 | + * @brief Basic usage of TextField control | ||
| 21 | + */ | ||
| 22 | + | ||
| 23 | +// EXTERNAL INCLUDES | ||
| 24 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 25 | +#include <dali/public-api/text-abstraction/text-abstraction.h> | ||
| 26 | + | ||
| 27 | +using namespace Dali; | ||
| 28 | +using namespace Dali::Toolkit; | ||
| 29 | + | ||
| 30 | +namespace | ||
| 31 | +{ | ||
| 32 | + const char* DESKTOP_IMAGE( DALI_IMAGE_DIR "woodEffect.jpg" ); | ||
| 33 | + const Vector2 DESKTOP_SIZE( Vector2( 1440, 1600 ) ); | ||
| 34 | + const Vector2 PHOTOBOX_SIZE( Vector2(330.0f, 80.0f ) ); | ||
| 35 | + const float MAX_OFFSCREEN_RENDERING_SIZE = 2048.f; | ||
| 36 | + const float SCREEN_BORDER = 5.0f; // Border around screen that Popups and handles will not exceed | ||
| 37 | +} | ||
| 38 | +/** | ||
| 39 | + * @brief The main class of the demo. | ||
| 40 | + */ | ||
| 41 | +class TextMessageFieldExample : public ConnectionTracker | ||
| 42 | +{ | ||
| 43 | +public: | ||
| 44 | + | ||
| 45 | + TextMessageFieldExample( Application& application ) | ||
| 46 | + : mApplication( application ), | ||
| 47 | + mTargetActorPosition(), | ||
| 48 | + mTargetActorSize() | ||
| 49 | + { | ||
| 50 | + // Connect to the Application's Init signal | ||
| 51 | + mApplication.InitSignal().Connect( this, &TextMessageFieldExample::Create ); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + ~TextMessageFieldExample() | ||
| 55 | + { | ||
| 56 | + // Nothing to do here. | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * One-time setup in response to Application InitSignal. | ||
| 61 | + */ | ||
| 62 | + void Create( Application& application ) | ||
| 63 | + { | ||
| 64 | + Stage stage = Stage::GetCurrent(); | ||
| 65 | + mStageSize = stage.GetSize(); | ||
| 66 | + | ||
| 67 | + stage.KeyEventSignal().Connect(this, &TextMessageFieldExample::OnKeyEvent); | ||
| 68 | + | ||
| 69 | + // Create Root actor | ||
| 70 | + Actor rootActor = Actor::New(); | ||
| 71 | + rootActor.SetName("rootActor"); | ||
| 72 | + rootActor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | ||
| 73 | + rootActor.SetSize( mStageSize ); | ||
| 74 | + rootActor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 75 | + | ||
| 76 | + stage.Add( rootActor ); | ||
| 77 | + | ||
| 78 | + const Size mTargetActorSize( mStageSize.width, DESKTOP_SIZE.height ); | ||
| 79 | + | ||
| 80 | + // Create Desktop | ||
| 81 | + ResourceImage backgroundImage = ResourceImage::New( DESKTOP_IMAGE ); | ||
| 82 | + ImageActor desktop = ImageActor::New( backgroundImage ); | ||
| 83 | + desktop.SetName("desktopActor"); | ||
| 84 | + desktop.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 85 | + desktop.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | ||
| 86 | + desktop.SetSize( mTargetActorSize ); | ||
| 87 | + | ||
| 88 | + rootActor.Add( desktop ); // Add desktop (content) to offscreen actor | ||
| 89 | + | ||
| 90 | + // Create Photo Box A | ||
| 91 | + ImageActor photoBoxA = CreateSolidColorActor( Vector4(0,0,0,0), true, Color::WHITE, 1 ); | ||
| 92 | + photoBoxA.SetName("photoBoxA"); | ||
| 93 | + photoBoxA.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 94 | + photoBoxA.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 95 | + photoBoxA.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | ||
| 96 | + photoBoxA.SetSize( PHOTOBOX_SIZE ); | ||
| 97 | + photoBoxA.SetPosition( 0.0f, -500.0f, 1.0f ); | ||
| 98 | + desktop.Add( photoBoxA ); | ||
| 99 | + | ||
| 100 | + // Create TextField | ||
| 101 | + TextField field = TextField::New(); | ||
| 102 | + field.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | ||
| 103 | + field.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | ||
| 104 | + field.SetPadding( Padding( 1.0f, 1.0f, 1.0f, 1.0f ) ); | ||
| 105 | + field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 106 | + field.SetZ( 1.0f ); | ||
| 107 | + field.SetProperty( TextField::Property::TEXT, "Enter Title name" ); | ||
| 108 | + field.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect<int>( SCREEN_BORDER, SCREEN_BORDER, mStageSize.width - SCREEN_BORDER*2, mStageSize.height - SCREEN_BORDER*2 ) ); | ||
| 109 | + photoBoxA.Add( field ); | ||
| 110 | + | ||
| 111 | + mPanGestureDetector = PanGestureDetector::New(); | ||
| 112 | + mPanGestureDetector.DetectedSignal().Connect(this, &TextMessageFieldExample::OnPanGesture ); | ||
| 113 | + mPanGestureDetector.Attach( desktop ); | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + /** | ||
| 117 | + * Main key event handler | ||
| 118 | + */ | ||
| 119 | + void OnKeyEvent(const KeyEvent& event) | ||
| 120 | + { | ||
| 121 | + if(event.state == KeyEvent::Down) | ||
| 122 | + { | ||
| 123 | + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) | ||
| 124 | + { | ||
| 125 | + mApplication.Quit(); | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + void OnPanGesture( Actor actor, const PanGesture& gesture ) | ||
| 131 | + { | ||
| 132 | + if( gesture.state == Gesture::Continuing ) | ||
| 133 | + { | ||
| 134 | + Vector2 position = Vector2( gesture.displacement ); | ||
| 135 | + mTargetActorPosition.y = mTargetActorPosition.y + position.y; | ||
| 136 | + mTargetActorPosition.y = std::min( mTargetActorPosition.y, -mTargetActorSize.height ); | ||
| 137 | + mTargetActorPosition.y = std::max( mTargetActorPosition.y, ( mTargetActorSize.height - mStageSize.height*0.25f ) ); | ||
| 138 | + actor.SetPosition( 0.0f, mTargetActorPosition.y ); | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | +private: | ||
| 143 | + | ||
| 144 | + Application& mApplication; | ||
| 145 | + PanGestureDetector mPanGestureDetector; | ||
| 146 | + | ||
| 147 | + Vector2 mTargetActorPosition; | ||
| 148 | + Vector2 mTargetActorSize; | ||
| 149 | + Vector2 mStageSize; | ||
| 150 | +}; | ||
| 151 | + | ||
| 152 | +void RunTest( Application& application ) | ||
| 153 | +{ | ||
| 154 | + TextMessageFieldExample test( application ); | ||
| 155 | + | ||
| 156 | + application.MainLoop(); | ||
| 157 | +} | ||
| 158 | + | ||
| 159 | +/** Entry point for Linux & Tizen applications */ | ||
| 160 | +int main( int argc, char **argv ) | ||
| 161 | +{ | ||
| 162 | + Application application = Application::New( &argc, &argv ); | ||
| 163 | + | ||
| 164 | + RunTest( application ); | ||
| 165 | + | ||
| 166 | + return 0; | ||
| 167 | +} |
packaging/com.samsung.dali-demo.spec
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | Name: com.samsung.dali-demo | 3 | Name: com.samsung.dali-demo |
| 4 | Summary: The OpenGLES Canvas Core Demo | 4 | Summary: The OpenGLES Canvas Core Demo |
| 5 | -Version: 1.0.38 | 5 | +Version: 1.0.39 |
| 6 | Release: 1 | 6 | Release: 1 |
| 7 | Group: System/Libraries | 7 | Group: System/Libraries |
| 8 | License: Apache-2.0 | 8 | License: Apache-2.0 |
resources/images/message-field-box.png
0 โ 100644
202 Bytes
resources/images/woodEffect.jpg
0 โ 100644
1.26 MB
resources/scripts/timing.json
| @@ -113,12 +113,12 @@ | @@ -113,12 +113,12 @@ | ||
| 113 | ] | 113 | ] |
| 114 | }, | 114 | }, |
| 115 | { | 115 | { |
| 116 | - "type": "TextView", | ||
| 117 | - "text": "<font size='20' color='#fea011'><b>Touch</b></font>", | ||
| 118 | - "markup-enabled": true, | 116 | + "type": "TextLabel", |
| 117 | + "text": "Touch", | ||
| 119 | "name": "Instruction", | 118 | "name": "Instruction", |
| 120 | "parent-origin": "BOTTOM_CENTER", | 119 | "parent-origin": "BOTTOM_CENTER", |
| 121 | "anchor-point": "BOTTOM_CENTER", | 120 | "anchor-point": "BOTTOM_CENTER", |
| 121 | + "text-color": [1, 0, 0, 1], | ||
| 122 | "position": [ | 122 | "position": [ |
| 123 | 0, | 123 | 0, |
| 124 | 0, | 124 | 0, |
shared/view.h
| @@ -76,8 +76,8 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, | @@ -76,8 +76,8 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, | ||
| 76 | toolBarLayer.SetName( "TOOLBAR_LAYER" ); | 76 | toolBarLayer.SetName( "TOOLBAR_LAYER" ); |
| 77 | toolBarLayer.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); | 77 | toolBarLayer.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); |
| 78 | toolBarLayer.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); | 78 | toolBarLayer.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); |
| 79 | - toolBarLayer.SetSize( 0.0f, style.mToolBarHeight ); | ||
| 80 | toolBarLayer.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::WIDTH ); | 79 | toolBarLayer.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::WIDTH ); |
| 80 | + toolBarLayer.SetSize( 0.0f, style.mToolBarHeight ); | ||
| 81 | 81 | ||
| 82 | // Raise tool bar layer to the top. | 82 | // Raise tool bar layer to the top. |
| 83 | toolBarLayer.RaiseToTop(); | 83 | toolBarLayer.RaiseToTop(); |
| @@ -139,11 +139,7 @@ Dali::Layer CreateView( Dali::Application& application, | @@ -139,11 +139,7 @@ Dali::Layer CreateView( Dali::Application& application, | ||
| 139 | // Set background image, loading it at screen resolution: | 139 | // Set background image, loading it at screen resolution: |
| 140 | if ( !backgroundImagePath.empty() ) | 140 | if ( !backgroundImagePath.empty() ) |
| 141 | { | 141 | { |
| 142 | - Dali::ImageAttributes backgroundAttributes; | ||
| 143 | - backgroundAttributes.SetSize( stage.GetSize() ); | ||
| 144 | - backgroundAttributes.SetFilterMode( Dali::ImageAttributes::BoxThenLinear ); | ||
| 145 | - backgroundAttributes.SetScalingMode( Dali::ImageAttributes::ScaleToFill ); | ||
| 146 | - Dali::Image backgroundImage = Dali::ResourceImage::New( backgroundImagePath, backgroundAttributes ); | 142 | + Dali::Image backgroundImage = Dali::ResourceImage::New( backgroundImagePath, Dali::ImageDimensions( stage.GetSize().x, stage.GetSize().y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); |
| 147 | Dali::ImageActor backgroundImageActor = Dali::ImageActor::New( backgroundImage ); | 143 | Dali::ImageActor backgroundImageActor = Dali::ImageActor::New( backgroundImage ); |
| 148 | view.SetBackground( backgroundImageActor ); | 144 | view.SetBackground( backgroundImageActor ); |
| 149 | } | 145 | } |