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 | 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 | 86 | <label>Text Label</label> |
| 87 | 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 | 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 | 92 | <label>Logging</label> |
| 90 | 93 | </ui-application> | ... | ... |
demo/dali-table-view.cpp
| ... | ... | @@ -123,21 +123,21 @@ const float IMAGE_BORDER_BOTTOM = IMAGE_BORDER_LEFT; |
| 123 | 123 | struct AnimateBubbleConstraint |
| 124 | 124 | { |
| 125 | 125 | public: |
| 126 | - AnimateBubbleConstraint( const Vector3& initialPos, float scale, float size ) | |
| 126 | + AnimateBubbleConstraint( const Vector3& initialPos, float scale ) | |
| 127 | 127 | : mInitialX( initialPos.x ), |
| 128 | - mScale( scale ), | |
| 129 | - mShapeSize( size ) | |
| 128 | + mScale( scale ) | |
| 130 | 129 | { |
| 131 | 130 | } |
| 132 | 131 | |
| 133 | 132 | void operator()( Vector3& position, const PropertyInputContainer& inputs ) |
| 134 | 133 | { |
| 135 | 134 | const Vector3& parentSize = inputs[1]->GetVector3(); |
| 135 | + const Vector3& childSize = inputs[2]->GetVector3(); | |
| 136 | 136 | |
| 137 | 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 | 143 | // Bubbles X position moves parallax to horizontal |
| ... | ... | @@ -267,7 +267,6 @@ void DaliTableView::Initialize( Application& application ) |
| 267 | 267 | |
| 268 | 268 | // scrollview occupying the majority of the screen |
| 269 | 269 | mScrollView = ScrollView::New(); |
| 270 | - mScrollView.SetRelayoutEnabled( true ); | |
| 271 | 270 | |
| 272 | 271 | mScrollView.SetAnchorPoint( AnchorPoint::CENTER ); |
| 273 | 272 | mScrollView.SetParentOrigin( ParentOrigin::CENTER ); |
| ... | ... | @@ -297,7 +296,6 @@ void DaliTableView::Initialize( Application& application ) |
| 297 | 296 | |
| 298 | 297 | // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show |
| 299 | 298 | Actor bubbleContainer = Actor::New(); |
| 300 | - bubbleContainer.SetRelayoutEnabled( true ); | |
| 301 | 299 | bubbleContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 302 | 300 | bubbleContainer.SetAnchorPoint( AnchorPoint::CENTER ); |
| 303 | 301 | bubbleContainer.SetParentOrigin( ParentOrigin::CENTER ); |
| ... | ... | @@ -324,17 +322,18 @@ void DaliTableView::Initialize( Application& application ) |
| 324 | 322 | // Remove constraints for inner cube effect |
| 325 | 323 | ApplyCubeEffectToActors(); |
| 326 | 324 | |
| 327 | - // Set initial orientation | |
| 328 | - unsigned int degrees = application.GetOrientation().GetDegrees(); | |
| 329 | - Rotate( degrees ); | |
| 330 | - | |
| 331 | 325 | Dali::Window winHandle = application.GetWindow(); |
| 332 | 326 | winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT ); |
| 333 | 327 | winHandle.RemoveAvailableOrientation( Dali::Window::LANDSCAPE ); |
| 334 | 328 | winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT_INVERSE ); |
| 335 | 329 | winHandle.RemoveAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE ); |
| 336 | 330 | |
| 331 | + // Set initial orientation | |
| 337 | 332 | Dali::Orientation orientation = winHandle.GetOrientation(); |
| 333 | + | |
| 334 | + unsigned int degrees = winHandle.GetOrientation().GetDegrees(); | |
| 335 | + Rotate( degrees ); | |
| 336 | + | |
| 338 | 337 | orientation.ChangedSignal().Connect( this, &DaliTableView::OrientationChanged ); |
| 339 | 338 | |
| 340 | 339 | winHandle.ShowIndicator( Dali::Window::INVISIBLE ); |
| ... | ... | @@ -491,7 +490,6 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit |
| 491 | 490 | content.SetName( name ); |
| 492 | 491 | content.SetAnchorPoint( AnchorPoint::CENTER ); |
| 493 | 492 | content.SetParentOrigin( ParentOrigin::CENTER ); |
| 494 | - content.SetRelayoutEnabled( true ); | |
| 495 | 493 | content.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 496 | 494 | content.SetSizeModeFactor( sizeMultiplier ); |
| 497 | 495 | |
| ... | ... | @@ -745,19 +743,18 @@ void DaliTableView::InitialiseBackgroundActors( Actor actor ) |
| 745 | 743 | { |
| 746 | 744 | Actor child = actor.GetChildAt( i ); |
| 747 | 745 | |
| 748 | - const Vector3 childSize = child.GetTargetSize(); | |
| 749 | - | |
| 750 | 746 | // Calculate a random position |
| 751 | 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 | 749 | Random::Range( BUBBLE_MIN_Z, BUBBLE_MAX_Z ) ); |
| 754 | 750 | |
| 755 | 751 | child.SetPosition( childPos ); |
| 756 | 752 | |
| 757 | 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 | 755 | animConstraint.AddSource( Source( mScrollView, ScrollView::Property::SCROLL_POSITION ) ); |
| 760 | 756 | animConstraint.AddSource( Dali::ParentSource( Dali::Actor::Property::SIZE ) ); |
| 757 | + animConstraint.AddSource( Dali::LocalSource( Dali::Actor::Property::SIZE ) ); | |
| 761 | 758 | animConstraint.Apply(); |
| 762 | 759 | |
| 763 | 760 | // Kickoff animation |
| ... | ... | @@ -778,7 +775,6 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage dis |
| 778 | 775 | Vector4 randColour( hue, hue * 0.5, 0.0f, Random::Range( 0.3f, 0.6f )); |
| 779 | 776 | |
| 780 | 777 | ImageActor dfActor = ImageActor::New( distanceField ); |
| 781 | - dfActor.SetRelayoutEnabled( false ); | |
| 782 | 778 | dfActor.SetSize( Vector2( randSize, randSize ) ); |
| 783 | 779 | dfActor.SetParentOrigin( ParentOrigin::CENTER ); |
| 784 | 780 | |
| ... | ... | @@ -884,7 +880,7 @@ void DaliTableView::PauseAnimation() |
| 884 | 880 | { |
| 885 | 881 | Animation anim = *animIter; |
| 886 | 882 | |
| 887 | - anim.Pause(); | |
| 883 | + anim.Stop(); | |
| 888 | 884 | } |
| 889 | 885 | |
| 890 | 886 | mBackgroundAnimsPlaying = false; |
| ... | ... | @@ -1007,8 +1003,6 @@ void DaliTableView::OnLogoTapped( Dali::Actor actor, const Dali::TapGesture& tap |
| 1007 | 1003 | mVersionPopup.HideTail(); |
| 1008 | 1004 | mVersionPopup.OutsideTouchedSignal().Connect( this, &DaliTableView::HideVersionPopup ); |
| 1009 | 1005 | mVersionPopup.HiddenSignal().Connect( this, &DaliTableView::PopupHidden ); |
| 1010 | - | |
| 1011 | - mVersionPopup.MarkDirtyForRelayout(); | |
| 1012 | 1006 | } |
| 1013 | 1007 | |
| 1014 | 1008 | mVersionPopup.Show(); | ... | ... |
examples/animated-shapes/animated-shapes-example.cpp
| ... | ... | @@ -60,8 +60,7 @@ public: |
| 60 | 60 | stage.Add( mView ); |
| 61 | 61 | |
| 62 | 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 | 66 | Dali::ImageActor backgroundImageActor = Dali::ImageActor::New( image ); | ... | ... |
examples/blocks/blocks-example.cpp
| ... | ... | @@ -176,8 +176,8 @@ struct WobbleConstraint |
| 176 | 176 | * |
| 177 | 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 | 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 | 202 | } // unnamed namespace |
| ... | ... | @@ -285,7 +285,7 @@ private: |
| 285 | 285 | mPaddleImage.SetSize( mPaddleFullSize ); |
| 286 | 286 | |
| 287 | 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 | 289 | wobbleConstraint.AddSource( LocalSource(mWobbleProperty) ); |
| 290 | 290 | wobbleConstraint.Apply(); |
| 291 | 291 | |
| ... | ... | @@ -358,8 +358,8 @@ private: |
| 358 | 358 | mLevelContainer = Actor::New(); |
| 359 | 359 | mLevelContainer.SetAnchorPoint( AnchorPoint::CENTER ); |
| 360 | 360 | mLevelContainer.SetParentOrigin( ParentOrigin::CENTER ); |
| 361 | - mLevelContainer.SetRelayoutEnabled( true ); | |
| 362 | 361 | mLevelContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 362 | + | |
| 363 | 363 | mContentLayer.Add( mLevelContainer ); |
| 364 | 364 | |
| 365 | 365 | mBrickCount = 0; |
| ... | ... | @@ -524,14 +524,10 @@ private: |
| 524 | 524 | Vector2 stageSize(Stage::GetCurrent().GetSize()); |
| 525 | 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 | 528 | ImageActor brick = ImageActor::New(img); |
| 532 | 529 | brick.SetParentOrigin(ParentOrigin::TOP_LEFT); |
| 533 | 530 | brick.SetAnchorPoint(AnchorPoint::CENTER); |
| 534 | - brick.SetRelayoutEnabled( false ); | |
| 535 | 531 | brick.SetSize( brickSize ); |
| 536 | 532 | brick.SetPosition( Vector3( position ) ); |
| 537 | 533 | |
| ... | ... | @@ -563,7 +559,6 @@ private: |
| 563 | 559 | ImageActor actor = ImageActor::New(img); |
| 564 | 560 | actor.SetParentOrigin(ParentOrigin::TOP_LEFT); |
| 565 | 561 | actor.SetAnchorPoint(AnchorPoint::CENTER); |
| 566 | - actor.SetRelayoutEnabled( false ); | |
| 567 | 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 | 53 | /** |
| 54 | 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 | 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 | 59 | * maximum quality. |
| 60 | 60 | */ |
| 61 | 61 | ResourceImage LoadStageFillingImage( const char * const imagePath ) |
| 62 | 62 | { |
| 63 | 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 | 67 | }// end LOCAL_STUFF | ... | ... |
examples/builder/examples.cpp
| ... | ... | @@ -287,7 +287,6 @@ public: |
| 287 | 287 | mFiles.clear(); |
| 288 | 288 | |
| 289 | 289 | mItemView = ItemView::New(*this); |
| 290 | - mItemView.SetRelayoutEnabled( false ); | |
| 291 | 290 | stage.Add( mItemView ); |
| 292 | 291 | mItemView.SetParentOrigin(ParentOrigin::CENTER); |
| 293 | 292 | mItemView.SetAnchorPoint(AnchorPoint::CENTER); |
| ... | ... | @@ -469,9 +468,6 @@ public: |
| 469 | 468 | } |
| 470 | 469 | |
| 471 | 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 | 214 | mBigImage3 = ResourceImage::New( BIG_IMAGE_3 ); |
| 215 | 215 | |
| 216 | 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 | 219 | radioGroup2Background.AddChild( mImage, Toolkit::TableView::CellPosition( 0, 1, 2, 1 ) ); |
| 220 | 220 | |
| 221 | 221 | // The enable/disable radio group |
| ... | ... | @@ -349,7 +349,6 @@ class ButtonsController: public ConnectionTracker |
| 349 | 349 | |
| 350 | 350 | contentTable.Add( toggleBackground ); |
| 351 | 351 | |
| 352 | - | |
| 353 | 352 | Toolkit::PushButton toggleButton = Toolkit::PushButton::New(); |
| 354 | 353 | toggleButton.SetTogglableButton( true ); |
| 355 | 354 | toggleButton.SetLabel( "Unselected" ); | ... | ... |
examples/cluster/cluster-example.cpp
| ... | ... | @@ -186,7 +186,7 @@ struct CarouselEffectOrientationConstraint |
| 186 | 186 | void operator()( Vector2& current, const PropertyInputContainer& inputs ) |
| 187 | 187 | { |
| 188 | 188 | Vector3 axis; |
| 189 | - float angle; | |
| 189 | + Radian angle; | |
| 190 | 190 | inputs[0]->GetQuaternion().ToAxisAngle( axis, angle ); |
| 191 | 191 | |
| 192 | 192 | current.x = cosf(angle); |
| ... | ... | @@ -242,7 +242,7 @@ struct ShearEffectConstraint |
| 242 | 242 | // Channel this shear value into either the X or Y axis depending on |
| 243 | 243 | // the component mask passed in. |
| 244 | 244 | Vector3 axis; |
| 245 | - float angle; | |
| 245 | + Radian angle; | |
| 246 | 246 | inputs[1]->GetQuaternion().ToAxisAngle( axis, angle ); |
| 247 | 247 | Vector2 direction( cosf(angle), sinf(angle) ); |
| 248 | 248 | float yield = direction.x * mComponentMask.x + direction.y * mComponentMask.y; |
| ... | ... | @@ -477,7 +477,6 @@ public: |
| 477 | 477 | |
| 478 | 478 | // create and setup the scroll view... |
| 479 | 479 | mScrollView = ScrollView::New(); |
| 480 | - mScrollView.SetRelayoutEnabled( false ); | |
| 481 | 480 | mScrollView.SetSize(stageSize); |
| 482 | 481 | |
| 483 | 482 | // attach Wobble Effect to ScrollView |
| ... | ... | @@ -489,7 +488,6 @@ public: |
| 489 | 488 | mScrollView.SetParentOrigin(ParentOrigin::CENTER); |
| 490 | 489 | |
| 491 | 490 | // Scale ScrollView to fit parent (mContentLayer) |
| 492 | - mScrollView.SetRelayoutEnabled( true ); | |
| 493 | 491 | mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 494 | 492 | |
| 495 | 493 | // Add the scroll view to the content layer |
| ... | ... | @@ -511,32 +509,30 @@ public: |
| 511 | 509 | /** |
| 512 | 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 | 514 | // Create the cluster actor with the given cluster style |
| 517 | 515 | Cluster clusterActor = Cluster::New(style); |
| 518 | 516 | clusterActor.SetParentOrigin(ParentOrigin::CENTER); |
| 519 | 517 | clusterActor.SetAnchorPoint(AnchorPoint::CENTER); |
| 520 | - clusterActor.SetRelayoutEnabled( false ); | |
| 521 | 518 | |
| 522 | 519 | Vector2 stageSize = Dali::Stage::GetCurrent().GetSize(); |
| 523 | 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 | 527 | DALI_ASSERT_ALWAYS(clusterType < CLUSTER_COUNT); |
| 527 | 528 | const char **paths = IMAGE_GROUPS[clusterType]; |
| 528 | 529 | DALI_ASSERT_ALWAYS(paths); |
| 529 | 530 | |
| 530 | 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 | 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 | 535 | ImageActor image = ImageActor::New(bg); |
| 539 | - image.SetRelayoutEnabled( false ); | |
| 540 | 536 | clusterActor.SetBackgroundImage(image); |
| 541 | 537 | |
| 542 | 538 | // Add actors (pictures) as the children of the cluster |
| ... | ... | @@ -563,14 +559,11 @@ public: |
| 563 | 559 | actor.SetAnchorPoint( AnchorPoint::CENTER ); |
| 564 | 560 | |
| 565 | 561 | // Load the thumbnail at quarter of screen width or standard size if that is smaller: |
| 566 | - ImageAttributes attribs = ImageAttributes::New(); | |
| 567 | 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 | 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 | 567 | ImageActor shadowActor = ImageActor::New(shadowImage); |
| 575 | 568 | |
| 576 | 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 | 578 | actor.Add( shadowActor ); |
| 586 | 579 | |
| 587 | 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 | 582 | ImageActor imageActor = ImageActor::New( image ); |
| 590 | 583 | imageActor.SetParentOrigin( ParentOrigin::CENTER ); |
| 591 | 584 | imageActor.SetAnchorPoint( AnchorPoint::CENTER ); |
| ... | ... | @@ -629,19 +622,18 @@ public: |
| 629 | 622 | mScrollView.Add(pageView); |
| 630 | 623 | pageView.SetParentOrigin(ParentOrigin::CENTER); |
| 631 | 624 | pageView.SetPosition(Vector3(stageSize.width * column, 0.0f, 0.0f)); |
| 632 | - pageView.SetRelayoutEnabled( true ); | |
| 633 | 625 | pageView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 634 | 626 | |
| 635 | 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 | 630 | cluster.SetParentOrigin(ParentOrigin::TOP_LEFT); |
| 638 | 631 | cluster.SetAnchorPoint(AnchorPoint::TOP_LEFT); |
| 639 | 632 | cluster.SetPosition( clusterPosition ); |
| 640 | 633 | |
| 641 | 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 | 638 | mClusterCount++; |
| 647 | 639 | } | ... | ... |
examples/cube-transition-effect/cube-transition-effect-example.cpp
| ... | ... | @@ -91,19 +91,15 @@ const int VIEWINGTIME = 2000; // 2 seconds |
| 91 | 91 | /** |
| 92 | 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 | 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 | 97 | * maximum quality. |
| 98 | 98 | */ |
| 99 | 99 | ResourceImage LoadStageFillingImage( const char * const imagePath ) |
| 100 | 100 | { |
| 101 | 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 | 105 | } // namespace |
| ... | ... | @@ -330,7 +326,6 @@ void CubeTransitionApp::GoToNextImage() |
| 330 | 326 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION); |
| 331 | 327 | mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 332 | 328 | mNextImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); |
| 333 | - mNextImage.SetRelayoutEnabled( false ); | |
| 334 | 329 | mCurrentEffect.SetTargetImage(mNextImage); |
| 335 | 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 | 77 | /** |
| 78 | 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 | 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 | 83 | * maximum quality. |
| 84 | 84 | */ |
| 85 | 85 | ResourceImage LoadStageFillingImage( const char * const imagePath ) |
| 86 | 86 | { |
| 87 | 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 | 91 | } // namespace |
| ... | ... | @@ -254,7 +250,6 @@ void DissolveEffectApp::OnInit( Application& application ) |
| 254 | 250 | |
| 255 | 251 | // show the first image |
| 256 | 252 | mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) ); |
| 257 | - mCurrentImage.SetRelayoutEnabled( false ); | |
| 258 | 253 | mCurrentImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); |
| 259 | 254 | mCurrentImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 260 | 255 | mCurrentImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); |
| ... | ... | @@ -285,7 +280,6 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture& gesture ) |
| 285 | 280 | |
| 286 | 281 | Image image = LoadStageFillingImage( IMAGES[ mIndex ] ); |
| 287 | 282 | mNextImage = ImageActor::New( image ); |
| 288 | - mNextImage.SetRelayoutEnabled( false ); | |
| 289 | 283 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); |
| 290 | 284 | mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 291 | 285 | mNextImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); | ... | ... |
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 | * The functions CreateImage and CreateImageActor below show how to build an |
| 28 | 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 | 31 | * sure that every pixel in the loaded image is filled with a source colour |
| 32 | 32 | * from the image's central region while losing the minimum number of pixels |
| 33 | 33 | * from its periphery. |
| ... | ... | @@ -77,7 +77,7 @@ const unsigned GRID_CELL_PADDING = 4; |
| 77 | 77 | /** The aspect ratio of cells in the image grid. */ |
| 78 | 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 | 82 | /** The number of times to spin an image on touching, each spin taking a second.*/ |
| 83 | 83 | const float SPIN_DURATION = 1.0f; |
| ... | ... | @@ -172,19 +172,15 @@ const unsigned NUM_IMAGE_PATHS = sizeof(IMAGE_PATHS) / sizeof(IMAGE_PATHS[0]) - |
| 172 | 172 | * @param[in] filename The path of the image. |
| 173 | 173 | * @param[in] width The width of the image in pixels. |
| 174 | 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 | 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 | 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 | 184 | return image; |
| 189 | 185 | } |
| 190 | 186 | |
| ... | ... | @@ -194,11 +190,11 @@ Image CreateImage(const std::string& filename, unsigned int width, unsigned int |
| 194 | 190 | * @param[in] filename The path of the image. |
| 195 | 191 | * @param[in] width The width of the image in pixels. |
| 196 | 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 | 198 | ImageActor actor = ImageActor::New( img ); |
| 203 | 199 | actor.SetName( filename ); |
| 204 | 200 | actor.SetParentOrigin(ParentOrigin::CENTER); |
| ... | ... | @@ -208,22 +204,22 @@ ImageActor CreateImageActor(const std::string& filename, unsigned int width, uns |
| 208 | 204 | } |
| 209 | 205 | |
| 210 | 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 | 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 | 214 | break; |
| 219 | - case ImageAttributes::ScaleToFill: | |
| 220 | - newMode = ImageAttributes::FitWidth; | |
| 215 | + case FittingMode::SCALE_TO_FILL: | |
| 216 | + newMode = FittingMode::FIT_WIDTH; | |
| 221 | 217 | break; |
| 222 | - case ImageAttributes::FitWidth: | |
| 223 | - newMode = ImageAttributes::FitHeight; | |
| 218 | + case FittingMode::FIT_WIDTH: | |
| 219 | + newMode = FittingMode::FIT_HEIGHT; | |
| 224 | 220 | break; |
| 225 | - case ImageAttributes::FitHeight: | |
| 226 | - newMode = ImageAttributes::ShrinkToFit; | |
| 221 | + case FittingMode::FIT_HEIGHT: | |
| 222 | + newMode = FittingMode::SHRINK_TO_FIT; | |
| 227 | 223 | break; |
| 228 | 224 | } |
| 229 | 225 | return newMode; |
| ... | ... | @@ -273,7 +269,7 @@ public: |
| 273 | 269 | : mApplication( application ), |
| 274 | 270 | mScrolling( false ) |
| 275 | 271 | { |
| 276 | - std::cout << "ImageScalingScaleToFillController::ImageScalingScaleToFillController" << std::endl; | |
| 272 | + std::cout << "ImageScalingIrregularGridController::ImageScalingIrregularGridController" << std::endl; | |
| 277 | 273 | |
| 278 | 274 | // Connect to the Application's Init signal |
| 279 | 275 | mApplication.InitSignal().Connect( this, &ImageScalingIrregularGridController::Create ); |
| ... | ... | @@ -289,7 +285,7 @@ public: |
| 289 | 285 | */ |
| 290 | 286 | void Create( Application& application ) |
| 291 | 287 | { |
| 292 | - std::cout << "ImageScalingScaleToFillController::Create" << std::endl; | |
| 288 | + std::cout << "ImageScalingIrregularGridController::Create" << std::endl; | |
| 293 | 289 | |
| 294 | 290 | DemoHelper::RequestThemeChange(); |
| 295 | 291 | |
| ... | ... | @@ -326,13 +322,13 @@ public: |
| 326 | 322 | /** |
| 327 | 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 | 327 | Stage stage = Stage::GetCurrent(); |
| 332 | 328 | Vector2 stageSize = stage.GetSize(); |
| 333 | 329 | |
| 334 | 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 | 333 | mScrollView = ScrollView::New(); |
| 338 | 334 | |
| ... | ... | @@ -375,7 +371,7 @@ public: |
| 375 | 371 | Actor BuildImageField( const float fieldWidth, |
| 376 | 372 | const unsigned gridWidth, |
| 377 | 373 | const unsigned maxGridHeight, |
| 378 | - ImageAttributes::ScalingMode scalingMode, | |
| 374 | + Dali::FittingMode::Type fittingMode, | |
| 379 | 375 | float & outFieldHeight ) |
| 380 | 376 | { |
| 381 | 377 | // Generate the list of image configurations to be fitted into the field: |
| ... | ... | @@ -423,7 +419,6 @@ public: |
| 423 | 419 | // coordinates in a frame defined by a parent actor: |
| 424 | 420 | |
| 425 | 421 | Actor gridActor = Actor::New(); |
| 426 | - gridActor.SetRelayoutEnabled( true ); | |
| 427 | 422 | gridActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 428 | 423 | gridActor.SetParentOrigin( ParentOrigin::CENTER ); |
| 429 | 424 | gridActor.SetAnchorPoint( AnchorPoint::CENTER ); |
| ... | ... | @@ -443,11 +438,11 @@ public: |
| 443 | 438 | const Vector2 imageRegionCorner = gridOrigin + cellSize * Vector2( imageSource.cellX, imageSource.cellY ); |
| 444 | 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 | 442 | image.SetPosition( Vector3( imagePosition.x, imagePosition.y, 0 ) ); |
| 448 | 443 | image.SetSize( imageSize ); |
| 449 | 444 | image.TouchedSignal().Connect( this, &ImageScalingIrregularGridController::OnTouchImage ); |
| 450 | - mScalingModes[image.GetId()] = scalingMode; | |
| 445 | + mFittingModes[image.GetId()] = fittingMode; | |
| 451 | 446 | mSizes[image.GetId()] = imageSize; |
| 452 | 447 | |
| 453 | 448 | gridActor.Add( image ); |
| ... | ... | @@ -475,14 +470,14 @@ public: |
| 475 | 470 | |
| 476 | 471 | // Change the scaling mode: |
| 477 | 472 | const unsigned id = actor.GetId(); |
| 478 | - ImageAttributes::ScalingMode newMode = NextMode( mScalingModes[id] ); | |
| 473 | + Dali::FittingMode::Type newMode = NextMode( mFittingModes[id] ); | |
| 479 | 474 | const Vector2 imageSize = mSizes[actor.GetId()]; |
| 480 | 475 | |
| 481 | 476 | ImageActor imageActor = ImageActor::DownCast( actor ); |
| 482 | 477 | Image oldImage = imageActor.GetImage(); |
| 483 | 478 | Image newImage = CreateImage( ResourceImage::DownCast(oldImage).GetUrl(), imageSize.width + 0.5f, imageSize.height + 0.5f, newMode ); |
| 484 | 479 | imageActor.SetImage( newImage ); |
| 485 | - mScalingModes[id] = newMode; | |
| 480 | + mFittingModes[id] = newMode; | |
| 486 | 481 | } |
| 487 | 482 | } |
| 488 | 483 | return false; |
| ... | ... | @@ -520,14 +515,14 @@ public: |
| 520 | 515 | { |
| 521 | 516 | // Cycle the scaling mode options: |
| 522 | 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 | 519 | Image oldImage = gridImageActor.GetImage(); |
| 525 | 520 | Image newImage = CreateImage(ResourceImage::DownCast(oldImage).GetUrl(), imageSize.width, imageSize.height, newMode ); |
| 526 | 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 | 528 | return true; |
| ... | ... | @@ -579,7 +574,7 @@ private: |
| 579 | 574 | Actor mGridActor; ///< The container for the grid of images |
| 580 | 575 | ScrollView mScrollView; ///< ScrollView UI Component |
| 581 | 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 | 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 | 314 | // Create the item view actor |
| 315 | 315 | mImageAtlas = CreateImageAtlas(); |
| 316 | 316 | mItemView = ItemView::New(*this); |
| 317 | - mItemView.SetRelayoutEnabled( false ); | |
| 318 | 317 | mItemView.SetParentOrigin(ParentOrigin::CENTER); |
| 319 | 318 | mItemView.SetAnchorPoint(AnchorPoint::CENTER); |
| 320 | 319 | |
| ... | ... | @@ -905,7 +904,6 @@ public: // From ItemFactory |
| 905 | 904 | // Add a checkbox child actor; invisible until edit-mode is enabled |
| 906 | 905 | |
| 907 | 906 | ImageActor checkbox = ImageActor::New( mWhiteImage ); |
| 908 | - checkbox.SetRelayoutEnabled( false ); | |
| 909 | 907 | checkbox.SetName( "CheckBox" ); |
| 910 | 908 | checkbox.SetColor( Vector4(0.0f,0.0f,0.0f,0.6f) ); |
| 911 | 909 | checkbox.SetParentOrigin( ParentOrigin::TOP_RIGHT ); |
| ... | ... | @@ -922,7 +920,6 @@ public: // From ItemFactory |
| 922 | 920 | actor.Add( checkbox ); |
| 923 | 921 | |
| 924 | 922 | ImageActor tick = ImageActor::New( ResourceImage::New(SELECTED_IMAGE) ); |
| 925 | - tick.SetRelayoutEnabled( false ); | |
| 926 | 923 | tick.SetColorMode( USE_OWN_COLOR ); |
| 927 | 924 | tick.SetName( "Tick" ); |
| 928 | 925 | tick.SetParentOrigin( ParentOrigin::TOP_RIGHT ); |
| ... | ... | @@ -1010,7 +1007,6 @@ private: |
| 1010 | 1007 | slider.Add( text ); |
| 1011 | 1008 | |
| 1012 | 1009 | Actor textContainer = Actor::New(); |
| 1013 | - textContainer.SetRelayoutEnabled( true ); | |
| 1014 | 1010 | textContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 1015 | 1011 | mAlphaFunctionText = TextLabel::New( ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex] ); |
| 1016 | 1012 | mAlphaFunctionText.SetAnchorPoint( ParentOrigin::CENTER ); |
| ... | ... | @@ -1029,7 +1025,6 @@ private: |
| 1029 | 1025 | text.SetSize( 0.0f, LABEL_TEXT_SIZE_Y ); |
| 1030 | 1026 | textContainer.Add( text ); |
| 1031 | 1027 | |
| 1032 | - mMenu.MarkDirtyForRelayout(); | |
| 1033 | 1028 | mMenu.Show(); |
| 1034 | 1029 | mMenuShown = true; |
| 1035 | 1030 | } | ... | ... |
examples/magnifier/magnifier-example.cpp
| ... | ... | @@ -219,14 +219,12 @@ public: |
| 219 | 219 | |
| 220 | 220 | // Create magnifier (controlled by human touch) |
| 221 | 221 | Layer overlay = Layer::New(); |
| 222 | - overlay.SetRelayoutEnabled( false ); | |
| 223 | 222 | overlay.SetSensitive(false); |
| 224 | 223 | overlay.SetParentOrigin( ParentOrigin::CENTER ); |
| 225 | 224 | overlay.SetSize(mStageSize); |
| 226 | 225 | Stage::GetCurrent().Add(overlay); |
| 227 | 226 | |
| 228 | 227 | mMagnifier = Toolkit::Magnifier::New(); |
| 229 | - mMagnifier.SetRelayoutEnabled( false ); | |
| 230 | 228 | mMagnifier.SetSourceActor( mView.GetBackgroundLayer() ); |
| 231 | 229 | mMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width |
| 232 | 230 | mMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR ); |
| ... | ... | @@ -234,7 +232,7 @@ public: |
| 234 | 232 | overlay.Add( mMagnifier ); |
| 235 | 233 | |
| 236 | 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 | 236 | constraint.AddSource( LocalSource(Actor::Property::SIZE) ); |
| 239 | 237 | constraint.AddSource( LocalSource(Actor::Property::PARENT_ORIGIN) ); |
| 240 | 238 | constraint.AddSource( LocalSource(Actor::Property::ANCHOR_POINT) ); |
| ... | ... | @@ -244,7 +242,6 @@ public: |
| 244 | 242 | |
| 245 | 243 | // Create bouncing magnifier automatically bounces around screen. |
| 246 | 244 | mBouncingMagnifier = Toolkit::Magnifier::New(); |
| 247 | - mBouncingMagnifier.SetRelayoutEnabled( false ); | |
| 248 | 245 | mBouncingMagnifier.SetSourceActor( mView.GetBackgroundLayer() ); |
| 249 | 246 | mBouncingMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width |
| 250 | 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 | 92 | /** |
| 93 | 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 | 96 | * smaller than or equal to the specified dimensions while preserving its |
| 97 | 97 | * original aspect ratio. |
| 98 | 98 | */ |
| 99 | 99 | ResourceImage LoadImageFittedInBox( const char * const imagePath, uint32_t maxWidth, uint32_t maxHeight ) |
| 100 | 100 | { |
| 101 | 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 | 105 | } // unnamed namespace |
| ... | ... | @@ -193,8 +189,8 @@ public: |
| 193 | 189 | winHandle.AddAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE ); |
| 194 | 190 | |
| 195 | 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 | 194 | Rotate( static_cast< DeviceOrientation >( degrees ) ); |
| 199 | 195 | |
| 200 | 196 | ... | ... |
examples/motion-stretch/motion-stretch-example.cpp
| ... | ... | @@ -166,8 +166,8 @@ public: |
| 166 | 166 | winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT_INVERSE ); |
| 167 | 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 | 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 | 222 | ImageActor NewWindowController::CreateBlurredMirrorImage(const char* imageName) |
| 223 | 223 | { |
| 224 | 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 | 228 | fbo = FrameBufferImage::New( FBOSize.width, FBOSize.height, Pixel::RGBA8888); |
| 228 | 229 | GaussianBlurView gbv = GaussianBlurView::New(5, 2.0f, Pixel::RGBA8888, 0.5f, 0.5f, true); |
| 229 | 230 | gbv.SetBackgroundColor(Color::TRANSPARENT); |
| ... | ... | @@ -241,7 +242,8 @@ ImageActor NewWindowController::CreateBlurredMirrorImage(const char* imageName) |
| 241 | 242 | FrameBufferImage NewWindowController::CreateFrameBufferForImage(const char* imageName, Image image, ShaderEffect shaderEffect) |
| 242 | 243 | { |
| 243 | 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 | 248 | FrameBufferImage framebuffer = FrameBufferImage::New(FBOSize.x, FBOSize.y ); |
| 247 | 249 | |
| ... | ... | @@ -264,7 +266,6 @@ FrameBufferImage NewWindowController::CreateFrameBufferForImage(const char* imag |
| 264 | 266 | cameraActor.SetNearClippingPlane(1.0f); |
| 265 | 267 | cameraActor.SetAspectRatio(FBOSize.width / FBOSize.height); |
| 266 | 268 | cameraActor.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor |
| 267 | - cameraActor.SetOrientation(Quaternion(M_PI, Vector3::YAXIS)); | |
| 268 | 269 | cameraActor.SetPosition(0.0f, 0.0f, ((FBOSize.height * 0.5f) / tanf(Math::PI * 0.125f))); |
| 269 | 270 | stage.Add(cameraActor); |
| 270 | 271 | ... | ... |
examples/page-turn-view/page-turn-view-example.cpp
| ... | ... | @@ -91,8 +91,6 @@ class PortraitPageFactory : public PageFactory |
| 91 | 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 | 94 | return page; |
| 97 | 95 | } |
| 98 | 96 | }; |
| ... | ... | @@ -129,9 +127,6 @@ class LandscapePageFactory : public PageFactory |
| 129 | 127 | } |
| 130 | 128 | pageFront.Add(pageBack); |
| 131 | 129 | |
| 132 | - pageFront.SetRelayoutEnabled( false ); | |
| 133 | - pageBack.SetRelayoutEnabled( false ); | |
| 134 | - | |
| 135 | 130 | return pageFront; |
| 136 | 131 | } |
| 137 | 132 | }; |
| ... | ... | @@ -237,7 +232,6 @@ void PageTurnController::OnInit( Application& app ) |
| 237 | 232 | |
| 238 | 233 | // Create default View. |
| 239 | 234 | mView = View::New(); |
| 240 | - mView.SetRelayoutEnabled( false ); | |
| 241 | 235 | stage.Add( mView ); |
| 242 | 236 | |
| 243 | 237 | Dali::Window winHandle = app.GetWindow(); |
| ... | ... | @@ -251,7 +245,6 @@ void PageTurnController::OnInit( Application& app ) |
| 251 | 245 | mView.OrientationAnimationStartedSignal().Connect( this, &PageTurnController::OnOrientationAnimationStarted ); |
| 252 | 246 | |
| 253 | 247 | mPageTurnPortraitView = PageTurnPortraitView::New( mPortraitPageFactory, stageSize ); |
| 254 | - mPageTurnPortraitView.SetRelayoutEnabled( false ); | |
| 255 | 248 | mPageTurnPortraitView.SetSpineShadowParameter( Vector2(70.f, 30.f) ); |
| 256 | 249 | mPageTurnPortraitView.PageTurnStartedSignal().Connect( this, &PageTurnController::OnPageStartedTurn ); |
| 257 | 250 | mPageTurnPortraitView.PageTurnFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedTurn ); |
| ... | ... | @@ -260,7 +253,6 @@ void PageTurnController::OnInit( Application& app ) |
| 260 | 253 | mPageTurnPortraitView.SetPositionInheritanceMode( USE_PARENT_POSITION ); |
| 261 | 254 | |
| 262 | 255 | mPageTurnLandscapeView = PageTurnLandscapeView::New( mLandscapePageFactory, Vector2(stageSize.y*0.5f, stageSize.x) ); |
| 263 | - mPageTurnLandscapeView.SetRelayoutEnabled( false ); | |
| 264 | 256 | mPageTurnLandscapeView.PageTurnStartedSignal().Connect( this, &PageTurnController::OnPageStartedTurn ); |
| 265 | 257 | mPageTurnLandscapeView.PageTurnFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedTurn ); |
| 266 | 258 | mPageTurnLandscapeView.PagePanStartedSignal().Connect( this, &PageTurnController::OnPageStartedPan ); | ... | ... |
examples/path-animation/path-animation.cpp
| ... | ... | @@ -70,7 +70,6 @@ public: |
| 70 | 70 | text.SetColor( Vector4(0.0f,0.0f,0.0f,1.0f)); |
| 71 | 71 | |
| 72 | 72 | Slider slider = Slider::New(); |
| 73 | - slider.SetRelayoutEnabled( false ); | |
| 74 | 73 | slider.SetAnchorPoint( AnchorPoint::CENTER_LEFT); |
| 75 | 74 | slider.SetParentOrigin( ParentOrigin::CENTER_RIGHT); |
| 76 | 75 | slider.SetProperty(Slider::Property::LOWER_BOUND, -1.0f ); |
| ... | ... | @@ -102,8 +101,8 @@ public: |
| 102 | 101 | |
| 103 | 102 | //TextInput |
| 104 | 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 | 106 | controlsLayer.SetPosition( 0.0f, stage.GetSize().y*0.8f, 0.0f ); |
| 108 | 107 | controlsLayer.SetAnchorPoint( AnchorPoint::TOP_LEFT); |
| 109 | 108 | controlsLayer.SetParentOrigin( ParentOrigin::TOP_LEFT); |
| ... | ... | @@ -202,7 +201,6 @@ public: |
| 202 | 201 | if( !mControlPoint[index] ) |
| 203 | 202 | { |
| 204 | 203 | mControlPoint[index] = Toolkit::CreateSolidColorActor(Vector4(1.0f,1.0f,1.0f,1.0f)); |
| 205 | - mControlPoint[index].SetRelayoutEnabled( false ); | |
| 206 | 204 | mControlPoint[index].SetParentOrigin( ParentOrigin::TOP_LEFT); |
| 207 | 205 | mControlPoint[index].SetAnchorPoint( AnchorPoint::CENTER ); |
| 208 | 206 | mControlPoint[index].SetSize( 20.0f, 20.0f ); |
| ... | ... | @@ -224,7 +222,6 @@ public: |
| 224 | 222 | if( !mControlPoint[index]) |
| 225 | 223 | { |
| 226 | 224 | mControlPoint[index] = Toolkit::CreateSolidColorActor(Vector4(1.0f,1.0f,1.0f,1.0f)); |
| 227 | - mControlPoint[index].SetRelayoutEnabled( false ); | |
| 228 | 225 | mControlPoint[index].SetParentOrigin( ParentOrigin::TOP_LEFT); |
| 229 | 226 | mControlPoint[index].SetAnchorPoint( AnchorPoint::CENTER ); |
| 230 | 227 | mControlPoint[index].SetSize( 20.0f, 20.0f ); |
| ... | ... | @@ -470,10 +467,8 @@ public: |
| 470 | 467 | DrawPath( 200u ); |
| 471 | 468 | |
| 472 | 469 | //Actor |
| 473 | - ImageAttributes attributes; | |
| 474 | - Image img = ResourceImage::New(ACTOR_IMAGE, attributes ); | |
| 470 | + Image img = ResourceImage::New(ACTOR_IMAGE); | |
| 475 | 471 | mActor = ImageActor::New( img ); |
| 476 | - mActor.SetRelayoutEnabled( false ); | |
| 477 | 472 | mActor.SetAnchorPoint( AnchorPoint::CENTER ); |
| 478 | 473 | mActor.SetSize( 100, 50, 1 ); |
| 479 | 474 | stage.Add( mActor ); | ... | ... |
examples/radial-menu/radial-menu-example.cpp
| ... | ... | @@ -149,7 +149,9 @@ void RadialMenuExample::OnInit(Application& app) |
| 149 | 149 | Toolkit::Alignment::HorizontalRight, |
| 150 | 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 | 155 | Vector2 stageSize = stage.GetSize(); |
| 154 | 156 | float minStageDimension = std::min(stageSize.width, stageSize.height); |
| 155 | 157 | |
| ... | ... | @@ -248,8 +250,8 @@ RadialSweepView RadialMenuExample::CreateSweepView( std::string imageName, |
| 248 | 250 | mImageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); |
| 249 | 251 | |
| 250 | 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 | 255 | RadialSweepView radialSweepView = RadialSweepView::New(); |
| 254 | 256 | radialSweepView.SetDiameter( diameter ); |
| 255 | 257 | radialSweepView.SetInitialAngle( initialAngle ); | ... | ... |
examples/radial-menu/radial-sweep-view-impl.cpp
| ... | ... | @@ -26,10 +26,8 @@ namespace |
| 26 | 26 | * Method to project a point on a circle of radius halfSide at given |
| 27 | 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 | 31 | // 135 90 45 |
| 34 | 32 | // +--+--+ |
| 35 | 33 | // | \|/ | |
| ... | ... | @@ -37,25 +35,25 @@ void CircleSquareProjection( Vector3& position, Degree angle, float halfSide ) |
| 37 | 35 | // | /|\ | |
| 38 | 36 | // +--+--+ |
| 39 | 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 | 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 | 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 | 51 | position.y = halfSide; |
| 54 | 52 | } |
| 55 | 53 | else |
| 56 | 54 | { |
| 57 | 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 | 59 | position.z = 0.0f; |
| ... | ... | @@ -133,7 +131,7 @@ RadialSweepView RadialSweepViewImpl::New( float duration, float diameter, Degree |
| 133 | 131 | } |
| 134 | 132 | |
| 135 | 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 | 135 | mDuration(duration), |
| 138 | 136 | mDiameter(diameter), |
| 139 | 137 | mInitialAngle(initialAngle), |
| ... | ... | @@ -273,7 +271,7 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura |
| 273 | 271 | } |
| 274 | 272 | |
| 275 | 273 | mStencilActor.SetOrientation( Degree(mInitialAngle), Vector3::ZAXIS ); |
| 276 | - mStencilActor.SetProperty( mRotationAngleIndex, static_cast<float>(mInitialSector) ); | |
| 274 | + mStencilActor.SetProperty( mRotationAngleIndex, mInitialSector.degree ); | |
| 277 | 275 | |
| 278 | 276 | if( mRotateActors ) |
| 279 | 277 | { |
| ... | ... | @@ -282,13 +280,13 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura |
| 282 | 280 | Actor actor = mLayer.GetChildAt(i); |
| 283 | 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 | 291 | if( mRotateActorsWithStencil ) |
| 294 | 292 | { |
| ... | ... | @@ -297,7 +295,7 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura |
| 297 | 295 | Actor actor = mLayer.GetChildAt(i); |
| 298 | 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 | 306 | Actor actor = mLayer.GetChildAt(i); |
| 309 | 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 | 355 | mStencilActor.SetCullFace(CullNone); // Allow clockwise & anticlockwise faces |
| 358 | 356 | |
| 359 | 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 | 360 | Source srcStart( mStencilActor, mStartAngleIndex ); |
| 363 | - Source srcRot( mStencilActor, mRotationAngleIndex ); | |
| 361 | + Source srcRotation( mStencilActor, mRotationAngleIndex ); | |
| 364 | 362 | |
| 365 | 363 | // Constrain the vertices of the square mesh to sweep out a sector as the |
| 366 | 364 | // rotation angle is animated. |
| ... | ... | @@ -371,27 +369,27 @@ void RadialSweepViewImpl::CreateStencil( Degree initialSector ) |
| 371 | 369 | |
| 372 | 370 | constraint = Constraint::New<Vector3>( mMesh, mMesh.GetPropertyIndex(2, AnimatableVertex::Property::POSITION), SquareFanConstraint(0) ); |
| 373 | 371 | constraint.AddSource( srcStart ); |
| 374 | - constraint.AddSource( srcRot ); | |
| 372 | + constraint.AddSource( srcRotation ); | |
| 375 | 373 | constraint.Apply(); |
| 376 | 374 | |
| 377 | 375 | constraint = Constraint::New<Vector3>( mMesh, mMesh.GetPropertyIndex(3, AnimatableVertex::Property::POSITION), SquareFanConstraint(1) ); |
| 378 | 376 | constraint.AddSource( srcStart ); |
| 379 | - constraint.AddSource( srcRot ); | |
| 377 | + constraint.AddSource( srcRotation ); | |
| 380 | 378 | constraint.Apply(); |
| 381 | 379 | |
| 382 | 380 | constraint = Constraint::New<Vector3>( mMesh, mMesh.GetPropertyIndex(4, AnimatableVertex::Property::POSITION), SquareFanConstraint(2) ); |
| 383 | 381 | constraint.AddSource( srcStart ); |
| 384 | - constraint.AddSource( srcRot ); | |
| 382 | + constraint.AddSource( srcRotation ); | |
| 385 | 383 | constraint.Apply(); |
| 386 | 384 | |
| 387 | 385 | constraint = Constraint::New<Vector3>( mMesh, mMesh.GetPropertyIndex(5, AnimatableVertex::Property::POSITION), SquareFanConstraint(3) ); |
| 388 | 386 | constraint.AddSource( srcStart ); |
| 389 | - constraint.AddSource( srcRot ); | |
| 387 | + constraint.AddSource( srcRotation ); | |
| 390 | 388 | constraint.Apply(); |
| 391 | 389 | |
| 392 | 390 | constraint = Constraint::New<Vector3>( mMesh, mMesh.GetPropertyIndex(6, AnimatableVertex::Property::POSITION), SquareFanConstraint(4) ); |
| 393 | 391 | constraint.AddSource( srcStart ); |
| 394 | - constraint.AddSource( srcRot ); | |
| 392 | + constraint.AddSource( srcRotation ); | |
| 395 | 393 | constraint.Apply(); |
| 396 | 394 | |
| 397 | 395 | mStencilActor.SetDrawMode( DrawMode::STENCIL ); | ... | ... |
examples/refraction-effect/refraction-effect-example.cpp
| ... | ... | @@ -71,19 +71,14 @@ struct LightOffsetConstraint |
| 71 | 71 | /** |
| 72 | 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 | 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 | 78 | ResourceImage LoadStageFillingImage( const char * const imagePath ) |
| 80 | 79 | { |
| 81 | 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 | 84 | } // namespace | ... | ... |
examples/scroll-view/scroll-view-example.cpp
| ... | ... | @@ -228,7 +228,6 @@ private: |
| 228 | 228 | Vector2 stageSize = stage.GetSize(); |
| 229 | 229 | |
| 230 | 230 | mScrollView = ScrollView::New(); |
| 231 | - mScrollView.SetRelayoutEnabled( false ); | |
| 232 | 231 | mScrollView.SetAnchorPoint(AnchorPoint::CENTER); |
| 233 | 232 | mScrollView.SetParentOrigin(ParentOrigin::CENTER); |
| 234 | 233 | mContentLayer.Add( mScrollView ); |
| ... | ... | @@ -301,7 +300,6 @@ private: |
| 301 | 300 | Actor CreatePage() |
| 302 | 301 | { |
| 303 | 302 | Actor page = Actor::New(); |
| 304 | - page.SetRelayoutEnabled( true ); | |
| 305 | 303 | page.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 306 | 304 | page.SetParentOrigin( ParentOrigin::CENTER ); |
| 307 | 305 | page.SetAnchorPoint( AnchorPoint::CENTER ); |
| ... | ... | @@ -454,7 +452,6 @@ private: |
| 454 | 452 | void ApplyEffectToPage(Actor page) |
| 455 | 453 | { |
| 456 | 454 | page.RemoveConstraints(); |
| 457 | - page.SetRelayoutEnabled( true ); | |
| 458 | 455 | page.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 459 | 456 | |
| 460 | 457 | switch( mEffectMode ) |
| ... | ... | @@ -564,14 +561,9 @@ private: |
| 564 | 561 | */ |
| 565 | 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 | 566 | ImageActor actor = ImageActor::New(img); |
| 574 | - actor.SetRelayoutEnabled( false ); | |
| 575 | 567 | actor.SetName( filename ); |
| 576 | 568 | actor.SetParentOrigin(ParentOrigin::CENTER); |
| 577 | 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 | 33 | const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" ); |
| 34 | 34 | |
| 35 | 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 | 37 | const char* APPLICATION_TITLE_PAN_SCENE( "Lighting: Pan Scene" ); |
| 38 | 38 | const char* APPLICATION_TITLE_ROTATE_SCENE( "Lighting: Rotate Scene" ); |
| 39 | 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 | 43 | const char* SCENE_IMAGE_2( DALI_IMAGE_DIR "gallery-small-42.jpg"); |
| 44 | 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 | 46 | const float MIN_PINCH_SCALE( 0.3f ); |
| 48 | 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 | 54 | |
| 56 | 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 | 78 | : mApp(app), |
| 75 | 79 | mPaused(false), |
| 76 | 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 | 87 | mPinchScale(0.5f), |
| 84 | 88 | mScaleAtPinchStart(0.5f), |
| 85 | 89 | mPanState(PAN_SCENE) |
| ... | ... | @@ -94,18 +98,6 @@ public: |
| 94 | 98 | } |
| 95 | 99 | |
| 96 | 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 | 102 | struct RotationConstraint |
| 111 | 103 | { |
| ... | ... | @@ -116,8 +108,8 @@ public: |
| 116 | 108 | |
| 117 | 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 | 115 | float mSign; |
| ... | ... | @@ -176,7 +168,7 @@ public: |
| 176 | 168 | mView.SetPosition(Vector3(0.0f, 0.0f, -50)); |
| 177 | 169 | |
| 178 | 170 | mContents.SetPosition(mTranslation); |
| 179 | - mContents.SetOrientation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); | |
| 171 | + mContents.SetOrientation( CalculateWorldRotation( mSceneXRotation, mSceneYRotation ) ); | |
| 180 | 172 | mContents.SetScale(mPinchScale, mPinchScale, mPinchScale); |
| 181 | 173 | |
| 182 | 174 | mPanGestureDetector = PanGestureDetector::New(); |
| ... | ... | @@ -200,7 +192,6 @@ public: |
| 200 | 192 | mShadowView.SetName("Container"); |
| 201 | 193 | mShadowView.SetParentOrigin(ParentOrigin::CENTER); |
| 202 | 194 | mShadowView.SetAnchorPoint(AnchorPoint::CENTER); |
| 203 | - mShadowView.SetRelayoutEnabled( true ); | |
| 204 | 195 | mShadowView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 205 | 196 | mShadowView.SetPointLightFieldOfView( Math::PI / 2.0f); |
| 206 | 197 | mContents.Add(mShadowView); |
| ... | ... | @@ -220,7 +211,7 @@ public: |
| 220 | 211 | mLightAnchor = Actor::New(); |
| 221 | 212 | mLightAnchor.SetParentOrigin(ParentOrigin::CENTER); |
| 222 | 213 | mLightAnchor.SetAnchorPoint(AnchorPoint::CENTER); |
| 223 | - mLightAnchor.SetOrientation(CalculateWorldRotation(Radian(mLightLongitudinal), Radian(mLightAxisTilt))); | |
| 214 | + mLightAnchor.SetOrientation( CalculateWorldRotation( mLightXRotation, mLightYRotation ) ); | |
| 224 | 215 | |
| 225 | 216 | // Work out a scaling factor as the initial light position was calculated for desktop |
| 226 | 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 | 262 | mImageActor2.Add(mImageActor1); |
| 272 | 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 | 266 | Source angleSrc( mImageActor2, angleIndex ); |
| 276 | 267 | |
| 277 | 268 | Constraint constraint = Constraint::New<Quaternion>( mImageActor1, Actor::Property::ORIENTATION, RotationConstraint(-1.0f) ); |
| ... | ... | @@ -286,7 +277,7 @@ public: |
| 286 | 277 | |
| 287 | 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 | 282 | mSceneAnimation.SetLooping(true); |
| 292 | 283 | mSceneAnimation.Play(); |
| ... | ... | @@ -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 | 295 | return p*q; |
| 305 | 296 | } |
| 306 | 297 | |
| ... | ... | @@ -331,10 +322,11 @@ public: |
| 331 | 322 | { |
| 332 | 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 | 330 | break; |
| 339 | 331 | } |
| 340 | 332 | |
| ... | ... | @@ -347,19 +339,19 @@ public: |
| 347 | 339 | |
| 348 | 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 | 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 | 355 | break; |
| 364 | 356 | } |
| 365 | 357 | } |
| ... | ... | @@ -422,10 +414,10 @@ public: |
| 422 | 414 | mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_LIGHT) ); |
| 423 | 415 | break; |
| 424 | 416 | case PAN_LIGHT: |
| 425 | - mPanState = PAN_OBJECT; | |
| 417 | + mPanState = ROTATE_OBJECT; | |
| 426 | 418 | mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_OBJECT) ); |
| 427 | 419 | break; |
| 428 | - case PAN_OBJECT: | |
| 420 | + case ROTATE_OBJECT: | |
| 429 | 421 | mPanState = PAN_SCENE; |
| 430 | 422 | mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_SCENE) ); |
| 431 | 423 | break; |
| ... | ... | @@ -443,9 +435,9 @@ public: |
| 443 | 435 | mContents.SetPosition(mTranslation); |
| 444 | 436 | |
| 445 | 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 | 442 | return true; |
| 451 | 443 | } |
| ... | ... | @@ -470,12 +462,12 @@ private: |
| 470 | 462 | PinchGestureDetector mPinchGestureDetector; |
| 471 | 463 | TapGestureDetector mTapGestureDetector; |
| 472 | 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 | 471 | float mPinchScale; |
| 480 | 472 | float mScaleAtPinchStart; |
| 481 | 473 | |
| ... | ... | @@ -489,7 +481,7 @@ private: |
| 489 | 481 | PAN_SCENE, |
| 490 | 482 | ROTATE_SCENE, |
| 491 | 483 | PAN_LIGHT, |
| 492 | - PAN_OBJECT | |
| 484 | + ROTATE_OBJECT | |
| 493 | 485 | }; |
| 494 | 486 | |
| 495 | 487 | PanState mPanState; | ... | ... |
examples/text-field/text-field-example.cpp
| ... | ... | @@ -87,8 +87,10 @@ public: |
| 87 | 87 | mContainer.Add( field ); |
| 88 | 88 | |
| 89 | 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 | 92 | Property::Value fieldText = field.GetProperty( TextField::Property::TEXT ); |
| 93 | + | |
| 92 | 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
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 | 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 | 118 | "name": "Instruction", |
| 120 | 119 | "parent-origin": "BOTTOM_CENTER", |
| 121 | 120 | "anchor-point": "BOTTOM_CENTER", |
| 121 | + "text-color": [1, 0, 0, 1], | |
| 122 | 122 | "position": [ |
| 123 | 123 | 0, |
| 124 | 124 | 0, | ... | ... |
shared/view.h
| ... | ... | @@ -76,8 +76,8 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, |
| 76 | 76 | toolBarLayer.SetName( "TOOLBAR_LAYER" ); |
| 77 | 77 | toolBarLayer.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); |
| 78 | 78 | toolBarLayer.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); |
| 79 | - toolBarLayer.SetSize( 0.0f, style.mToolBarHeight ); | |
| 80 | 79 | toolBarLayer.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::WIDTH ); |
| 80 | + toolBarLayer.SetSize( 0.0f, style.mToolBarHeight ); | |
| 81 | 81 | |
| 82 | 82 | // Raise tool bar layer to the top. |
| 83 | 83 | toolBarLayer.RaiseToTop(); |
| ... | ... | @@ -139,11 +139,7 @@ Dali::Layer CreateView( Dali::Application& application, |
| 139 | 139 | // Set background image, loading it at screen resolution: |
| 140 | 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 | 143 | Dali::ImageActor backgroundImageActor = Dali::ImageActor::New( backgroundImage ); |
| 148 | 144 | view.SetBackground( backgroundImageActor ); |
| 149 | 145 | } | ... | ... |