Commit 12c5459fd89a42b4d31310266cbeec0bdc64580f
[dali_1.0.34] Merge branch 'tizen'
Change-Id: Idf8cc91fda1a4d9fd4aa9b1402b65ed4cccee486
Showing
24 changed files
with
209 additions
and
67 deletions
examples/atlas/atlas-example.cpp
| @@ -165,7 +165,7 @@ public: | @@ -165,7 +165,7 @@ public: | ||
| 165 | { | 165 | { |
| 166 | if( gesture.state == Gesture::Continuing ) | 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 | ||
| @@ -221,7 +221,7 @@ void RunTest( Application& application ) | @@ -221,7 +221,7 @@ void RunTest( Application& application ) | ||
| 221 | application.MainLoop(Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS); | 221 | application.MainLoop(Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS); |
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | -// Entry point for Linux & SLP applications | 224 | +// Entry point for Linux & Tizen applications |
| 225 | // | 225 | // |
| 226 | int main( int argc, char **argv ) | 226 | int main( int argc, char **argv ) |
| 227 | { | 227 | { |
examples/blocks/blocks-example.cpp
| @@ -346,7 +346,7 @@ private: | @@ -346,7 +346,7 @@ private: | ||
| 346 | mPaddleImage.SetSize( mPaddleFullSize ); | 346 | mPaddleImage.SetSize( mPaddleFullSize ); |
| 347 | 347 | ||
| 348 | mWobbleProperty = mPaddle.RegisterProperty(WOBBLE_PROPERTY_NAME, 0.0f); | 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 | LocalSource(mWobbleProperty), | 350 | LocalSource(mWobbleProperty), |
| 351 | WobbleConstraint(10.0f)); | 351 | WobbleConstraint(10.0f)); |
| 352 | mPaddle.ApplyConstraint(wobbleConstraint); | 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,6 +49,25 @@ const unsigned int NUM_BUBBLE_SHAPE_IMAGES( sizeof( BUBBLE_SHAPE_IMAGES ) / size | ||
| 49 | 49 | ||
| 50 | const Vector2 DEFAULT_BUBBLE_SIZE( 10.f, 30.f ); | 50 | const Vector2 DEFAULT_BUBBLE_SIZE( 10.f, 30.f ); |
| 51 | const unsigned int DEFAULT_NUMBER_OF_BUBBLES( 1000 ); | 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 | }// end LOCAL_STUFF | 71 | }// end LOCAL_STUFF |
| 53 | 72 | ||
| 54 | // This example shows the usage of BubbleEmitter which displays lots of moving bubbles on the stage. | 73 | // This example shows the usage of BubbleEmitter which displays lots of moving bubbles on the stage. |
| @@ -114,7 +133,7 @@ private: | @@ -114,7 +133,7 @@ private: | ||
| 114 | ResourceImage::New( BUBBLE_SHAPE_IMAGES[mCurrentBubbleShapeImageId] ), | 133 | ResourceImage::New( BUBBLE_SHAPE_IMAGES[mCurrentBubbleShapeImageId] ), |
| 115 | DEFAULT_NUMBER_OF_BUBBLES, | 134 | DEFAULT_NUMBER_OF_BUBBLES, |
| 116 | DEFAULT_BUBBLE_SIZE); | 135 | DEFAULT_BUBBLE_SIZE); |
| 117 | - mBackgroundImage = ResourceImage::New( BACKGROUND_IMAGES[mCurrentBackgroundImageId] ); | 136 | + mBackgroundImage = LoadStageFillingImage( BACKGROUND_IMAGES[mCurrentBackgroundImageId] ); |
| 118 | mBubbleEmitter.SetBackground( mBackgroundImage, mHSVDelta ); | 137 | mBubbleEmitter.SetBackground( mBackgroundImage, mHSVDelta ); |
| 119 | 138 | ||
| 120 | // Get the root actor of all bubbles, and add it to stage. | 139 | // Get the root actor of all bubbles, and add it to stage. |
| @@ -235,7 +254,7 @@ private: | @@ -235,7 +254,7 @@ private: | ||
| 235 | { | 254 | { |
| 236 | if(button == mChangeBackgroundButton) | 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 | mBubbleEmitter.SetBackground( mBackgroundImage, mHSVDelta ); | 259 | mBubbleEmitter.SetBackground( mBackgroundImage, mHSVDelta ); |
| 241 | 260 |
examples/buttons/buttons-example.cpp
| @@ -484,7 +484,7 @@ void RunTest( Application& application ) | @@ -484,7 +484,7 @@ void RunTest( Application& application ) | ||
| 484 | application.MainLoop(); | 484 | application.MainLoop(); |
| 485 | } | 485 | } |
| 486 | 486 | ||
| 487 | -// Entry point for Linux & SLP applications | 487 | +// Entry point for Linux & Tizen applications |
| 488 | // | 488 | // |
| 489 | int main( int argc, char **argv ) | 489 | int main( int argc, char **argv ) |
| 490 | { | 490 | { |
examples/cluster/cluster-example.cpp
| @@ -524,7 +524,13 @@ public: | @@ -524,7 +524,13 @@ public: | ||
| 524 | const char **paths = IMAGE_GROUPS[clusterType]; | 524 | const char **paths = IMAGE_GROUPS[clusterType]; |
| 525 | DALI_ASSERT_ALWAYS(paths); | 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 | Image bg = ResourceImage::New( CLUSTER_BACKGROUND_IMAGE_PATH ); | 534 | Image bg = ResourceImage::New( CLUSTER_BACKGROUND_IMAGE_PATH ); |
| 529 | ImageActor image = ImageActor::New(bg); | 535 | ImageActor image = ImageActor::New(bg); |
| 530 | clusterActor.SetBackgroundImage(image); | 536 | clusterActor.SetBackgroundImage(image); |
| @@ -552,10 +558,12 @@ public: | @@ -552,10 +558,12 @@ public: | ||
| 552 | actor.SetParentOrigin( ParentOrigin::CENTER ); | 558 | actor.SetParentOrigin( ParentOrigin::CENTER ); |
| 553 | actor.SetAnchorPoint( AnchorPoint::CENTER ); | 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 | ImageAttributes attribs = ImageAttributes::New(); | 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 | // Add a shadow image child actor | 568 | // Add a shadow image child actor |
| 561 | Image shadowImage = ResourceImage::New( CLUSTER_SHADOW_IMAGE_PATH, attribs ); | 569 | Image shadowImage = ResourceImage::New( CLUSTER_SHADOW_IMAGE_PATH, attribs ); |
| @@ -720,12 +728,12 @@ public: | @@ -720,12 +728,12 @@ public: | ||
| 720 | 728 | ||
| 721 | constraint = Constraint::New<float>( angleXAxisProperty, | 729 | constraint = Constraint::New<float>( angleXAxisProperty, |
| 722 | Source(mScrollView, scrollOvershootProperty), | 730 | Source(mScrollView, scrollOvershootProperty), |
| 723 | - Source(mView, Actor::Property::ROTATION), | 731 | + Source(mView, Actor::Property::ORIENTATION), |
| 724 | ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::XAXIS) ); | 732 | ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::XAXIS) ); |
| 725 | shaderEffect.ApplyConstraint(constraint); | 733 | shaderEffect.ApplyConstraint(constraint); |
| 726 | constraint = Constraint::New<float>( angleYAxisProperty, | 734 | constraint = Constraint::New<float>( angleYAxisProperty, |
| 727 | Source(mScrollView, scrollOvershootProperty), | 735 | Source(mScrollView, scrollOvershootProperty), |
| 728 | - Source(mView, Actor::Property::ROTATION), | 736 | + Source(mView, Actor::Property::ORIENTATION), |
| 729 | ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::YAXIS) ); | 737 | ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::YAXIS) ); |
| 730 | shaderEffect.ApplyConstraint(constraint); | 738 | shaderEffect.ApplyConstraint(constraint); |
| 731 | 739 | ||
| @@ -752,7 +760,7 @@ public: | @@ -752,7 +760,7 @@ public: | ||
| 752 | 760 | ||
| 753 | Property::Index anglePerUnit = shaderEffect.GetPropertyIndex( shaderEffect.GetAnglePerUnitPropertyName() ); | 761 | Property::Index anglePerUnit = shaderEffect.GetPropertyIndex( shaderEffect.GetAnglePerUnitPropertyName() ); |
| 754 | shaderEffect.ApplyConstraint( Constraint::New<Vector2>( anglePerUnit, | 762 | shaderEffect.ApplyConstraint( Constraint::New<Vector2>( anglePerUnit, |
| 755 | - Source(mView, Actor::Property::ROTATION), | 763 | + Source(mView, Actor::Property::ORIENTATION), |
| 756 | CarouselEffectOrientationConstraint( angleSweep ) ) ); | 764 | CarouselEffectOrientationConstraint( angleSweep ) ) ); |
| 757 | 765 | ||
| 758 | break; | 766 | break; |
| @@ -865,7 +873,7 @@ void RunTest(Application& app) | @@ -865,7 +873,7 @@ void RunTest(Application& app) | ||
| 865 | app.MainLoop(); | 873 | app.MainLoop(); |
| 866 | } | 874 | } |
| 867 | 875 | ||
| 868 | -// Entry point for Linux & SLP applications | 876 | +// Entry point for Linux & Tizen applications |
| 869 | // | 877 | // |
| 870 | int main(int argc, char **argv) | 878 | int main(int argc, char **argv) |
| 871 | { | 879 | { |
examples/cube-transition-effect/cube-transition-effect-example.cpp
| @@ -85,6 +85,25 @@ const float CUBE_DISPLACEMENT_CROSS(30.f); | @@ -85,6 +85,25 @@ const float CUBE_DISPLACEMENT_CROSS(30.f); | ||
| 85 | 85 | ||
| 86 | // The duration of the current image staying on screen when slideshow is on | 86 | // The duration of the current image staying on screen when slideshow is on |
| 87 | const int VIEWINGTIME = 2000; // 2 seconds | 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 | } // namespace | 107 | } // namespace |
| 89 | 108 | ||
| 90 | class CubeTransitionApp : public ConnectionTracker | 109 | class CubeTransitionApp : public ConnectionTracker |
| @@ -266,7 +285,7 @@ void CubeTransitionApp::OnInit( Application& application ) | @@ -266,7 +285,7 @@ void CubeTransitionApp::OnInit( Application& application ) | ||
| 266 | // show the first image | 285 | // show the first image |
| 267 | mImageConstraint = Constraint::New<Vector3>( Actor::Property::SCALE, LocalSource( Actor::Property::SIZE ), ParentSource( Actor::Property::SIZE ), ScaleToFitKeepAspectRatioConstraint() ); | 286 | mImageConstraint = Constraint::New<Vector3>( Actor::Property::SCALE, LocalSource( Actor::Property::SIZE ), ParentSource( Actor::Property::SIZE ), ScaleToFitKeepAspectRatioConstraint() ); |
| 268 | 287 | ||
| 269 | - mCurrentImage = ImageActor::New( ResourceImage::New( IMAGES[mIndex] ) ); | 288 | + mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) ); |
| 270 | mCurrentImage.SetPositionInheritanceMode( USE_PARENT_POSITION ); | 289 | mCurrentImage.SetPositionInheritanceMode( USE_PARENT_POSITION ); |
| 271 | mCurrentImage.ApplyConstraint( mImageConstraint ); | 290 | mCurrentImage.ApplyConstraint( mImageConstraint ); |
| 272 | mParent.Add( mCurrentImage ); | 291 | mParent.Add( mCurrentImage ); |
| @@ -308,8 +327,9 @@ void CubeTransitionApp::OnPanGesture( Actor actor, const PanGesture& gesture ) | @@ -308,8 +327,9 @@ void CubeTransitionApp::OnPanGesture( Actor actor, const PanGesture& gesture ) | ||
| 308 | 327 | ||
| 309 | void CubeTransitionApp::GoToNextImage() | 328 | void CubeTransitionApp::GoToNextImage() |
| 310 | { | 329 | { |
| 311 | - ResourceImage image = ResourceImage::New( IMAGES[ mIndex ] ); | 330 | + ResourceImage image = LoadStageFillingImage( IMAGES[ mIndex ] ); |
| 312 | mNextImage = ImageActor::New( image ); | 331 | mNextImage = ImageActor::New( image ); |
| 332 | + | ||
| 313 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION); | 333 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION); |
| 314 | mNextImage.ApplyConstraint( mImageConstraint ); | 334 | mNextImage.ApplyConstraint( mImageConstraint ); |
| 315 | mCurrentEffect.SetTargetImage(mNextImage); | 335 | mCurrentEffect.SetTargetImage(mNextImage); |
| @@ -417,7 +437,7 @@ void CubeTransitionApp::OnKeyEvent(const KeyEvent& event) | @@ -417,7 +437,7 @@ void CubeTransitionApp::OnKeyEvent(const KeyEvent& event) | ||
| 417 | } | 437 | } |
| 418 | } | 438 | } |
| 419 | 439 | ||
| 420 | -// Entry point for Linux & SLP applications | 440 | +// Entry point for Linux & Tizen applications |
| 421 | int main( int argc, char **argv ) | 441 | int main( int argc, char **argv ) |
| 422 | { | 442 | { |
| 423 | Application application = Application::New( &argc, &argv ); | 443 | Application application = Application::New( &argc, &argv ); |
examples/dissolve-effect/dissolve-effect-example.cpp
| @@ -71,6 +71,25 @@ const int VIEWINGTIME = 2000; // 2 seconds | @@ -71,6 +71,25 @@ const int VIEWINGTIME = 2000; // 2 seconds | ||
| 71 | const float TRANSITION_DURATION = 2.5f; //2.5 second | 71 | const float TRANSITION_DURATION = 2.5f; //2.5 second |
| 72 | 72 | ||
| 73 | const float INITIAL_DEPTH = -10.0f; | 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 | } // namespace | 93 | } // namespace |
| 75 | 94 | ||
| 76 | class DissolveEffectApp : public ConnectionTracker | 95 | class DissolveEffectApp : public ConnectionTracker |
| @@ -235,7 +254,7 @@ void DissolveEffectApp::OnInit( Application& application ) | @@ -235,7 +254,7 @@ void DissolveEffectApp::OnInit( Application& application ) | ||
| 235 | mSizeConstraint= Constraint::New<Vector3>( Actor::Property::SCALE, LocalSource( Actor::Property::SIZE ), ParentSource( Actor::Property::SIZE ), ScaleToFitKeepAspectRatioConstraint() ); | 254 | mSizeConstraint= Constraint::New<Vector3>( Actor::Property::SCALE, LocalSource( Actor::Property::SIZE ), ParentSource( Actor::Property::SIZE ), ScaleToFitKeepAspectRatioConstraint() ); |
| 236 | 255 | ||
| 237 | // show the first image | 256 | // show the first image |
| 238 | - mCurrentImage = ImageActor::New( ResourceImage::New( IMAGES[mIndex] ) ); | 257 | + mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) ); |
| 239 | mCurrentImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); | 258 | mCurrentImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); |
| 240 | mCurrentImage.ApplyConstraint( mSizeConstraint ); | 259 | mCurrentImage.ApplyConstraint( mSizeConstraint ); |
| 241 | mParent.Add( mCurrentImage ); | 260 | mParent.Add( mCurrentImage ); |
| @@ -263,7 +282,7 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture& gesture ) | @@ -263,7 +282,7 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture& gesture ) | ||
| 263 | mIndex = (mIndex + NUM_IMAGES -1)%NUM_IMAGES; | 282 | mIndex = (mIndex + NUM_IMAGES -1)%NUM_IMAGES; |
| 264 | } | 283 | } |
| 265 | 284 | ||
| 266 | - Image image = ResourceImage::New( IMAGES[ mIndex ] ); | 285 | + Image image = LoadStageFillingImage( IMAGES[ mIndex ] ); |
| 267 | mNextImage = ImageActor::New( image ); | 286 | mNextImage = ImageActor::New( image ); |
| 268 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); | 287 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); |
| 269 | mNextImage.ApplyConstraint( mSizeConstraint ); | 288 | mNextImage.ApplyConstraint( mSizeConstraint ); |
| @@ -375,7 +394,7 @@ bool DissolveEffectApp::OnTimerTick() | @@ -375,7 +394,7 @@ bool DissolveEffectApp::OnTimerTick() | ||
| 375 | if(mSlideshow) | 394 | if(mSlideshow) |
| 376 | { | 395 | { |
| 377 | mIndex = (mIndex + 1)%NUM_IMAGES; | 396 | mIndex = (mIndex + 1)%NUM_IMAGES; |
| 378 | - Image image = ResourceImage::New( IMAGES[ mIndex ] ); | 397 | + Image image = LoadStageFillingImage( IMAGES[ mIndex ] ); |
| 379 | mNextImage = ImageActor::New( image ); | 398 | mNextImage = ImageActor::New( image ); |
| 380 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); | 399 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); |
| 381 | mNextImage.ApplyConstraint( mSizeConstraint ); | 400 | mNextImage.ApplyConstraint( mSizeConstraint ); |
| @@ -410,7 +429,7 @@ bool DissolveEffectApp::OnTimerTick() | @@ -410,7 +429,7 @@ bool DissolveEffectApp::OnTimerTick() | ||
| 410 | return false; //return false to stop the timer | 429 | return false; //return false to stop the timer |
| 411 | } | 430 | } |
| 412 | 431 | ||
| 413 | -// Entry point for Linux & SLP applications | 432 | +// Entry point for Linux & Tizen applications |
| 414 | int main( int argc, char **argv ) | 433 | int main( int argc, char **argv ) |
| 415 | { | 434 | { |
| 416 | Application application = Application::New( &argc, &argv ); | 435 | Application application = Application::New( &argc, &argv ); |
examples/hello-world/hello-world-example.cpp
| @@ -79,7 +79,7 @@ void RunTest( Application& application ) | @@ -79,7 +79,7 @@ void RunTest( Application& application ) | ||
| 79 | application.MainLoop(); | 79 | application.MainLoop(); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | -// Entry point for Linux & SLP applications | 82 | +// Entry point for Linux & Tizen applications |
| 83 | // | 83 | // |
| 84 | int main( int argc, char **argv ) | 84 | int main( int argc, char **argv ) |
| 85 | { | 85 | { |
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,6 +183,7 @@ Image CreateImage(const std::string& filename, unsigned int width, unsigned int | ||
| 183 | 183 | ||
| 184 | attributes.SetSize( width, height ); | 184 | attributes.SetSize( width, height ); |
| 185 | attributes.SetScalingMode( scalingMode ); | 185 | attributes.SetScalingMode( scalingMode ); |
| 186 | + attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); | ||
| 186 | Image image = ResourceImage::New( filename, attributes ); | 187 | Image image = ResourceImage::New( filename, attributes ); |
| 187 | return image; | 188 | return image; |
| 188 | } | 189 | } |
| @@ -359,6 +360,9 @@ public: | @@ -359,6 +360,9 @@ public: | ||
| 359 | mContentLayer.Add( mScrollView ); | 360 | mContentLayer.Add( mScrollView ); |
| 360 | mScrollView.Add( imageField ); | 361 | mScrollView.Add( imageField ); |
| 361 | mGridActor = imageField; | 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/item-view/item-view-example.cpp
| @@ -99,6 +99,10 @@ const char* IMAGE_PATHS[] = { | @@ -99,6 +99,10 @@ const char* IMAGE_PATHS[] = { | ||
| 99 | 99 | ||
| 100 | const unsigned int NUM_IMAGES = sizeof(IMAGE_PATHS) / sizeof(char*); | 100 | const unsigned int NUM_IMAGES = sizeof(IMAGE_PATHS) / sizeof(char*); |
| 101 | 101 | ||
| 102 | +const unsigned int IMAGE_WIDTH = 256; | ||
| 103 | +const unsigned int IMAGE_HEIGHT = 256; | ||
| 104 | +const unsigned int NUM_IMAGE_PER_ROW_IN_ATLAS = 8; | ||
| 105 | + | ||
| 102 | AlphaFunction ALPHA_FUNCTIONS[] = { AlphaFunctions::Linear, | 106 | AlphaFunction ALPHA_FUNCTIONS[] = { AlphaFunctions::Linear, |
| 103 | AlphaFunctions::EaseIn, | 107 | AlphaFunctions::EaseIn, |
| 104 | AlphaFunctions::EaseOut }; | 108 | AlphaFunctions::EaseOut }; |
| @@ -312,6 +316,7 @@ public: | @@ -312,6 +316,7 @@ public: | ||
| 312 | stage.Add( mReplaceButton ); | 316 | stage.Add( mReplaceButton ); |
| 313 | 317 | ||
| 314 | // Create the item view actor | 318 | // Create the item view actor |
| 319 | + mImageAtlas = CreateImageAtlas(); | ||
| 315 | mItemView = ItemView::New(*this); | 320 | mItemView = ItemView::New(*this); |
| 316 | mItemView.SetParentOrigin(ParentOrigin::CENTER); | 321 | mItemView.SetParentOrigin(ParentOrigin::CENTER); |
| 317 | mItemView.SetAnchorPoint(AnchorPoint::CENTER); | 322 | mItemView.SetAnchorPoint(AnchorPoint::CENTER); |
| @@ -876,8 +881,12 @@ public: // From ItemFactory | @@ -876,8 +881,12 @@ public: // From ItemFactory | ||
| 876 | virtual Actor NewItem(unsigned int itemId) | 881 | virtual Actor NewItem(unsigned int itemId) |
| 877 | { | 882 | { |
| 878 | // Create an image actor for this item | 883 | // Create an image actor for this item |
| 879 | - Image image = ResourceImage::New( IMAGE_PATHS[itemId % NUM_IMAGES] ); | ||
| 880 | - Actor actor = ImageActor::New(image); | 884 | + unsigned int imageId = itemId % NUM_IMAGES; |
| 885 | + ImageActor::PixelArea pixelArea( (imageId%NUM_IMAGE_PER_ROW_IN_ATLAS)*IMAGE_WIDTH, | ||
| 886 | + (imageId/NUM_IMAGE_PER_ROW_IN_ATLAS)*IMAGE_HEIGHT, | ||
| 887 | + IMAGE_WIDTH, | ||
| 888 | + IMAGE_HEIGHT ); | ||
| 889 | + Actor actor = ImageActor::New(mImageAtlas, pixelArea); | ||
| 881 | actor.SetPosition( INITIAL_OFFSCREEN_POSITION ); | 890 | actor.SetPosition( INITIAL_OFFSCREEN_POSITION ); |
| 882 | 891 | ||
| 883 | // Add a border image child actor | 892 | // Add a border image child actor |
| @@ -936,6 +945,23 @@ public: // From ItemFactory | @@ -936,6 +945,23 @@ public: // From ItemFactory | ||
| 936 | private: | 945 | private: |
| 937 | 946 | ||
| 938 | /** | 947 | /** |
| 948 | + * Create an Atlas to tile the images inside. | ||
| 949 | + */ | ||
| 950 | + Atlas CreateImageAtlas() | ||
| 951 | + { | ||
| 952 | + const unsigned int atlas_width = IMAGE_WIDTH*NUM_IMAGE_PER_ROW_IN_ATLAS; | ||
| 953 | + const unsigned int atlas_height = IMAGE_HEIGHT*ceil( static_cast<float>(NUM_IMAGES)/ static_cast<float>(NUM_IMAGE_PER_ROW_IN_ATLAS)); | ||
| 954 | + Atlas atlas = Atlas::New(atlas_width, atlas_height, Pixel::RGB888); | ||
| 955 | + | ||
| 956 | + for( unsigned int i = 0; i < NUM_IMAGES; i++ ) | ||
| 957 | + { | ||
| 958 | + atlas.Upload( IMAGE_PATHS[i], (i%NUM_IMAGE_PER_ROW_IN_ATLAS)*IMAGE_WIDTH, (i/NUM_IMAGE_PER_ROW_IN_ATLAS)*IMAGE_HEIGHT ); | ||
| 959 | + } | ||
| 960 | + | ||
| 961 | + return atlas; | ||
| 962 | + } | ||
| 963 | + | ||
| 964 | + /** | ||
| 939 | * Sets/Updates the title of the View | 965 | * Sets/Updates the title of the View |
| 940 | * @param[in] title The new title for the view. | 966 | * @param[in] title The new title for the view. |
| 941 | */ | 967 | */ |
| @@ -1107,6 +1133,7 @@ private: | @@ -1107,6 +1133,7 @@ private: | ||
| 1107 | 1133 | ||
| 1108 | ItemView mItemView; | 1134 | ItemView mItemView; |
| 1109 | Image mBorderImage; | 1135 | Image mBorderImage; |
| 1136 | + Atlas mImageAtlas; | ||
| 1110 | unsigned int mCurrentLayout; | 1137 | unsigned int mCurrentLayout; |
| 1111 | float mDurationSeconds; | 1138 | float mDurationSeconds; |
| 1112 | 1139 |
examples/logging/logging-example.cpp
| @@ -763,7 +763,7 @@ void RunTest( Application& application ) | @@ -763,7 +763,7 @@ void RunTest( Application& application ) | ||
| 763 | application.MainLoop(); | 763 | application.MainLoop(); |
| 764 | } | 764 | } |
| 765 | 765 | ||
| 766 | -// Entry point for Linux & SLP applications | 766 | +// Entry point for Linux & Tizen applications |
| 767 | // | 767 | // |
| 768 | int main( int argc, char **argv ) | 768 | int main( int argc, char **argv ) |
| 769 | { | 769 | { |
examples/magnifier/magnifier-example.cpp
| @@ -422,7 +422,7 @@ void RunTest( Application& application ) | @@ -422,7 +422,7 @@ void RunTest( Application& application ) | ||
| 422 | application.MainLoop(); | 422 | application.MainLoop(); |
| 423 | } | 423 | } |
| 424 | 424 | ||
| 425 | -// Entry point for Linux & SLP applications | 425 | +// Entry point for Linux & Tizen applications |
| 426 | // | 426 | // |
| 427 | int main( int argc, char **argv ) | 427 | int main( int argc, char **argv ) |
| 428 | { | 428 | { |
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,9 +88,25 @@ const Vector3 BUTTON_TITLE_LABEL_INSTRUCTIONS_POPUP_SIZE_CONSTRAINT( 1.0f, 1.0f, | ||
| 88 | const float BUTTON_TITLE_LABEL_Y_OFFSET = 0.05f; | 88 | const float BUTTON_TITLE_LABEL_Y_OFFSET = 0.05f; |
| 89 | 89 | ||
| 90 | const float ORIENTATION_DURATION = 0.5f; ///< Time to rotate to new orientation. | 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,10 +203,15 @@ public: | ||
| 187 | // Motion blurred actor | 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 | mMotionBlurImageActor = ImageActor::New(image); | 212 | mMotionBlurImageActor = ImageActor::New(image); |
| 192 | mMotionBlurImageActor.SetParentOrigin( ParentOrigin::CENTER ); | 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 | mContentLayer.Add( mMotionBlurImageActor ); | 216 | mContentLayer.Add( mMotionBlurImageActor ); |
| 196 | 217 | ||
| @@ -207,8 +228,8 @@ public: | @@ -207,8 +228,8 @@ public: | ||
| 207 | 228 | ||
| 208 | mMotionBlurImageActor2 = ImageActor::New(image); | 229 | mMotionBlurImageActor2 = ImageActor::New(image); |
| 209 | mMotionBlurImageActor2.SetParentOrigin( ParentOrigin::CENTER ); | 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 | mMotionBlurImageActor.Add( mMotionBlurImageActor2 ); | 233 | mMotionBlurImageActor.Add( mMotionBlurImageActor2 ); |
| 213 | 234 | ||
| 214 | // Create shader used for doing motion blur | 235 | // Create shader used for doing motion blur |
| @@ -225,8 +246,8 @@ public: | @@ -225,8 +246,8 @@ public: | ||
| 225 | 246 | ||
| 226 | mMotionBlurImageActor3 = ImageActor::New(image); | 247 | mMotionBlurImageActor3 = ImageActor::New(image); |
| 227 | mMotionBlurImageActor3.SetParentOrigin( ParentOrigin::CENTER ); | 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 | mMotionBlurImageActor.Add( mMotionBlurImageActor3 ); | 251 | mMotionBlurImageActor.Add( mMotionBlurImageActor3 ); |
| 231 | 252 | ||
| 232 | // Create shader used for doing motion blur | 253 | // Create shader used for doing motion blur |
| @@ -243,8 +264,8 @@ public: | @@ -243,8 +264,8 @@ public: | ||
| 243 | 264 | ||
| 244 | mMotionBlurImageActor4 = ImageActor::New(image); | 265 | mMotionBlurImageActor4 = ImageActor::New(image); |
| 245 | mMotionBlurImageActor4.SetParentOrigin( ParentOrigin::CENTER ); | 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 | mMotionBlurImageActor.Add( mMotionBlurImageActor4 ); | 269 | mMotionBlurImageActor.Add( mMotionBlurImageActor4 ); |
| 249 | 270 | ||
| 250 | // Create shader used for doing motion blur | 271 | // Create shader used for doing motion blur |
| @@ -261,8 +282,8 @@ public: | @@ -261,8 +282,8 @@ public: | ||
| 261 | 282 | ||
| 262 | mMotionBlurImageActor5 = ImageActor::New(image); | 283 | mMotionBlurImageActor5 = ImageActor::New(image); |
| 263 | mMotionBlurImageActor5.SetParentOrigin( ParentOrigin::CENTER ); | 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 | mMotionBlurImageActor.Add( mMotionBlurImageActor5 ); | 287 | mMotionBlurImageActor.Add( mMotionBlurImageActor5 ); |
| 267 | 288 | ||
| 268 | // Create shader used for doing motion blur | 289 | // Create shader used for doing motion blur |
| @@ -312,7 +333,7 @@ public: | @@ -312,7 +333,7 @@ public: | ||
| 312 | else | 333 | else |
| 313 | { | 334 | { |
| 314 | // set the rotation to match the orientation | 335 | // set the rotation to match the orientation |
| 315 | - mView.SetRotation( Degree( -orientation ), Vector3::ZAXIS ); | 336 | + mView.SetOrientation( Degree( -orientation ), Vector3::ZAXIS ); |
| 316 | mView.SetSize( targetSize ); | 337 | mView.SetSize( targetSize ); |
| 317 | } | 338 | } |
| 318 | } | 339 | } |
| @@ -478,7 +499,7 @@ public: | @@ -478,7 +499,7 @@ public: | ||
| 478 | mCurrentImage = 0; | 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 | mMotionBlurImageActor.SetImage(blurImage); | 503 | mMotionBlurImageActor.SetImage(blurImage); |
| 483 | } | 504 | } |
| 484 | 505 | ||
| @@ -498,6 +519,7 @@ private: | @@ -498,6 +519,7 @@ private: | ||
| 498 | // Motion blur | 519 | // Motion blur |
| 499 | MotionBlurEffect mMotionBlurEffect; | 520 | MotionBlurEffect mMotionBlurEffect; |
| 500 | ImageActor mMotionBlurImageActor; | 521 | ImageActor mMotionBlurImageActor; |
| 522 | + Size mMotionBlurActorSize; | ||
| 501 | 523 | ||
| 502 | #ifdef MULTIPLE_MOTION_BLURRED_ACTORS | 524 | #ifdef MULTIPLE_MOTION_BLURRED_ACTORS |
| 503 | MotionBlurEffect mMotionBlurEffect2; | 525 | MotionBlurEffect mMotionBlurEffect2; |
| @@ -537,7 +559,7 @@ void RunTest(Application& app) | @@ -537,7 +559,7 @@ void RunTest(Application& app) | ||
| 537 | app.MainLoop(); | 559 | app.MainLoop(); |
| 538 | } | 560 | } |
| 539 | 561 | ||
| 540 | -// Entry point for Linux & SLP applications | 562 | +// Entry point for Linux & Tizen applications |
| 541 | // | 563 | // |
| 542 | int main(int argc, char **argv) | 564 | int main(int argc, char **argv) |
| 543 | { | 565 | { |
examples/motion-stretch/motion-stretch-example.cpp
| @@ -225,7 +225,7 @@ public: | @@ -225,7 +225,7 @@ public: | ||
| 225 | else | 225 | else |
| 226 | { | 226 | { |
| 227 | // set the rotation to match the orientation | 227 | // set the rotation to match the orientation |
| 228 | - mView.SetRotation( Degree( -orientation ), Vector3::ZAXIS ); | 228 | + mView.SetOrientation( Degree( -orientation ), Vector3::ZAXIS ); |
| 229 | mView.SetSize( targetSize ); | 229 | mView.SetSize( targetSize ); |
| 230 | } | 230 | } |
| 231 | } | 231 | } |
| @@ -435,7 +435,7 @@ void RunTest(Application& app) | @@ -435,7 +435,7 @@ void RunTest(Application& app) | ||
| 435 | app.MainLoop(); | 435 | app.MainLoop(); |
| 436 | } | 436 | } |
| 437 | 437 | ||
| 438 | -// Entry point for Linux & SLP applications | 438 | +// Entry point for Linux & Tizen applications |
| 439 | // | 439 | // |
| 440 | int main(int argc, char **argv) | 440 | int main(int argc, char **argv) |
| 441 | { | 441 | { |
examples/new-window/new-window-example.cpp
| @@ -262,7 +262,7 @@ FrameBufferImage NewWindowController::CreateFrameBufferForImage(const char* imag | @@ -262,7 +262,7 @@ FrameBufferImage NewWindowController::CreateFrameBufferForImage(const char* imag | ||
| 262 | cameraActor.SetNearClippingPlane(1.0f); | 262 | cameraActor.SetNearClippingPlane(1.0f); |
| 263 | cameraActor.SetAspectRatio(FBOSize.width / FBOSize.height); | 263 | cameraActor.SetAspectRatio(FBOSize.width / FBOSize.height); |
| 264 | cameraActor.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor | 264 | cameraActor.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor |
| 265 | - cameraActor.SetRotation(Quaternion(M_PI, Vector3::YAXIS)); | 265 | + cameraActor.SetOrientation(Quaternion(M_PI, Vector3::YAXIS)); |
| 266 | cameraActor.SetPosition(0.0f, 0.0f, ((FBOSize.height * 0.5f) / tanf(Math::PI * 0.125f))); | 266 | cameraActor.SetPosition(0.0f, 0.0f, ((FBOSize.height * 0.5f) / tanf(Math::PI * 0.125f))); |
| 267 | stage.Add(cameraActor); | 267 | stage.Add(cameraActor); |
| 268 | 268 | ||
| @@ -449,7 +449,7 @@ void RunTest(Application& app) | @@ -449,7 +449,7 @@ void RunTest(Application& app) | ||
| 449 | app.MainLoop(Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS); | 449 | app.MainLoop(Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS); |
| 450 | } | 450 | } |
| 451 | 451 | ||
| 452 | -// Entry point for Linux & SLP applications | 452 | +// Entry point for Linux & Tizen applications |
| 453 | // | 453 | // |
| 454 | 454 | ||
| 455 | int main(int argc, char **argv) | 455 | int main(int argc, char **argv) |
examples/path-animation/path-animation.cpp
| @@ -247,7 +247,7 @@ public: | @@ -247,7 +247,7 @@ public: | ||
| 247 | { | 247 | { |
| 248 | mAnimation.Pause(); | 248 | mAnimation.Pause(); |
| 249 | mAnimation.Clear(); | 249 | mAnimation.Clear(); |
| 250 | - mActor.SetRotation( Quaternion() ); | 250 | + mActor.SetOrientation( Quaternion() ); |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | mAnimation.Animate( mActor, mPath, mForward ); | 253 | mAnimation.Animate( mActor, mPath, mForward ); |
examples/radial-menu/radial-sweep-view-impl.cpp
| @@ -270,7 +270,7 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura | @@ -270,7 +270,7 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura | ||
| 270 | mStencilActor.SetSize(mDiameter, mDiameter); | 270 | mStencilActor.SetSize(mDiameter, mDiameter); |
| 271 | } | 271 | } |
| 272 | 272 | ||
| 273 | - mStencilActor.SetRotation( Degree(mInitialAngle), Vector3::ZAXIS ); | 273 | + mStencilActor.SetOrientation( Degree(mInitialAngle), Vector3::ZAXIS ); |
| 274 | mStencilActor.SetProperty( mRotationAngleIndex, static_cast<float>(mInitialSector) ); | 274 | mStencilActor.SetProperty( mRotationAngleIndex, static_cast<float>(mInitialSector) ); |
| 275 | 275 | ||
| 276 | if( mRotateActors ) | 276 | if( mRotateActors ) |
examples/refraction-effect/refraction-effect-example.cpp
| @@ -65,6 +65,24 @@ struct LightOffsetConstraint | @@ -65,6 +65,24 @@ struct LightOffsetConstraint | ||
| 65 | float mRadius; | 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 | } // namespace | 86 | } // namespace |
| 69 | 87 | ||
| 70 | /************************************************************************************************ | 88 | /************************************************************************************************ |
| @@ -338,7 +356,7 @@ private: | @@ -338,7 +356,7 @@ private: | ||
| 338 | mNoEffect = NoEffect::New(); // used in the other situations, basic render shader | 356 | mNoEffect = NoEffect::New(); // used in the other situations, basic render shader |
| 339 | // Create the mesh from the obj file and add to stage | 357 | // Create the mesh from the obj file and add to stage |
| 340 | mMaterial = Material::New( "Material" ) ; | 358 | mMaterial = Material::New( "Material" ) ; |
| 341 | - mMaterial.SetDiffuseTexture(ResourceImage::New(TEXTURE_IMAGES[mCurrentTextureId])); | 359 | + mMaterial.SetDiffuseTexture( LoadStageFillingImage( TEXTURE_IMAGES[mCurrentTextureId] ) ); |
| 342 | CreateSurface( MESH_FILES[mCurrentMeshId] ); | 360 | CreateSurface( MESH_FILES[mCurrentMeshId] ); |
| 343 | 361 | ||
| 344 | // Connect the callback to the touch signal on the mesh actor | 362 | // Connect the callback to the touch signal on the mesh actor |
| @@ -371,7 +389,7 @@ private: | @@ -371,7 +389,7 @@ private: | ||
| 371 | bool OnChangeTexture( Toolkit::Button button ) | 389 | bool OnChangeTexture( Toolkit::Button button ) |
| 372 | { | 390 | { |
| 373 | mCurrentTextureId = ( mCurrentTextureId + 1 ) % NUM_TEXTURE_IMAGES; | 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 | return true; | 394 | return true; |
| 377 | } | 395 | } |
examples/scroll-view/scroll-view-example.cpp
| @@ -315,7 +315,7 @@ private: | @@ -315,7 +315,7 @@ private: | ||
| 315 | { | 315 | { |
| 316 | for(int column = 0;column<imageColumns;column++) | 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 | image.SetParentOrigin( ParentOrigin::CENTER ); | 320 | image.SetParentOrigin( ParentOrigin::CENTER ); |
| 321 | image.SetAnchorPoint( AnchorPoint::CENTER ); | 321 | image.SetAnchorPoint( AnchorPoint::CENTER ); |
| @@ -562,7 +562,8 @@ private: | @@ -562,7 +562,8 @@ private: | ||
| 562 | ImageAttributes attributes; | 562 | ImageAttributes attributes; |
| 563 | 563 | ||
| 564 | attributes.SetSize(width, height); | 564 | attributes.SetSize(width, height); |
| 565 | - attributes.SetScalingMode(ImageAttributes::ShrinkToFit); | 565 | + attributes.SetScalingMode(ImageAttributes::ScaleToFill); |
| 566 | + attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); | ||
| 566 | Image img = ResourceImage::New(filename, attributes); | 567 | Image img = ResourceImage::New(filename, attributes); |
| 567 | ImageActor actor = ImageActor::New(img); | 568 | ImageActor actor = ImageActor::New(img); |
| 568 | actor.SetName( filename ); | 569 | actor.SetName( filename ); |
examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp
| @@ -189,7 +189,7 @@ public: | @@ -189,7 +189,7 @@ public: | ||
| 189 | mView.SetPosition(Vector3(0.0f, 0.0f, -50)); | 189 | mView.SetPosition(Vector3(0.0f, 0.0f, -50)); |
| 190 | 190 | ||
| 191 | mContents.SetPosition(mTranslation); | 191 | mContents.SetPosition(mTranslation); |
| 192 | - mContents.SetRotation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); | 192 | + mContents.SetOrientation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); |
| 193 | mContents.SetScale(mPinchScale, mPinchScale, mPinchScale); | 193 | mContents.SetScale(mPinchScale, mPinchScale, mPinchScale); |
| 194 | 194 | ||
| 195 | mPanGestureDetector = PanGestureDetector::New(); | 195 | mPanGestureDetector = PanGestureDetector::New(); |
| @@ -232,7 +232,7 @@ public: | @@ -232,7 +232,7 @@ public: | ||
| 232 | mLightAnchor = Actor::New(); | 232 | mLightAnchor = Actor::New(); |
| 233 | mLightAnchor.SetParentOrigin(ParentOrigin::CENTER); | 233 | mLightAnchor.SetParentOrigin(ParentOrigin::CENTER); |
| 234 | mLightAnchor.SetAnchorPoint(AnchorPoint::CENTER); | 234 | mLightAnchor.SetAnchorPoint(AnchorPoint::CENTER); |
| 235 | - mLightAnchor.SetRotation(CalculateWorldRotation(Radian(mLightLongitudinal), Radian(mLightAxisTilt))); | 235 | + mLightAnchor.SetOrientation(CalculateWorldRotation(Radian(mLightLongitudinal), Radian(mLightAxisTilt))); |
| 236 | 236 | ||
| 237 | // Work out a scaling factor as the initial light position was calculated for desktop | 237 | // Work out a scaling factor as the initial light position was calculated for desktop |
| 238 | // Need to scale light position as scene actor size is based on stage size (i.e. much bigger on device) | 238 | // Need to scale light position as scene actor size is based on stage size (i.e. much bigger on device) |
| @@ -286,9 +286,9 @@ public: | @@ -286,9 +286,9 @@ public: | ||
| 286 | 286 | ||
| 287 | Property::Index angleIndex = mImageActor2.RegisterProperty("angle", Property::Value(30.0f)); | 287 | Property::Index angleIndex = mImageActor2.RegisterProperty("angle", Property::Value(30.0f)); |
| 288 | Source angleSrc( mImageActor2, angleIndex ); | 288 | Source angleSrc( mImageActor2, angleIndex ); |
| 289 | - mImageActor1.ApplyConstraint(Constraint::New<Quaternion>( Actor::Property::ROTATION, angleSrc, | 289 | + mImageActor1.ApplyConstraint(Constraint::New<Quaternion>( Actor::Property::ORIENTATION, angleSrc, |
| 290 | RotationConstraint(-1.0f))); | 290 | RotationConstraint(-1.0f))); |
| 291 | - mImageActor3.ApplyConstraint(Constraint::New<Quaternion>( Actor::Property::ROTATION, angleSrc, | 291 | + mImageActor3.ApplyConstraint(Constraint::New<Quaternion>( Actor::Property::ORIENTATION, angleSrc, |
| 292 | RotationConstraint(+1.0f))); | 292 | RotationConstraint(+1.0f))); |
| 293 | 293 | ||
| 294 | mSceneAnimation = Animation::New(2.5f); | 294 | mSceneAnimation = Animation::New(2.5f); |
| @@ -343,7 +343,7 @@ public: | @@ -343,7 +343,7 @@ public: | ||
| 343 | mLightLongitudinal += gesture.displacement.x/4.0f; | 343 | mLightLongitudinal += gesture.displacement.x/4.0f; |
| 344 | mLightAxisTilt -= gesture.displacement.y/6.0f; | 344 | mLightAxisTilt -= gesture.displacement.y/6.0f; |
| 345 | mLightAxisTilt = Clamp<float>(mLightAxisTilt, -90.0f, 90.0f); | 345 | mLightAxisTilt = Clamp<float>(mLightAxisTilt, -90.0f, 90.0f); |
| 346 | - mLightAnchor.SetRotation(CalculateWorldRotation(Radian(mLightLongitudinal), Radian(mLightAxisTilt))); | 346 | + mLightAnchor.SetOrientation(CalculateWorldRotation(Radian(mLightLongitudinal), Radian(mLightAxisTilt))); |
| 347 | break; | 347 | break; |
| 348 | } | 348 | } |
| 349 | 349 | ||
| @@ -359,7 +359,7 @@ public: | @@ -359,7 +359,7 @@ public: | ||
| 359 | mLongitudinal += gesture.displacement.x/4.0f; | 359 | mLongitudinal += gesture.displacement.x/4.0f; |
| 360 | mAxisTilt -= gesture.displacement.y/6.0f; | 360 | mAxisTilt -= gesture.displacement.y/6.0f; |
| 361 | mAxisTilt = Clamp<float>(mAxisTilt, -90.0f, 90.0f); | 361 | mAxisTilt = Clamp<float>(mAxisTilt, -90.0f, 90.0f); |
| 362 | - mContents.SetRotation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); | 362 | + mContents.SetOrientation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); |
| 363 | break; | 363 | break; |
| 364 | } | 364 | } |
| 365 | 365 | ||
| @@ -368,7 +368,7 @@ public: | @@ -368,7 +368,7 @@ public: | ||
| 368 | mObjectLongitudinal += gesture.displacement.x/4.0f; | 368 | mObjectLongitudinal += gesture.displacement.x/4.0f; |
| 369 | mObjectAxisTilt -= gesture.displacement.y/6.0f; | 369 | mObjectAxisTilt -= gesture.displacement.y/6.0f; |
| 370 | mObjectAxisTilt = Clamp<float>(mObjectAxisTilt, -90.0f, 90.0f); | 370 | mObjectAxisTilt = Clamp<float>(mObjectAxisTilt, -90.0f, 90.0f); |
| 371 | - mSceneActor.SetRotation(CalculateWorldRotation(Radian(mObjectLongitudinal), Radian(mObjectAxisTilt))); | 371 | + mSceneActor.SetOrientation(CalculateWorldRotation(Radian(mObjectLongitudinal), Radian(mObjectAxisTilt))); |
| 372 | break; | 372 | break; |
| 373 | } | 373 | } |
| 374 | } | 374 | } |
| @@ -460,7 +460,7 @@ public: | @@ -460,7 +460,7 @@ public: | ||
| 460 | // Align scene so that light anchor orientation is Z Axis | 460 | // Align scene so that light anchor orientation is Z Axis |
| 461 | mAxisTilt = -mLightAxisTilt; | 461 | mAxisTilt = -mLightAxisTilt; |
| 462 | mLongitudinal = -mLightLongitudinal; | 462 | mLongitudinal = -mLightLongitudinal; |
| 463 | - mContents.SetRotation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); | 463 | + mContents.SetOrientation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); |
| 464 | 464 | ||
| 465 | return true; | 465 | return true; |
| 466 | } | 466 | } |
examples/text-view/text-view-example.cpp
| @@ -150,7 +150,7 @@ public: | @@ -150,7 +150,7 @@ public: | ||
| 150 | 150 | ||
| 151 | Toolkit::TextView textView = Toolkit::TextView::New( tableString.text ); | 151 | Toolkit::TextView textView = Toolkit::TextView::New( tableString.text ); |
| 152 | textView.SetStyleToCurrentText( textStyle ); | 152 | textView.SetStyleToCurrentText( textStyle ); |
| 153 | - textView.SetRotation( Dali::Degree( tableString.orientation ), Vector3( 0.0f, 0.0f, 1.0f ) ); | 153 | + textView.SetOrientation( Dali::Degree( tableString.orientation ), Vector3( 0.0f, 0.0f, 1.0f ) ); |
| 154 | 154 | ||
| 155 | Toolkit::Alignment alignmentContainer = Toolkit::Alignment::New( tableString.horizontalAlignment, tableString.verticalAlignment ); | 155 | Toolkit::Alignment alignmentContainer = Toolkit::Alignment::New( tableString.horizontalAlignment, tableString.verticalAlignment ); |
| 156 | alignmentContainer.SetPadding( Toolkit::Alignment::Padding( tableString.padding, tableString.padding, tableString.padding, tableString.padding ) ); | 156 | alignmentContainer.SetPadding( Toolkit::Alignment::Padding( tableString.padding, tableString.padding, tableString.padding, tableString.padding ) ); |
| @@ -189,7 +189,7 @@ void RunTest( Application& application ) | @@ -189,7 +189,7 @@ void RunTest( Application& application ) | ||
| 189 | application.MainLoop(); | 189 | application.MainLoop(); |
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | -// Entry point for Linux & SLP applications | 192 | +// Entry point for Linux & Tizen applications |
| 193 | // | 193 | // |
| 194 | int main( int argc, char **argv ) | 194 | int main( int argc, char **argv ) |
| 195 | { | 195 | { |
packaging/com.samsung.dali-demo.spec
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | Name: com.samsung.dali-demo | 3 | Name: com.samsung.dali-demo |
| 4 | Summary: The OpenGLES Canvas Core Demo | 4 | Summary: The OpenGLES Canvas Core Demo |
| 5 | -Version: 1.0.33 | 5 | +Version: 1.0.34 |
| 6 | Release: 1 | 6 | Release: 1 |
| 7 | Group: System/Libraries | 7 | Group: System/Libraries |
| 8 | License: Apache-2.0 | 8 | License: Apache-2.0 |
resources/scripts/animation.json
| @@ -59,7 +59,7 @@ | @@ -59,7 +59,7 @@ | ||
| 59 | "duration": 10.0, | 59 | "duration": 10.0, |
| 60 | "properties": [{ | 60 | "properties": [{ |
| 61 | "actor": "image", // referenced actors must exist on stage | 61 | "actor": "image", // referenced actors must exist on stage |
| 62 | - "property": "rotation", | 62 | + "property": "orientation", |
| 63 | "value": [0, 0, -45], | 63 | "value": [0, 0, -45], |
| 64 | "alpha-function": "EASE_IN_OUT", | 64 | "alpha-function": "EASE_IN_OUT", |
| 65 | "time-period": { | 65 | "time-period": { |
| @@ -90,7 +90,7 @@ | @@ -90,7 +90,7 @@ | ||
| 90 | "styles": ["basic-text"], | 90 | "styles": ["basic-text"], |
| 91 | "position": [0, -120, 0], | 91 | "position": [0, -120, 0], |
| 92 | "size": [200, 200, 1], | 92 | "size": [200, 200, 1], |
| 93 | - "rotation": [0, 0, 30], | 93 | + "orientation": [0, 0, 30], |
| 94 | "signals": [{ | 94 | "signals": [{ |
| 95 | "name": "touched", | 95 | "name": "touched", |
| 96 | "action": "play", | 96 | "action": "play", |
| @@ -102,7 +102,7 @@ | @@ -102,7 +102,7 @@ | ||
| 102 | "parent-origin": "CENTER", | 102 | "parent-origin": "CENTER", |
| 103 | "anchor-point": "CENTER", | 103 | "anchor-point": "CENTER", |
| 104 | "size": [200, 200, 1], | 104 | "size": [200, 200, 1], |
| 105 | - "rotation": [0, 0, 39], | 105 | + "orientation": [0, 0, 39], |
| 106 | "position": [-150, -50, 0], | 106 | "position": [-150, -50, 0], |
| 107 | "text": "or me", | 107 | "text": "or me", |
| 108 | "signals": [{ | 108 | "signals": [{ |
shared/view.h
| @@ -142,10 +142,14 @@ Dali::Layer CreateView( Dali::Application& application, | @@ -142,10 +142,14 @@ Dali::Layer CreateView( Dali::Application& application, | ||
| 142 | // Add the view to the stage before setting the background. | 142 | // Add the view to the stage before setting the background. |
| 143 | stage.Add( view ); | 143 | stage.Add( view ); |
| 144 | 144 | ||
| 145 | - // Set background image. | ||
| 146 | - if ( ! backgroundImagePath.empty() ) | 145 | + // Set background image, loading it at screen resolution: |
| 146 | + if ( !backgroundImagePath.empty() ) | ||
| 147 | { | 147 | { |
| 148 | - Dali::Image backgroundImage = Dali::ResourceImage::New( backgroundImagePath ); | 148 | + Dali::ImageAttributes backgroundAttributes; |
| 149 | + backgroundAttributes.SetSize( stage.GetSize() ); | ||
| 150 | + backgroundAttributes.SetFilterMode( Dali::ImageAttributes::BoxThenLinear ); | ||
| 151 | + backgroundAttributes.SetScalingMode( Dali::ImageAttributes::ScaleToFill ); | ||
| 152 | + Dali::Image backgroundImage = Dali::ResourceImage::New( backgroundImagePath, backgroundAttributes ); | ||
| 149 | Dali::ImageActor backgroundImageActor = Dali::ImageActor::New( backgroundImage ); | 153 | Dali::ImageActor backgroundImageActor = Dali::ImageActor::New( backgroundImage ); |
| 150 | view.SetBackground( backgroundImageActor ); | 154 | view.SetBackground( backgroundImageActor ); |
| 151 | } | 155 | } |