Commit 140cc98f0888554b3dc1fa5c36a8a5680bdf66bd
Merge remote-tracking branch 'origin/tizen' into new_text
Conflicts: examples/text-view/text-view-example.cpp Change-Id: I112aab85d61c49687bed286c4d6435fae35f416a
Showing
21 changed files
with
177 additions
and
62 deletions
examples/atlas/atlas-example.cpp
| ... | ... | @@ -165,7 +165,7 @@ public: |
| 165 | 165 | { |
| 166 | 166 | if( gesture.state == Gesture::Continuing ) |
| 167 | 167 | { |
| 168 | - actor.MoveBy( Vector3( gesture.displacement ) ); | |
| 168 | + actor.TranslateBy( Vector3( gesture.displacement ) ); | |
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
| ... | ... | @@ -220,7 +220,7 @@ void RunTest( Application& application ) |
| 220 | 220 | application.MainLoop(Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS); |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | -// Entry point for Linux & SLP applications | |
| 223 | +// Entry point for Linux & Tizen applications | |
| 224 | 224 | // |
| 225 | 225 | int main( int argc, char **argv ) |
| 226 | 226 | { | ... | ... |
examples/blocks/blocks-example.cpp
| ... | ... | @@ -346,7 +346,7 @@ private: |
| 346 | 346 | mPaddleImage.SetSize( mPaddleFullSize ); |
| 347 | 347 | |
| 348 | 348 | mWobbleProperty = mPaddle.RegisterProperty(WOBBLE_PROPERTY_NAME, 0.0f); |
| 349 | - Constraint wobbleConstraint = Constraint::New<Quaternion>( Actor::Property::ROTATION, | |
| 349 | + Constraint wobbleConstraint = Constraint::New<Quaternion>( Actor::Property::ORIENTATION, | |
| 350 | 350 | LocalSource(mWobbleProperty), |
| 351 | 351 | WobbleConstraint(10.0f)); |
| 352 | 352 | mPaddle.ApplyConstraint(wobbleConstraint); | ... | ... |
examples/bubble-effect/bubble-effect-example.cpp
| ... | ... | @@ -49,6 +49,25 @@ const unsigned int NUM_BUBBLE_SHAPE_IMAGES( sizeof( BUBBLE_SHAPE_IMAGES ) / size |
| 49 | 49 | |
| 50 | 50 | const Vector2 DEFAULT_BUBBLE_SIZE( 10.f, 30.f ); |
| 51 | 51 | const unsigned int DEFAULT_NUMBER_OF_BUBBLES( 1000 ); |
| 52 | + | |
| 53 | +/** | |
| 54 | + * @brief Load an image, scaled-down to no more than the stage dimensions. | |
| 55 | + * | |
| 56 | + * Uses image scaling mode ImageAttributes::ScaleToFill to resize the image at | |
| 57 | + * load time to cover the entire stage with pixels with no borders, | |
| 58 | + * and filter mode ImageAttributes::BoxThenLinear to sample the image with | |
| 59 | + * maximum quality. | |
| 60 | + */ | |
| 61 | +ResourceImage LoadStageFillingImage( const char * const imagePath ) | |
| 62 | +{ | |
| 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 ); | |
| 69 | +} | |
| 70 | + | |
| 52 | 71 | }// end LOCAL_STUFF |
| 53 | 72 | |
| 54 | 73 | // This example shows the usage of BubbleEmitter which displays lots of moving bubbles on the stage. |
| ... | ... | @@ -114,7 +133,7 @@ private: |
| 114 | 133 | ResourceImage::New( BUBBLE_SHAPE_IMAGES[mCurrentBubbleShapeImageId] ), |
| 115 | 134 | DEFAULT_NUMBER_OF_BUBBLES, |
| 116 | 135 | DEFAULT_BUBBLE_SIZE); |
| 117 | - mBackgroundImage = ResourceImage::New( BACKGROUND_IMAGES[mCurrentBackgroundImageId] ); | |
| 136 | + mBackgroundImage = LoadStageFillingImage( BACKGROUND_IMAGES[mCurrentBackgroundImageId] ); | |
| 118 | 137 | mBubbleEmitter.SetBackground( mBackgroundImage, mHSVDelta ); |
| 119 | 138 | |
| 120 | 139 | // Get the root actor of all bubbles, and add it to stage. |
| ... | ... | @@ -235,7 +254,7 @@ private: |
| 235 | 254 | { |
| 236 | 255 | if(button == mChangeBackgroundButton) |
| 237 | 256 | { |
| 238 | - mBackgroundImage = ResourceImage::New( BACKGROUND_IMAGES[ ++mCurrentBackgroundImageId % NUM_BACKGROUND_IMAGES ] ); | |
| 257 | + mBackgroundImage = LoadStageFillingImage( BACKGROUND_IMAGES[ ++mCurrentBackgroundImageId % NUM_BACKGROUND_IMAGES ] ); | |
| 239 | 258 | |
| 240 | 259 | mBubbleEmitter.SetBackground( mBackgroundImage, mHSVDelta ); |
| 241 | 260 | ... | ... |
examples/buttons/buttons-example.cpp
examples/cluster/cluster-example.cpp
| ... | ... | @@ -524,7 +524,13 @@ public: |
| 524 | 524 | const char **paths = IMAGE_GROUPS[clusterType]; |
| 525 | 525 | DALI_ASSERT_ALWAYS(paths); |
| 526 | 526 | |
| 527 | - // Add a background image to the cluster | |
| 527 | + // Add a background image to the cluster, limiting the loaded size by | |
| 528 | + // fitting it inside a quarter of the stage area with the conservative Box | |
| 529 | + // filter mode: | |
| 530 | + Dali::ImageAttributes backgroundAttributes; | |
| 531 | + backgroundAttributes.SetSize( Stage::GetCurrent().GetSize() * 0.5f ); | |
| 532 | + backgroundAttributes.SetFilterMode( Dali::ImageAttributes::Box ); | |
| 533 | + backgroundAttributes.SetScalingMode( Dali::ImageAttributes::ShrinkToFit ); | |
| 528 | 534 | Image bg = ResourceImage::New( CLUSTER_BACKGROUND_IMAGE_PATH ); |
| 529 | 535 | ImageActor image = ImageActor::New(bg); |
| 530 | 536 | clusterActor.SetBackgroundImage(image); |
| ... | ... | @@ -552,10 +558,12 @@ public: |
| 552 | 558 | actor.SetParentOrigin( ParentOrigin::CENTER ); |
| 553 | 559 | actor.SetAnchorPoint( AnchorPoint::CENTER ); |
| 554 | 560 | |
| 555 | - // Load the thumbnail | |
| 561 | + // Load the thumbnail at quarter of screen width or standard size if that is smaller: | |
| 556 | 562 | ImageAttributes attribs = ImageAttributes::New(); |
| 557 | - attribs.SetSize(CLUSTER_IMAGE_THUMBNAIL_WIDTH, CLUSTER_IMAGE_THUMBNAIL_HEIGHT); | |
| 558 | - attribs.SetScalingMode(Dali::ImageAttributes::ShrinkToFit); | |
| 563 | + Size stageQuarter = Stage::GetCurrent().GetSize() * 0.25f; | |
| 564 | + attribs.SetSize( std::min( stageQuarter.x, CLUSTER_IMAGE_THUMBNAIL_WIDTH), std::min( stageQuarter.y, CLUSTER_IMAGE_THUMBNAIL_HEIGHT ) ); | |
| 565 | + attribs.SetFilterMode( Dali::ImageAttributes::BoxThenLinear ); | |
| 566 | + attribs.SetScalingMode(Dali::ImageAttributes::ShrinkToFit ); | |
| 559 | 567 | |
| 560 | 568 | // Add a shadow image child actor |
| 561 | 569 | Image shadowImage = ResourceImage::New( CLUSTER_SHADOW_IMAGE_PATH, attribs ); |
| ... | ... | @@ -720,12 +728,12 @@ public: |
| 720 | 728 | |
| 721 | 729 | constraint = Constraint::New<float>( angleXAxisProperty, |
| 722 | 730 | Source(mScrollView, scrollOvershootProperty), |
| 723 | - Source(mView, Actor::Property::ROTATION), | |
| 731 | + Source(mView, Actor::Property::ORIENTATION), | |
| 724 | 732 | ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::XAXIS) ); |
| 725 | 733 | shaderEffect.ApplyConstraint(constraint); |
| 726 | 734 | constraint = Constraint::New<float>( angleYAxisProperty, |
| 727 | 735 | Source(mScrollView, scrollOvershootProperty), |
| 728 | - Source(mView, Actor::Property::ROTATION), | |
| 736 | + Source(mView, Actor::Property::ORIENTATION), | |
| 729 | 737 | ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::YAXIS) ); |
| 730 | 738 | shaderEffect.ApplyConstraint(constraint); |
| 731 | 739 | |
| ... | ... | @@ -752,7 +760,7 @@ public: |
| 752 | 760 | |
| 753 | 761 | Property::Index anglePerUnit = shaderEffect.GetPropertyIndex( shaderEffect.GetAnglePerUnitPropertyName() ); |
| 754 | 762 | shaderEffect.ApplyConstraint( Constraint::New<Vector2>( anglePerUnit, |
| 755 | - Source(mView, Actor::Property::ROTATION), | |
| 763 | + Source(mView, Actor::Property::ORIENTATION), | |
| 756 | 764 | CarouselEffectOrientationConstraint( angleSweep ) ) ); |
| 757 | 765 | |
| 758 | 766 | break; |
| ... | ... | @@ -854,7 +862,7 @@ void RunTest(Application& app) |
| 854 | 862 | app.MainLoop(); |
| 855 | 863 | } |
| 856 | 864 | |
| 857 | -// Entry point for Linux & SLP applications | |
| 865 | +// Entry point for Linux & Tizen applications | |
| 858 | 866 | // |
| 859 | 867 | int main(int argc, char **argv) |
| 860 | 868 | { | ... | ... |
examples/cube-transition-effect/cube-transition-effect-example.cpp
| ... | ... | @@ -85,6 +85,25 @@ const float CUBE_DISPLACEMENT_CROSS(30.f); |
| 85 | 85 | |
| 86 | 86 | // The duration of the current image staying on screen when slideshow is on |
| 87 | 87 | const int VIEWINGTIME = 2000; // 2 seconds |
| 88 | + | |
| 89 | +/** | |
| 90 | + * @brief Load an image, scaled-down to no more than the stage dimensions. | |
| 91 | + * | |
| 92 | + * Uses image scaling mode ImageAttributes::ScaleToFill to resize the image at | |
| 93 | + * load time to cover the entire stage with pixels with no borders, | |
| 94 | + * and filter mode ImageAttributes::BoxThenLinear to sample the image with | |
| 95 | + * maximum quality. | |
| 96 | + */ | |
| 97 | +ResourceImage LoadStageFillingImage( const char * const imagePath ) | |
| 98 | +{ | |
| 99 | + Size stageSize = Stage::GetCurrent().GetSize(); | |
| 100 | + ImageAttributes attributes; | |
| 101 | + attributes.SetSize( stageSize.x, stageSize.y ); | |
| 102 | + attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); | |
| 103 | + attributes.SetScalingMode( ImageAttributes::ScaleToFill ); | |
| 104 | + return ResourceImage::New( imagePath, attributes ); | |
| 105 | +} | |
| 106 | + | |
| 88 | 107 | } // namespace |
| 89 | 108 | |
| 90 | 109 | class CubeTransitionApp : public ConnectionTracker |
| ... | ... | @@ -261,7 +280,7 @@ void CubeTransitionApp::OnInit( Application& application ) |
| 261 | 280 | // show the first image |
| 262 | 281 | mImageConstraint = Constraint::New<Vector3>( Actor::Property::SCALE, LocalSource( Actor::Property::SIZE ), ParentSource( Actor::Property::SIZE ), ScaleToFitKeepAspectRatioConstraint() ); |
| 263 | 282 | |
| 264 | - mCurrentImage = ImageActor::New( ResourceImage::New( IMAGES[mIndex] ) ); | |
| 283 | + mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) ); | |
| 265 | 284 | mCurrentImage.SetPositionInheritanceMode( USE_PARENT_POSITION ); |
| 266 | 285 | mCurrentImage.ApplyConstraint( mImageConstraint ); |
| 267 | 286 | mParent.Add( mCurrentImage ); |
| ... | ... | @@ -298,8 +317,9 @@ void CubeTransitionApp::OnPanGesture( Actor actor, const PanGesture& gesture ) |
| 298 | 317 | |
| 299 | 318 | void CubeTransitionApp::GoToNextImage() |
| 300 | 319 | { |
| 301 | - ResourceImage image = ResourceImage::New( IMAGES[ mIndex ] ); | |
| 320 | + ResourceImage image = LoadStageFillingImage( IMAGES[ mIndex ] ); | |
| 302 | 321 | mNextImage = ImageActor::New( image ); |
| 322 | + | |
| 303 | 323 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION); |
| 304 | 324 | mNextImage.ApplyConstraint( mImageConstraint ); |
| 305 | 325 | mCurrentEffect.SetTargetImage(mNextImage); |
| ... | ... | @@ -400,7 +420,7 @@ void CubeTransitionApp::OnKeyEvent(const KeyEvent& event) |
| 400 | 420 | } |
| 401 | 421 | } |
| 402 | 422 | |
| 403 | -// Entry point for Linux & SLP applications | |
| 423 | +// Entry point for Linux & Tizen applications | |
| 404 | 424 | int main( int argc, char **argv ) |
| 405 | 425 | { |
| 406 | 426 | Application application = Application::New( &argc, &argv ); | ... | ... |
examples/dissolve-effect/dissolve-effect-example.cpp
| ... | ... | @@ -71,6 +71,25 @@ const int VIEWINGTIME = 2000; // 2 seconds |
| 71 | 71 | const float TRANSITION_DURATION = 2.5f; //2.5 second |
| 72 | 72 | |
| 73 | 73 | const float INITIAL_DEPTH = -10.0f; |
| 74 | + | |
| 75 | +/** | |
| 76 | + * @brief Load an image, scaled-down to no more than the stage dimensions. | |
| 77 | + * | |
| 78 | + * Uses image scaling mode ImageAttributes::ScaleToFill to resize the image at | |
| 79 | + * load time to cover the entire stage with pixels with no borders, | |
| 80 | + * and filter mode ImageAttributes::BoxThenLinear to sample the image with | |
| 81 | + * maximum quality. | |
| 82 | + */ | |
| 83 | +ResourceImage LoadStageFillingImage( const char * const imagePath ) | |
| 84 | +{ | |
| 85 | + Size stageSize = Stage::GetCurrent().GetSize(); | |
| 86 | + ImageAttributes attributes; | |
| 87 | + attributes.SetSize( stageSize.x, stageSize.y ); | |
| 88 | + attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); | |
| 89 | + attributes.SetScalingMode( ImageAttributes::ScaleToFill ); | |
| 90 | + return ResourceImage::New( imagePath, attributes ); | |
| 91 | +} | |
| 92 | + | |
| 74 | 93 | } // namespace |
| 75 | 94 | |
| 76 | 95 | class DissolveEffectApp : public ConnectionTracker |
| ... | ... | @@ -231,7 +250,7 @@ void DissolveEffectApp::OnInit( Application& application ) |
| 231 | 250 | mSizeConstraint= Constraint::New<Vector3>( Actor::Property::SCALE, LocalSource( Actor::Property::SIZE ), ParentSource( Actor::Property::SIZE ), ScaleToFitKeepAspectRatioConstraint() ); |
| 232 | 251 | |
| 233 | 252 | // show the first image |
| 234 | - mCurrentImage = ImageActor::New( ResourceImage::New( IMAGES[mIndex] ) ); | |
| 253 | + mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) ); | |
| 235 | 254 | mCurrentImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); |
| 236 | 255 | mCurrentImage.ApplyConstraint( mSizeConstraint ); |
| 237 | 256 | mParent.Add( mCurrentImage ); |
| ... | ... | @@ -259,7 +278,7 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture& gesture ) |
| 259 | 278 | mIndex = (mIndex + NUM_IMAGES -1)%NUM_IMAGES; |
| 260 | 279 | } |
| 261 | 280 | |
| 262 | - Image image = ResourceImage::New( IMAGES[ mIndex ] ); | |
| 281 | + Image image = LoadStageFillingImage( IMAGES[ mIndex ] ); | |
| 263 | 282 | mNextImage = ImageActor::New( image ); |
| 264 | 283 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); |
| 265 | 284 | mNextImage.ApplyConstraint( mSizeConstraint ); |
| ... | ... | @@ -368,7 +387,7 @@ bool DissolveEffectApp::OnTimerTick() |
| 368 | 387 | if(mSlideshow) |
| 369 | 388 | { |
| 370 | 389 | mIndex = (mIndex + 1)%NUM_IMAGES; |
| 371 | - Image image = ResourceImage::New( IMAGES[ mIndex ] ); | |
| 390 | + Image image = LoadStageFillingImage( IMAGES[ mIndex ] ); | |
| 372 | 391 | mNextImage = ImageActor::New( image ); |
| 373 | 392 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); |
| 374 | 393 | mNextImage.ApplyConstraint( mSizeConstraint ); |
| ... | ... | @@ -403,7 +422,7 @@ bool DissolveEffectApp::OnTimerTick() |
| 403 | 422 | return false; //return false to stop the timer |
| 404 | 423 | } |
| 405 | 424 | |
| 406 | -// Entry point for Linux & SLP applications | |
| 425 | +// Entry point for Linux & Tizen applications | |
| 407 | 426 | int main( int argc, char **argv ) |
| 408 | 427 | { |
| 409 | 428 | Application application = Application::New( &argc, &argv ); | ... | ... |
examples/hello-world/hello-world-example.cpp
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
| ... | ... | @@ -183,6 +183,7 @@ Image CreateImage(const std::string& filename, unsigned int width, unsigned int |
| 183 | 183 | |
| 184 | 184 | attributes.SetSize( width, height ); |
| 185 | 185 | attributes.SetScalingMode( scalingMode ); |
| 186 | + attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); | |
| 186 | 187 | Image image = ResourceImage::New( filename, attributes ); |
| 187 | 188 | return image; |
| 188 | 189 | } |
| ... | ... | @@ -359,6 +360,9 @@ public: |
| 359 | 360 | mContentLayer.Add( mScrollView ); |
| 360 | 361 | mScrollView.Add( imageField ); |
| 361 | 362 | mGridActor = imageField; |
| 363 | + | |
| 364 | + // Scroll to top of grid so first images loaded are on-screen: | |
| 365 | + mScrollView.ScrollTo( Vector3( 0, -1000000, 0 ) ); | |
| 362 | 366 | } |
| 363 | 367 | |
| 364 | 368 | /** | ... | ... |
examples/logging/logging-example.cpp
examples/magnifier/magnifier-example.cpp
examples/motion-blur/motion-blur-example.cpp
| ... | ... | @@ -88,9 +88,25 @@ const Vector3 BUTTON_TITLE_LABEL_INSTRUCTIONS_POPUP_SIZE_CONSTRAINT( 1.0f, 1.0f, |
| 88 | 88 | const float BUTTON_TITLE_LABEL_Y_OFFSET = 0.05f; |
| 89 | 89 | |
| 90 | 90 | const float ORIENTATION_DURATION = 0.5f; ///< Time to rotate to new orientation. |
| 91 | -} // unnamed namespace | |
| 92 | 91 | |
| 92 | +/** | |
| 93 | + * @brief Load an image, scaled-down to no more than the dimensions passed in. | |
| 94 | + * | |
| 95 | + * Uses ImageAttributes::ShrinkToFit which ensures the resulting image is | |
| 96 | + * smaller than or equal to the specified dimensions while preserving its | |
| 97 | + * original aspect ratio. | |
| 98 | + */ | |
| 99 | +ResourceImage LoadImageFittedInBox( const char * const imagePath, uint32_t maxWidth, uint32_t maxHeight ) | |
| 100 | +{ | |
| 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 ); | |
| 107 | +} | |
| 93 | 108 | |
| 109 | +} // unnamed namespace | |
| 94 | 110 | |
| 95 | 111 | |
| 96 | 112 | // |
| ... | ... | @@ -187,10 +203,15 @@ public: |
| 187 | 203 | // Motion blurred actor |
| 188 | 204 | // |
| 189 | 205 | |
| 190 | - Image image = ResourceImage::New( MOTION_BLUR_ACTOR_IMAGE1 ); | |
| 206 | + // Scale down actor to fit on very low resolution screens with space to interact: | |
| 207 | + Size stageSize = Stage::GetCurrent().GetSize(); | |
| 208 | + mMotionBlurActorSize = Size( std::min( stageSize.x * 0.3f, MOTION_BLUR_ACTOR_WIDTH ), std::min( stageSize.y * 0.3f, MOTION_BLUR_ACTOR_HEIGHT ) ); | |
| 209 | + mMotionBlurActorSize = Size( std::min( mMotionBlurActorSize.x, mMotionBlurActorSize.y ), std::min( mMotionBlurActorSize.x, mMotionBlurActorSize.y ) ); | |
| 210 | + | |
| 211 | + Image image = LoadImageFittedInBox( MOTION_BLUR_ACTOR_IMAGE1, mMotionBlurActorSize.x, mMotionBlurActorSize.y ); | |
| 191 | 212 | mMotionBlurImageActor = ImageActor::New(image); |
| 192 | 213 | mMotionBlurImageActor.SetParentOrigin( ParentOrigin::CENTER ); |
| 193 | - mMotionBlurImageActor.SetSize(MOTION_BLUR_ACTOR_WIDTH, MOTION_BLUR_ACTOR_HEIGHT); | |
| 214 | + mMotionBlurImageActor.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y); | |
| 194 | 215 | |
| 195 | 216 | mContentLayer.Add( mMotionBlurImageActor ); |
| 196 | 217 | |
| ... | ... | @@ -207,8 +228,8 @@ public: |
| 207 | 228 | |
| 208 | 229 | mMotionBlurImageActor2 = ImageActor::New(image); |
| 209 | 230 | mMotionBlurImageActor2.SetParentOrigin( ParentOrigin::CENTER ); |
| 210 | - mMotionBlurImageActor2.SetSize(MOTION_BLUR_ACTOR_WIDTH, MOTION_BLUR_ACTOR_HEIGHT); | |
| 211 | - mMotionBlurImageActor2.SetPosition(MOTION_BLUR_ACTOR_WIDTH * 1.1f, 0.0f); | |
| 231 | + mMotionBlurImageActor2.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y); | |
| 232 | + mMotionBlurImageActor2.SetPosition(mMotionBlurActorSize.x * 1.1f, 0.0f); | |
| 212 | 233 | mMotionBlurImageActor.Add( mMotionBlurImageActor2 ); |
| 213 | 234 | |
| 214 | 235 | // Create shader used for doing motion blur |
| ... | ... | @@ -225,8 +246,8 @@ public: |
| 225 | 246 | |
| 226 | 247 | mMotionBlurImageActor3 = ImageActor::New(image); |
| 227 | 248 | mMotionBlurImageActor3.SetParentOrigin( ParentOrigin::CENTER ); |
| 228 | - mMotionBlurImageActor3.SetSize(MOTION_BLUR_ACTOR_WIDTH, MOTION_BLUR_ACTOR_HEIGHT); | |
| 229 | - mMotionBlurImageActor3.SetPosition(-MOTION_BLUR_ACTOR_WIDTH * 1.1f, 0.0f); | |
| 249 | + mMotionBlurImageActor3.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y); | |
| 250 | + mMotionBlurImageActor3.SetPosition(-mMotionBlurActorSize.x * 1.1f, 0.0f); | |
| 230 | 251 | mMotionBlurImageActor.Add( mMotionBlurImageActor3 ); |
| 231 | 252 | |
| 232 | 253 | // Create shader used for doing motion blur |
| ... | ... | @@ -243,8 +264,8 @@ public: |
| 243 | 264 | |
| 244 | 265 | mMotionBlurImageActor4 = ImageActor::New(image); |
| 245 | 266 | mMotionBlurImageActor4.SetParentOrigin( ParentOrigin::CENTER ); |
| 246 | - mMotionBlurImageActor4.SetSize(MOTION_BLUR_ACTOR_WIDTH, MOTION_BLUR_ACTOR_HEIGHT); | |
| 247 | - mMotionBlurImageActor4.SetPosition(0.0f, MOTION_BLUR_ACTOR_HEIGHT * 1.1f); | |
| 267 | + mMotionBlurImageActor4.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y); | |
| 268 | + mMotionBlurImageActor4.SetPosition(0.0f, mMotionBlurActorSize.y * 1.1f); | |
| 248 | 269 | mMotionBlurImageActor.Add( mMotionBlurImageActor4 ); |
| 249 | 270 | |
| 250 | 271 | // Create shader used for doing motion blur |
| ... | ... | @@ -261,8 +282,8 @@ public: |
| 261 | 282 | |
| 262 | 283 | mMotionBlurImageActor5 = ImageActor::New(image); |
| 263 | 284 | mMotionBlurImageActor5.SetParentOrigin( ParentOrigin::CENTER ); |
| 264 | - mMotionBlurImageActor5.SetSize(MOTION_BLUR_ACTOR_WIDTH, MOTION_BLUR_ACTOR_HEIGHT); | |
| 265 | - mMotionBlurImageActor5.SetPosition(0.0f, -MOTION_BLUR_ACTOR_HEIGHT * 1.1f); | |
| 285 | + mMotionBlurImageActor5.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y); | |
| 286 | + mMotionBlurImageActor5.SetPosition(0.0f, -mMotionBlurActorSize.y * 1.1f); | |
| 266 | 287 | mMotionBlurImageActor.Add( mMotionBlurImageActor5 ); |
| 267 | 288 | |
| 268 | 289 | // Create shader used for doing motion blur |
| ... | ... | @@ -312,7 +333,7 @@ public: |
| 312 | 333 | else |
| 313 | 334 | { |
| 314 | 335 | // set the rotation to match the orientation |
| 315 | - mView.SetRotation( Degree( -orientation ), Vector3::ZAXIS ); | |
| 336 | + mView.SetOrientation( Degree( -orientation ), Vector3::ZAXIS ); | |
| 316 | 337 | mView.SetSize( targetSize ); |
| 317 | 338 | } |
| 318 | 339 | } |
| ... | ... | @@ -478,7 +499,7 @@ public: |
| 478 | 499 | mCurrentImage = 0; |
| 479 | 500 | } |
| 480 | 501 | |
| 481 | - Image blurImage = ResourceImage::New( MOTION_BLUR_ACTOR_IMAGES[mCurrentImage] ); | |
| 502 | + Image blurImage = LoadImageFittedInBox( MOTION_BLUR_ACTOR_IMAGES[mCurrentImage], mMotionBlurActorSize.x, mMotionBlurActorSize.y ); | |
| 482 | 503 | mMotionBlurImageActor.SetImage(blurImage); |
| 483 | 504 | } |
| 484 | 505 | |
| ... | ... | @@ -497,6 +518,7 @@ private: |
| 497 | 518 | // Motion blur |
| 498 | 519 | MotionBlurEffect mMotionBlurEffect; |
| 499 | 520 | ImageActor mMotionBlurImageActor; |
| 521 | + Size mMotionBlurActorSize; | |
| 500 | 522 | |
| 501 | 523 | #ifdef MULTIPLE_MOTION_BLURRED_ACTORS |
| 502 | 524 | MotionBlurEffect mMotionBlurEffect2; |
| ... | ... | @@ -536,7 +558,7 @@ void RunTest(Application& app) |
| 536 | 558 | app.MainLoop(); |
| 537 | 559 | } |
| 538 | 560 | |
| 539 | -// Entry point for Linux & SLP applications | |
| 561 | +// Entry point for Linux & Tizen applications | |
| 540 | 562 | // |
| 541 | 563 | int main(int argc, char **argv) |
| 542 | 564 | { | ... | ... |
examples/motion-stretch/motion-stretch-example.cpp
| ... | ... | @@ -225,7 +225,7 @@ public: |
| 225 | 225 | else |
| 226 | 226 | { |
| 227 | 227 | // set the rotation to match the orientation |
| 228 | - mView.SetRotation( Degree( -orientation ), Vector3::ZAXIS ); | |
| 228 | + mView.SetOrientation( Degree( -orientation ), Vector3::ZAXIS ); | |
| 229 | 229 | mView.SetSize( targetSize ); |
| 230 | 230 | } |
| 231 | 231 | } |
| ... | ... | @@ -434,7 +434,7 @@ void RunTest(Application& app) |
| 434 | 434 | app.MainLoop(); |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | -// Entry point for Linux & SLP applications | |
| 437 | +// Entry point for Linux & Tizen applications | |
| 438 | 438 | // |
| 439 | 439 | int main(int argc, char **argv) |
| 440 | 440 | { | ... | ... |
examples/new-window/new-window-example.cpp
| ... | ... | @@ -259,7 +259,7 @@ FrameBufferImage NewWindowController::CreateFrameBufferForImage(const char* imag |
| 259 | 259 | cameraActor.SetNearClippingPlane(1.0f); |
| 260 | 260 | cameraActor.SetAspectRatio(FBOSize.width / FBOSize.height); |
| 261 | 261 | cameraActor.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor |
| 262 | - cameraActor.SetRotation(Quaternion(M_PI, Vector3::YAXIS)); | |
| 262 | + cameraActor.SetOrientation(Quaternion(M_PI, Vector3::YAXIS)); | |
| 263 | 263 | cameraActor.SetPosition(0.0f, 0.0f, ((FBOSize.height * 0.5f) / tanf(Math::PI * 0.125f))); |
| 264 | 264 | stage.Add(cameraActor); |
| 265 | 265 | |
| ... | ... | @@ -442,7 +442,7 @@ void RunTest(Application& app) |
| 442 | 442 | app.MainLoop(Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS); |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | -// Entry point for Linux & SLP applications | |
| 445 | +// Entry point for Linux & Tizen applications | |
| 446 | 446 | // |
| 447 | 447 | |
| 448 | 448 | int main(int argc, char **argv) | ... | ... |
examples/path-animation/path-animation.cpp
examples/radial-menu/radial-sweep-view-impl.cpp
| ... | ... | @@ -270,7 +270,7 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura |
| 270 | 270 | mStencilActor.SetSize(mDiameter, mDiameter); |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - mStencilActor.SetRotation( Degree(mInitialAngle), Vector3::ZAXIS ); | |
| 273 | + mStencilActor.SetOrientation( Degree(mInitialAngle), Vector3::ZAXIS ); | |
| 274 | 274 | mStencilActor.SetProperty( mRotationAngleIndex, static_cast<float>(mInitialSector) ); |
| 275 | 275 | |
| 276 | 276 | if( mRotateActors ) | ... | ... |
examples/refraction-effect/refraction-effect-example.cpp
| ... | ... | @@ -65,6 +65,24 @@ struct LightOffsetConstraint |
| 65 | 65 | float mRadius; |
| 66 | 66 | }; |
| 67 | 67 | |
| 68 | +/** | |
| 69 | + * @brief Load an image, scaled-down to no more than the stage dimensions. | |
| 70 | + * | |
| 71 | + * Uses image scaling mode ImageAttributes::ScaleToFill to resize the image at | |
| 72 | + * load time to cover the entire stage with pixels with no borders, | |
| 73 | + * and filter mode ImageAttributes::BoxThenLinear to sample the image with | |
| 74 | + * maximum quality. | |
| 75 | + */ | |
| 76 | +ResourceImage LoadStageFillingImage( const char * const imagePath ) | |
| 77 | +{ | |
| 78 | + Size stageSize = Stage::GetCurrent().GetSize(); | |
| 79 | + ImageAttributes attributes; | |
| 80 | + attributes.SetSize( stageSize.x, stageSize.y ); | |
| 81 | + attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); | |
| 82 | + attributes.SetScalingMode( ImageAttributes::ScaleToFill ); | |
| 83 | + return ResourceImage::New( imagePath, attributes ); | |
| 84 | +} | |
| 85 | + | |
| 68 | 86 | } // namespace |
| 69 | 87 | |
| 70 | 88 | /************************************************************************************************ |
| ... | ... | @@ -338,7 +356,7 @@ private: |
| 338 | 356 | mNoEffect = NoEffect::New(); // used in the other situations, basic render shader |
| 339 | 357 | // Create the mesh from the obj file and add to stage |
| 340 | 358 | mMaterial = Material::New( "Material" ) ; |
| 341 | - mMaterial.SetDiffuseTexture(ResourceImage::New(TEXTURE_IMAGES[mCurrentTextureId])); | |
| 359 | + mMaterial.SetDiffuseTexture( LoadStageFillingImage( TEXTURE_IMAGES[mCurrentTextureId] ) ); | |
| 342 | 360 | CreateSurface( MESH_FILES[mCurrentMeshId] ); |
| 343 | 361 | |
| 344 | 362 | // Connect the callback to the touch signal on the mesh actor |
| ... | ... | @@ -371,7 +389,7 @@ private: |
| 371 | 389 | bool OnChangeTexture( Toolkit::Button button ) |
| 372 | 390 | { |
| 373 | 391 | mCurrentTextureId = ( mCurrentTextureId + 1 ) % NUM_TEXTURE_IMAGES; |
| 374 | - mMaterial.SetDiffuseTexture(ResourceImage::New(TEXTURE_IMAGES[mCurrentTextureId])); | |
| 392 | + mMaterial.SetDiffuseTexture( LoadStageFillingImage( TEXTURE_IMAGES[mCurrentTextureId] ) ); | |
| 375 | 393 | |
| 376 | 394 | return true; |
| 377 | 395 | } | ... | ... |
examples/scroll-view/scroll-view-example.cpp
| ... | ... | @@ -315,7 +315,7 @@ private: |
| 315 | 315 | { |
| 316 | 316 | for(int column = 0;column<imageColumns;column++) |
| 317 | 317 | { |
| 318 | - ImageActor image = CreateImage( GetNextImagePath() ); | |
| 318 | + ImageActor image = CreateImage( GetNextImagePath(), imageSize.x, imageSize.y ); | |
| 319 | 319 | |
| 320 | 320 | image.SetParentOrigin( ParentOrigin::CENTER ); |
| 321 | 321 | image.SetAnchorPoint( AnchorPoint::CENTER ); |
| ... | ... | @@ -562,7 +562,8 @@ private: |
| 562 | 562 | ImageAttributes attributes; |
| 563 | 563 | |
| 564 | 564 | attributes.SetSize(width, height); |
| 565 | - attributes.SetScalingMode(ImageAttributes::ShrinkToFit); | |
| 565 | + attributes.SetScalingMode(ImageAttributes::ScaleToFill); | |
| 566 | + attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); | |
| 566 | 567 | Image img = ResourceImage::New(filename, attributes); |
| 567 | 568 | ImageActor actor = ImageActor::New(img); |
| 568 | 569 | actor.SetName( filename ); | ... | ... |
examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp
| ... | ... | @@ -183,7 +183,7 @@ public: |
| 183 | 183 | mView.SetPosition(Vector3(0.0f, 0.0f, -50)); |
| 184 | 184 | |
| 185 | 185 | mContents.SetPosition(mTranslation); |
| 186 | - mContents.SetRotation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); | |
| 186 | + mContents.SetOrientation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); | |
| 187 | 187 | mContents.SetScale(mPinchScale, mPinchScale, mPinchScale); |
| 188 | 188 | |
| 189 | 189 | mPanGestureDetector = PanGestureDetector::New(); |
| ... | ... | @@ -226,7 +226,7 @@ public: |
| 226 | 226 | mLightAnchor = Actor::New(); |
| 227 | 227 | mLightAnchor.SetParentOrigin(ParentOrigin::CENTER); |
| 228 | 228 | mLightAnchor.SetAnchorPoint(AnchorPoint::CENTER); |
| 229 | - mLightAnchor.SetRotation(CalculateWorldRotation(Radian(mLightLongitudinal), Radian(mLightAxisTilt))); | |
| 229 | + mLightAnchor.SetOrientation(CalculateWorldRotation(Radian(mLightLongitudinal), Radian(mLightAxisTilt))); | |
| 230 | 230 | |
| 231 | 231 | // Work out a scaling factor as the initial light position was calculated for desktop |
| 232 | 232 | // Need to scale light position as scene actor size is based on stage size (i.e. much bigger on device) |
| ... | ... | @@ -269,9 +269,9 @@ public: |
| 269 | 269 | |
| 270 | 270 | Property::Index angleIndex = mImageActor2.RegisterProperty("angle", Property::Value(30.0f)); |
| 271 | 271 | Source angleSrc( mImageActor2, angleIndex ); |
| 272 | - mImageActor1.ApplyConstraint(Constraint::New<Quaternion>( Actor::Property::ROTATION, angleSrc, | |
| 272 | + mImageActor1.ApplyConstraint(Constraint::New<Quaternion>( Actor::Property::ORIENTATION, angleSrc, | |
| 273 | 273 | RotationConstraint(-1.0f))); |
| 274 | - mImageActor3.ApplyConstraint(Constraint::New<Quaternion>( Actor::Property::ROTATION, angleSrc, | |
| 274 | + mImageActor3.ApplyConstraint(Constraint::New<Quaternion>( Actor::Property::ORIENTATION, angleSrc, | |
| 275 | 275 | RotationConstraint(+1.0f))); |
| 276 | 276 | |
| 277 | 277 | mSceneAnimation = Animation::New(2.5f); |
| ... | ... | @@ -326,7 +326,7 @@ public: |
| 326 | 326 | mLightLongitudinal += gesture.displacement.x/4.0f; |
| 327 | 327 | mLightAxisTilt -= gesture.displacement.y/6.0f; |
| 328 | 328 | mLightAxisTilt = Clamp<float>(mLightAxisTilt, -90.0f, 90.0f); |
| 329 | - mLightAnchor.SetRotation(CalculateWorldRotation(Radian(mLightLongitudinal), Radian(mLightAxisTilt))); | |
| 329 | + mLightAnchor.SetOrientation(CalculateWorldRotation(Radian(mLightLongitudinal), Radian(mLightAxisTilt))); | |
| 330 | 330 | break; |
| 331 | 331 | } |
| 332 | 332 | |
| ... | ... | @@ -342,7 +342,7 @@ public: |
| 342 | 342 | mLongitudinal += gesture.displacement.x/4.0f; |
| 343 | 343 | mAxisTilt -= gesture.displacement.y/6.0f; |
| 344 | 344 | mAxisTilt = Clamp<float>(mAxisTilt, -90.0f, 90.0f); |
| 345 | - mContents.SetRotation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); | |
| 345 | + mContents.SetOrientation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); | |
| 346 | 346 | break; |
| 347 | 347 | } |
| 348 | 348 | |
| ... | ... | @@ -351,7 +351,7 @@ public: |
| 351 | 351 | mObjectLongitudinal += gesture.displacement.x/4.0f; |
| 352 | 352 | mObjectAxisTilt -= gesture.displacement.y/6.0f; |
| 353 | 353 | mObjectAxisTilt = Clamp<float>(mObjectAxisTilt, -90.0f, 90.0f); |
| 354 | - mSceneActor.SetRotation(CalculateWorldRotation(Radian(mObjectLongitudinal), Radian(mObjectAxisTilt))); | |
| 354 | + mSceneActor.SetOrientation(CalculateWorldRotation(Radian(mObjectLongitudinal), Radian(mObjectAxisTilt))); | |
| 355 | 355 | break; |
| 356 | 356 | } |
| 357 | 357 | } |
| ... | ... | @@ -415,7 +415,7 @@ public: |
| 415 | 415 | // Align scene so that light anchor orientation is Z Axis |
| 416 | 416 | mAxisTilt = -mLightAxisTilt; |
| 417 | 417 | mLongitudinal = -mLightLongitudinal; |
| 418 | - mContents.SetRotation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); | |
| 418 | + mContents.SetOrientation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); | |
| 419 | 419 | |
| 420 | 420 | return true; |
| 421 | 421 | } | ... | ... |
resources/scripts/animation.json
| ... | ... | @@ -59,7 +59,7 @@ |
| 59 | 59 | "duration": 10.0, |
| 60 | 60 | "properties": [{ |
| 61 | 61 | "actor": "image", // referenced actors must exist on stage |
| 62 | - "property": "rotation", | |
| 62 | + "property": "orientation", | |
| 63 | 63 | "value": [0, 0, -45], |
| 64 | 64 | "alpha-function": "EASE_IN_OUT", |
| 65 | 65 | "time-period": { |
| ... | ... | @@ -90,7 +90,7 @@ |
| 90 | 90 | "styles": ["basic-text"], |
| 91 | 91 | "position": [0, -120, 0], |
| 92 | 92 | "size": [200, 200, 1], |
| 93 | - "rotation": [0, 0, 30], | |
| 93 | + "orientation": [0, 0, 30], | |
| 94 | 94 | "signals": [{ |
| 95 | 95 | "name": "touched", |
| 96 | 96 | "action": "play", |
| ... | ... | @@ -102,7 +102,7 @@ |
| 102 | 102 | "parent-origin": "CENTER", |
| 103 | 103 | "anchor-point": "CENTER", |
| 104 | 104 | "size": [200, 200, 1], |
| 105 | - "rotation": [0, 0, 39], | |
| 105 | + "orientation": [0, 0, 39], | |
| 106 | 106 | "position": [-150, -50, 0], |
| 107 | 107 | "text": "or me", |
| 108 | 108 | "signals": [{ | ... | ... |
shared/view.h
| ... | ... | @@ -110,10 +110,14 @@ Dali::Layer CreateView( Dali::Application& application, |
| 110 | 110 | // Add the view to the stage before setting the background. |
| 111 | 111 | stage.Add( view ); |
| 112 | 112 | |
| 113 | - // Set background image. | |
| 114 | - if ( ! backgroundImagePath.empty() ) | |
| 113 | + // Set background image, loading it at screen resolution: | |
| 114 | + if ( !backgroundImagePath.empty() ) | |
| 115 | 115 | { |
| 116 | - Dali::Image backgroundImage = Dali::ResourceImage::New( backgroundImagePath ); | |
| 116 | + Dali::ImageAttributes backgroundAttributes; | |
| 117 | + backgroundAttributes.SetSize( stage.GetSize() ); | |
| 118 | + backgroundAttributes.SetFilterMode( Dali::ImageAttributes::BoxThenLinear ); | |
| 119 | + backgroundAttributes.SetScalingMode( Dali::ImageAttributes::ScaleToFill ); | |
| 120 | + Dali::Image backgroundImage = Dali::ResourceImage::New( backgroundImagePath, backgroundAttributes ); | |
| 117 | 121 | Dali::ImageActor backgroundImageActor = Dali::ImageActor::New( backgroundImage ); |
| 118 | 122 | view.SetBackground( backgroundImageActor ); |
| 119 | 123 | } | ... | ... |