diff --git a/examples/atlas/atlas-example.cpp b/examples/atlas/atlas-example.cpp index 70a9aa9..c126da9 100644 --- a/examples/atlas/atlas-example.cpp +++ b/examples/atlas/atlas-example.cpp @@ -165,7 +165,7 @@ public: { if( gesture.state == Gesture::Continuing ) { - actor.MoveBy( Vector3( gesture.displacement ) ); + actor.TranslateBy( Vector3( gesture.displacement ) ); } } @@ -220,7 +220,7 @@ void RunTest( Application& application ) application.MainLoop(Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS); } -// Entry point for Linux & SLP applications +// Entry point for Linux & Tizen applications // int main( int argc, char **argv ) { diff --git a/examples/blocks/blocks-example.cpp b/examples/blocks/blocks-example.cpp index 4f723c4..cf1ceae 100644 --- a/examples/blocks/blocks-example.cpp +++ b/examples/blocks/blocks-example.cpp @@ -346,7 +346,7 @@ private: mPaddleImage.SetSize( mPaddleFullSize ); mWobbleProperty = mPaddle.RegisterProperty(WOBBLE_PROPERTY_NAME, 0.0f); - Constraint wobbleConstraint = Constraint::New( Actor::Property::ROTATION, + Constraint wobbleConstraint = Constraint::New( Actor::Property::ORIENTATION, LocalSource(mWobbleProperty), WobbleConstraint(10.0f)); mPaddle.ApplyConstraint(wobbleConstraint); diff --git a/examples/bubble-effect/bubble-effect-example.cpp b/examples/bubble-effect/bubble-effect-example.cpp index f48959a..f86daa4 100644 --- a/examples/bubble-effect/bubble-effect-example.cpp +++ b/examples/bubble-effect/bubble-effect-example.cpp @@ -49,6 +49,25 @@ const unsigned int NUM_BUBBLE_SHAPE_IMAGES( sizeof( BUBBLE_SHAPE_IMAGES ) / size const Vector2 DEFAULT_BUBBLE_SIZE( 10.f, 30.f ); const unsigned int DEFAULT_NUMBER_OF_BUBBLES( 1000 ); + +/** + * @brief Load an image, scaled-down to no more than the stage dimensions. + * + * Uses image scaling mode ImageAttributes::ScaleToFill to resize the image at + * load time to cover the entire stage with pixels with no borders, + * and filter mode ImageAttributes::BoxThenLinear to sample the image with + * maximum quality. + */ +ResourceImage LoadStageFillingImage( const char * const imagePath ) +{ + Size stageSize = Stage::GetCurrent().GetSize(); + ImageAttributes attributes; + attributes.SetSize( stageSize.x, stageSize.y ); + attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); + attributes.SetScalingMode( ImageAttributes::ScaleToFill ); + return ResourceImage::New( imagePath, attributes ); +} + }// end LOCAL_STUFF // This example shows the usage of BubbleEmitter which displays lots of moving bubbles on the stage. @@ -114,7 +133,7 @@ private: ResourceImage::New( BUBBLE_SHAPE_IMAGES[mCurrentBubbleShapeImageId] ), DEFAULT_NUMBER_OF_BUBBLES, DEFAULT_BUBBLE_SIZE); - mBackgroundImage = ResourceImage::New( BACKGROUND_IMAGES[mCurrentBackgroundImageId] ); + mBackgroundImage = LoadStageFillingImage( BACKGROUND_IMAGES[mCurrentBackgroundImageId] ); mBubbleEmitter.SetBackground( mBackgroundImage, mHSVDelta ); // Get the root actor of all bubbles, and add it to stage. @@ -235,7 +254,7 @@ private: { if(button == mChangeBackgroundButton) { - mBackgroundImage = ResourceImage::New( BACKGROUND_IMAGES[ ++mCurrentBackgroundImageId % NUM_BACKGROUND_IMAGES ] ); + mBackgroundImage = LoadStageFillingImage( BACKGROUND_IMAGES[ ++mCurrentBackgroundImageId % NUM_BACKGROUND_IMAGES ] ); mBubbleEmitter.SetBackground( mBackgroundImage, mHSVDelta ); diff --git a/examples/buttons/buttons-example.cpp b/examples/buttons/buttons-example.cpp index a658fa1..8e1c041 100644 --- a/examples/buttons/buttons-example.cpp +++ b/examples/buttons/buttons-example.cpp @@ -443,7 +443,7 @@ void RunTest( Application& application ) application.MainLoop(); } -// Entry point for Linux & SLP applications +// Entry point for Linux & Tizen applications // int main( int argc, char **argv ) { diff --git a/examples/cluster/cluster-example.cpp b/examples/cluster/cluster-example.cpp index 1279ddb..9b97b03 100644 --- a/examples/cluster/cluster-example.cpp +++ b/examples/cluster/cluster-example.cpp @@ -524,7 +524,13 @@ public: const char **paths = IMAGE_GROUPS[clusterType]; DALI_ASSERT_ALWAYS(paths); - // Add a background image to the cluster + // Add a background image to the cluster, limiting the loaded size by + // fitting it inside a quarter of the stage area with the conservative Box + // filter mode: + Dali::ImageAttributes backgroundAttributes; + backgroundAttributes.SetSize( Stage::GetCurrent().GetSize() * 0.5f ); + backgroundAttributes.SetFilterMode( Dali::ImageAttributes::Box ); + backgroundAttributes.SetScalingMode( Dali::ImageAttributes::ShrinkToFit ); Image bg = ResourceImage::New( CLUSTER_BACKGROUND_IMAGE_PATH ); ImageActor image = ImageActor::New(bg); clusterActor.SetBackgroundImage(image); @@ -552,10 +558,12 @@ public: actor.SetParentOrigin( ParentOrigin::CENTER ); actor.SetAnchorPoint( AnchorPoint::CENTER ); - // Load the thumbnail + // Load the thumbnail at quarter of screen width or standard size if that is smaller: ImageAttributes attribs = ImageAttributes::New(); - attribs.SetSize(CLUSTER_IMAGE_THUMBNAIL_WIDTH, CLUSTER_IMAGE_THUMBNAIL_HEIGHT); - attribs.SetScalingMode(Dali::ImageAttributes::ShrinkToFit); + Size stageQuarter = Stage::GetCurrent().GetSize() * 0.25f; + attribs.SetSize( std::min( stageQuarter.x, CLUSTER_IMAGE_THUMBNAIL_WIDTH), std::min( stageQuarter.y, CLUSTER_IMAGE_THUMBNAIL_HEIGHT ) ); + attribs.SetFilterMode( Dali::ImageAttributes::BoxThenLinear ); + attribs.SetScalingMode(Dali::ImageAttributes::ShrinkToFit ); // Add a shadow image child actor Image shadowImage = ResourceImage::New( CLUSTER_SHADOW_IMAGE_PATH, attribs ); @@ -720,12 +728,12 @@ public: constraint = Constraint::New( angleXAxisProperty, Source(mScrollView, scrollOvershootProperty), - Source(mView, Actor::Property::ROTATION), + Source(mView, Actor::Property::ORIENTATION), ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::XAXIS) ); shaderEffect.ApplyConstraint(constraint); constraint = Constraint::New( angleYAxisProperty, Source(mScrollView, scrollOvershootProperty), - Source(mView, Actor::Property::ROTATION), + Source(mView, Actor::Property::ORIENTATION), ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::YAXIS) ); shaderEffect.ApplyConstraint(constraint); @@ -752,7 +760,7 @@ public: Property::Index anglePerUnit = shaderEffect.GetPropertyIndex( shaderEffect.GetAnglePerUnitPropertyName() ); shaderEffect.ApplyConstraint( Constraint::New( anglePerUnit, - Source(mView, Actor::Property::ROTATION), + Source(mView, Actor::Property::ORIENTATION), CarouselEffectOrientationConstraint( angleSweep ) ) ); break; @@ -854,7 +862,7 @@ void RunTest(Application& app) app.MainLoop(); } -// Entry point for Linux & SLP applications +// Entry point for Linux & Tizen applications // int main(int argc, char **argv) { diff --git a/examples/cube-transition-effect/cube-transition-effect-example.cpp b/examples/cube-transition-effect/cube-transition-effect-example.cpp index 07900c7..9138a1a 100644 --- a/examples/cube-transition-effect/cube-transition-effect-example.cpp +++ b/examples/cube-transition-effect/cube-transition-effect-example.cpp @@ -85,6 +85,25 @@ const float CUBE_DISPLACEMENT_CROSS(30.f); // The duration of the current image staying on screen when slideshow is on const int VIEWINGTIME = 2000; // 2 seconds + +/** + * @brief Load an image, scaled-down to no more than the stage dimensions. + * + * Uses image scaling mode ImageAttributes::ScaleToFill to resize the image at + * load time to cover the entire stage with pixels with no borders, + * and filter mode ImageAttributes::BoxThenLinear to sample the image with + * maximum quality. + */ +ResourceImage LoadStageFillingImage( const char * const imagePath ) +{ + Size stageSize = Stage::GetCurrent().GetSize(); + ImageAttributes attributes; + attributes.SetSize( stageSize.x, stageSize.y ); + attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); + attributes.SetScalingMode( ImageAttributes::ScaleToFill ); + return ResourceImage::New( imagePath, attributes ); +} + } // namespace class CubeTransitionApp : public ConnectionTracker @@ -261,7 +280,7 @@ void CubeTransitionApp::OnInit( Application& application ) // show the first image mImageConstraint = Constraint::New( Actor::Property::SCALE, LocalSource( Actor::Property::SIZE ), ParentSource( Actor::Property::SIZE ), ScaleToFitKeepAspectRatioConstraint() ); - mCurrentImage = ImageActor::New( ResourceImage::New( IMAGES[mIndex] ) ); + mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) ); mCurrentImage.SetPositionInheritanceMode( USE_PARENT_POSITION ); mCurrentImage.ApplyConstraint( mImageConstraint ); mParent.Add( mCurrentImage ); @@ -298,8 +317,9 @@ void CubeTransitionApp::OnPanGesture( Actor actor, const PanGesture& gesture ) void CubeTransitionApp::GoToNextImage() { - ResourceImage image = ResourceImage::New( IMAGES[ mIndex ] ); + ResourceImage image = LoadStageFillingImage( IMAGES[ mIndex ] ); mNextImage = ImageActor::New( image ); + mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION); mNextImage.ApplyConstraint( mImageConstraint ); mCurrentEffect.SetTargetImage(mNextImage); @@ -400,7 +420,7 @@ void CubeTransitionApp::OnKeyEvent(const KeyEvent& event) } } -// Entry point for Linux & SLP applications +// Entry point for Linux & Tizen applications int main( int argc, char **argv ) { Application application = Application::New( &argc, &argv ); diff --git a/examples/dissolve-effect/dissolve-effect-example.cpp b/examples/dissolve-effect/dissolve-effect-example.cpp index 47c0d6f..3bd1dc7 100644 --- a/examples/dissolve-effect/dissolve-effect-example.cpp +++ b/examples/dissolve-effect/dissolve-effect-example.cpp @@ -71,6 +71,25 @@ const int VIEWINGTIME = 2000; // 2 seconds const float TRANSITION_DURATION = 2.5f; //2.5 second const float INITIAL_DEPTH = -10.0f; + +/** + * @brief Load an image, scaled-down to no more than the stage dimensions. + * + * Uses image scaling mode ImageAttributes::ScaleToFill to resize the image at + * load time to cover the entire stage with pixels with no borders, + * and filter mode ImageAttributes::BoxThenLinear to sample the image with + * maximum quality. + */ +ResourceImage LoadStageFillingImage( const char * const imagePath ) +{ + Size stageSize = Stage::GetCurrent().GetSize(); + ImageAttributes attributes; + attributes.SetSize( stageSize.x, stageSize.y ); + attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); + attributes.SetScalingMode( ImageAttributes::ScaleToFill ); + return ResourceImage::New( imagePath, attributes ); +} + } // namespace class DissolveEffectApp : public ConnectionTracker @@ -231,7 +250,7 @@ void DissolveEffectApp::OnInit( Application& application ) mSizeConstraint= Constraint::New( Actor::Property::SCALE, LocalSource( Actor::Property::SIZE ), ParentSource( Actor::Property::SIZE ), ScaleToFitKeepAspectRatioConstraint() ); // show the first image - mCurrentImage = ImageActor::New( ResourceImage::New( IMAGES[mIndex] ) ); + mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) ); mCurrentImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); mCurrentImage.ApplyConstraint( mSizeConstraint ); mParent.Add( mCurrentImage ); @@ -259,7 +278,7 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture& gesture ) mIndex = (mIndex + NUM_IMAGES -1)%NUM_IMAGES; } - Image image = ResourceImage::New( IMAGES[ mIndex ] ); + Image image = LoadStageFillingImage( IMAGES[ mIndex ] ); mNextImage = ImageActor::New( image ); mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); mNextImage.ApplyConstraint( mSizeConstraint ); @@ -368,7 +387,7 @@ bool DissolveEffectApp::OnTimerTick() if(mSlideshow) { mIndex = (mIndex + 1)%NUM_IMAGES; - Image image = ResourceImage::New( IMAGES[ mIndex ] ); + Image image = LoadStageFillingImage( IMAGES[ mIndex ] ); mNextImage = ImageActor::New( image ); mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); mNextImage.ApplyConstraint( mSizeConstraint ); @@ -403,7 +422,7 @@ bool DissolveEffectApp::OnTimerTick() return false; //return false to stop the timer } -// Entry point for Linux & SLP applications +// Entry point for Linux & Tizen applications int main( int argc, char **argv ) { Application application = Application::New( &argc, &argv ); diff --git a/examples/hello-world/hello-world-example.cpp b/examples/hello-world/hello-world-example.cpp index c2f263c..8974293 100644 --- a/examples/hello-world/hello-world-example.cpp +++ b/examples/hello-world/hello-world-example.cpp @@ -64,7 +64,7 @@ void RunTest( Application& application ) application.MainLoop(); } -// Entry point for Linux & SLP applications +// Entry point for Linux & Tizen applications // int main( int argc, char **argv ) { diff --git a/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp b/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp index 1d82b00..f16e9cc 100644 --- a/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp +++ b/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 attributes.SetSize( width, height ); attributes.SetScalingMode( scalingMode ); + attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); Image image = ResourceImage::New( filename, attributes ); return image; } @@ -359,6 +360,9 @@ public: mContentLayer.Add( mScrollView ); mScrollView.Add( imageField ); mGridActor = imageField; + + // Scroll to top of grid so first images loaded are on-screen: + mScrollView.ScrollTo( Vector3( 0, -1000000, 0 ) ); } /** diff --git a/examples/logging/logging-example.cpp b/examples/logging/logging-example.cpp index 88b14e0..160d0c6 100644 --- a/examples/logging/logging-example.cpp +++ b/examples/logging/logging-example.cpp @@ -726,7 +726,7 @@ void RunTest( Application& application ) application.MainLoop(); } -// Entry point for Linux & SLP applications +// Entry point for Linux & Tizen applications // int main( int argc, char **argv ) { diff --git a/examples/magnifier/magnifier-example.cpp b/examples/magnifier/magnifier-example.cpp index cb38a87..ebaa264 100644 --- a/examples/magnifier/magnifier-example.cpp +++ b/examples/magnifier/magnifier-example.cpp @@ -422,7 +422,7 @@ void RunTest( Application& application ) application.MainLoop(); } -// Entry point for Linux & SLP applications +// Entry point for Linux & Tizen applications // int main( int argc, char **argv ) { diff --git a/examples/motion-blur/motion-blur-example.cpp b/examples/motion-blur/motion-blur-example.cpp index d7241c6..10086a2 100644 --- a/examples/motion-blur/motion-blur-example.cpp +++ b/examples/motion-blur/motion-blur-example.cpp @@ -88,9 +88,25 @@ const Vector3 BUTTON_TITLE_LABEL_INSTRUCTIONS_POPUP_SIZE_CONSTRAINT( 1.0f, 1.0f, const float BUTTON_TITLE_LABEL_Y_OFFSET = 0.05f; const float ORIENTATION_DURATION = 0.5f; ///< Time to rotate to new orientation. -} // unnamed namespace +/** + * @brief Load an image, scaled-down to no more than the dimensions passed in. + * + * Uses ImageAttributes::ShrinkToFit which ensures the resulting image is + * smaller than or equal to the specified dimensions while preserving its + * original aspect ratio. + */ +ResourceImage LoadImageFittedInBox( const char * const imagePath, uint32_t maxWidth, uint32_t maxHeight ) +{ + // Load the image nicely scaled-down to fit within the specified max width and height: + ImageAttributes attributes; + attributes.SetSize( maxWidth, maxHeight); + attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); + attributes.SetScalingMode( ImageAttributes::ShrinkToFit ); + return ResourceImage::New( imagePath, attributes ); +} +} // unnamed namespace // @@ -187,10 +203,15 @@ public: // Motion blurred actor // - Image image = ResourceImage::New( MOTION_BLUR_ACTOR_IMAGE1 ); + // Scale down actor to fit on very low resolution screens with space to interact: + Size stageSize = Stage::GetCurrent().GetSize(); + mMotionBlurActorSize = Size( std::min( stageSize.x * 0.3f, MOTION_BLUR_ACTOR_WIDTH ), std::min( stageSize.y * 0.3f, MOTION_BLUR_ACTOR_HEIGHT ) ); + mMotionBlurActorSize = Size( std::min( mMotionBlurActorSize.x, mMotionBlurActorSize.y ), std::min( mMotionBlurActorSize.x, mMotionBlurActorSize.y ) ); + + Image image = LoadImageFittedInBox( MOTION_BLUR_ACTOR_IMAGE1, mMotionBlurActorSize.x, mMotionBlurActorSize.y ); mMotionBlurImageActor = ImageActor::New(image); mMotionBlurImageActor.SetParentOrigin( ParentOrigin::CENTER ); - mMotionBlurImageActor.SetSize(MOTION_BLUR_ACTOR_WIDTH, MOTION_BLUR_ACTOR_HEIGHT); + mMotionBlurImageActor.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y); mContentLayer.Add( mMotionBlurImageActor ); @@ -207,8 +228,8 @@ public: mMotionBlurImageActor2 = ImageActor::New(image); mMotionBlurImageActor2.SetParentOrigin( ParentOrigin::CENTER ); - mMotionBlurImageActor2.SetSize(MOTION_BLUR_ACTOR_WIDTH, MOTION_BLUR_ACTOR_HEIGHT); - mMotionBlurImageActor2.SetPosition(MOTION_BLUR_ACTOR_WIDTH * 1.1f, 0.0f); + mMotionBlurImageActor2.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y); + mMotionBlurImageActor2.SetPosition(mMotionBlurActorSize.x * 1.1f, 0.0f); mMotionBlurImageActor.Add( mMotionBlurImageActor2 ); // Create shader used for doing motion blur @@ -225,8 +246,8 @@ public: mMotionBlurImageActor3 = ImageActor::New(image); mMotionBlurImageActor3.SetParentOrigin( ParentOrigin::CENTER ); - mMotionBlurImageActor3.SetSize(MOTION_BLUR_ACTOR_WIDTH, MOTION_BLUR_ACTOR_HEIGHT); - mMotionBlurImageActor3.SetPosition(-MOTION_BLUR_ACTOR_WIDTH * 1.1f, 0.0f); + mMotionBlurImageActor3.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y); + mMotionBlurImageActor3.SetPosition(-mMotionBlurActorSize.x * 1.1f, 0.0f); mMotionBlurImageActor.Add( mMotionBlurImageActor3 ); // Create shader used for doing motion blur @@ -243,8 +264,8 @@ public: mMotionBlurImageActor4 = ImageActor::New(image); mMotionBlurImageActor4.SetParentOrigin( ParentOrigin::CENTER ); - mMotionBlurImageActor4.SetSize(MOTION_BLUR_ACTOR_WIDTH, MOTION_BLUR_ACTOR_HEIGHT); - mMotionBlurImageActor4.SetPosition(0.0f, MOTION_BLUR_ACTOR_HEIGHT * 1.1f); + mMotionBlurImageActor4.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y); + mMotionBlurImageActor4.SetPosition(0.0f, mMotionBlurActorSize.y * 1.1f); mMotionBlurImageActor.Add( mMotionBlurImageActor4 ); // Create shader used for doing motion blur @@ -261,8 +282,8 @@ public: mMotionBlurImageActor5 = ImageActor::New(image); mMotionBlurImageActor5.SetParentOrigin( ParentOrigin::CENTER ); - mMotionBlurImageActor5.SetSize(MOTION_BLUR_ACTOR_WIDTH, MOTION_BLUR_ACTOR_HEIGHT); - mMotionBlurImageActor5.SetPosition(0.0f, -MOTION_BLUR_ACTOR_HEIGHT * 1.1f); + mMotionBlurImageActor5.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y); + mMotionBlurImageActor5.SetPosition(0.0f, -mMotionBlurActorSize.y * 1.1f); mMotionBlurImageActor.Add( mMotionBlurImageActor5 ); // Create shader used for doing motion blur @@ -312,7 +333,7 @@ public: else { // set the rotation to match the orientation - mView.SetRotation( Degree( -orientation ), Vector3::ZAXIS ); + mView.SetOrientation( Degree( -orientation ), Vector3::ZAXIS ); mView.SetSize( targetSize ); } } @@ -478,7 +499,7 @@ public: mCurrentImage = 0; } - Image blurImage = ResourceImage::New( MOTION_BLUR_ACTOR_IMAGES[mCurrentImage] ); + Image blurImage = LoadImageFittedInBox( MOTION_BLUR_ACTOR_IMAGES[mCurrentImage], mMotionBlurActorSize.x, mMotionBlurActorSize.y ); mMotionBlurImageActor.SetImage(blurImage); } @@ -497,6 +518,7 @@ private: // Motion blur MotionBlurEffect mMotionBlurEffect; ImageActor mMotionBlurImageActor; + Size mMotionBlurActorSize; #ifdef MULTIPLE_MOTION_BLURRED_ACTORS MotionBlurEffect mMotionBlurEffect2; @@ -536,7 +558,7 @@ void RunTest(Application& app) app.MainLoop(); } -// Entry point for Linux & SLP applications +// Entry point for Linux & Tizen applications // int main(int argc, char **argv) { diff --git a/examples/motion-stretch/motion-stretch-example.cpp b/examples/motion-stretch/motion-stretch-example.cpp index 7d746bd..4bcf08f 100644 --- a/examples/motion-stretch/motion-stretch-example.cpp +++ b/examples/motion-stretch/motion-stretch-example.cpp @@ -225,7 +225,7 @@ public: else { // set the rotation to match the orientation - mView.SetRotation( Degree( -orientation ), Vector3::ZAXIS ); + mView.SetOrientation( Degree( -orientation ), Vector3::ZAXIS ); mView.SetSize( targetSize ); } } @@ -434,7 +434,7 @@ void RunTest(Application& app) app.MainLoop(); } -// Entry point for Linux & SLP applications +// Entry point for Linux & Tizen applications // int main(int argc, char **argv) { diff --git a/examples/new-window/new-window-example.cpp b/examples/new-window/new-window-example.cpp index e6e35f0..172da82 100644 --- a/examples/new-window/new-window-example.cpp +++ b/examples/new-window/new-window-example.cpp @@ -259,7 +259,7 @@ FrameBufferImage NewWindowController::CreateFrameBufferForImage(const char* imag cameraActor.SetNearClippingPlane(1.0f); cameraActor.SetAspectRatio(FBOSize.width / FBOSize.height); cameraActor.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor - cameraActor.SetRotation(Quaternion(M_PI, Vector3::YAXIS)); + cameraActor.SetOrientation(Quaternion(M_PI, Vector3::YAXIS)); cameraActor.SetPosition(0.0f, 0.0f, ((FBOSize.height * 0.5f) / tanf(Math::PI * 0.125f))); stage.Add(cameraActor); @@ -442,7 +442,7 @@ void RunTest(Application& app) app.MainLoop(Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS); } -// Entry point for Linux & SLP applications +// Entry point for Linux & Tizen applications // int main(int argc, char **argv) diff --git a/examples/path-animation/path-animation.cpp b/examples/path-animation/path-animation.cpp index e6d772f..1712bad 100644 --- a/examples/path-animation/path-animation.cpp +++ b/examples/path-animation/path-animation.cpp @@ -222,7 +222,7 @@ public: { mAnimation.Pause(); mAnimation.Clear(); - mActor.SetRotation( Quaternion() ); + mActor.SetOrientation( Quaternion() ); } mAnimation.Animate( mActor, mPath, mForward ); diff --git a/examples/radial-menu/radial-sweep-view-impl.cpp b/examples/radial-menu/radial-sweep-view-impl.cpp index 7486a8a..02a44b6 100644 --- a/examples/radial-menu/radial-sweep-view-impl.cpp +++ b/examples/radial-menu/radial-sweep-view-impl.cpp @@ -270,7 +270,7 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura mStencilActor.SetSize(mDiameter, mDiameter); } - mStencilActor.SetRotation( Degree(mInitialAngle), Vector3::ZAXIS ); + mStencilActor.SetOrientation( Degree(mInitialAngle), Vector3::ZAXIS ); mStencilActor.SetProperty( mRotationAngleIndex, static_cast(mInitialSector) ); if( mRotateActors ) diff --git a/examples/refraction-effect/refraction-effect-example.cpp b/examples/refraction-effect/refraction-effect-example.cpp index 05859bd..7a3a290 100644 --- a/examples/refraction-effect/refraction-effect-example.cpp +++ b/examples/refraction-effect/refraction-effect-example.cpp @@ -65,6 +65,24 @@ struct LightOffsetConstraint float mRadius; }; +/** + * @brief Load an image, scaled-down to no more than the stage dimensions. + * + * Uses image scaling mode ImageAttributes::ScaleToFill to resize the image at + * load time to cover the entire stage with pixels with no borders, + * and filter mode ImageAttributes::BoxThenLinear to sample the image with + * maximum quality. + */ +ResourceImage LoadStageFillingImage( const char * const imagePath ) +{ + Size stageSize = Stage::GetCurrent().GetSize(); + ImageAttributes attributes; + attributes.SetSize( stageSize.x, stageSize.y ); + attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); + attributes.SetScalingMode( ImageAttributes::ScaleToFill ); + return ResourceImage::New( imagePath, attributes ); +} + } // namespace /************************************************************************************************ @@ -338,7 +356,7 @@ private: mNoEffect = NoEffect::New(); // used in the other situations, basic render shader // Create the mesh from the obj file and add to stage mMaterial = Material::New( "Material" ) ; - mMaterial.SetDiffuseTexture(ResourceImage::New(TEXTURE_IMAGES[mCurrentTextureId])); + mMaterial.SetDiffuseTexture( LoadStageFillingImage( TEXTURE_IMAGES[mCurrentTextureId] ) ); CreateSurface( MESH_FILES[mCurrentMeshId] ); // Connect the callback to the touch signal on the mesh actor @@ -371,7 +389,7 @@ private: bool OnChangeTexture( Toolkit::Button button ) { mCurrentTextureId = ( mCurrentTextureId + 1 ) % NUM_TEXTURE_IMAGES; - mMaterial.SetDiffuseTexture(ResourceImage::New(TEXTURE_IMAGES[mCurrentTextureId])); + mMaterial.SetDiffuseTexture( LoadStageFillingImage( TEXTURE_IMAGES[mCurrentTextureId] ) ); return true; } diff --git a/examples/scroll-view/scroll-view-example.cpp b/examples/scroll-view/scroll-view-example.cpp index b6c5736..94a6e50 100644 --- a/examples/scroll-view/scroll-view-example.cpp +++ b/examples/scroll-view/scroll-view-example.cpp @@ -315,7 +315,7 @@ private: { for(int column = 0;column( Actor::Property::ROTATION, angleSrc, + mImageActor1.ApplyConstraint(Constraint::New( Actor::Property::ORIENTATION, angleSrc, RotationConstraint(-1.0f))); - mImageActor3.ApplyConstraint(Constraint::New( Actor::Property::ROTATION, angleSrc, + mImageActor3.ApplyConstraint(Constraint::New( Actor::Property::ORIENTATION, angleSrc, RotationConstraint(+1.0f))); mSceneAnimation = Animation::New(2.5f); @@ -326,7 +326,7 @@ public: mLightLongitudinal += gesture.displacement.x/4.0f; mLightAxisTilt -= gesture.displacement.y/6.0f; mLightAxisTilt = Clamp(mLightAxisTilt, -90.0f, 90.0f); - mLightAnchor.SetRotation(CalculateWorldRotation(Radian(mLightLongitudinal), Radian(mLightAxisTilt))); + mLightAnchor.SetOrientation(CalculateWorldRotation(Radian(mLightLongitudinal), Radian(mLightAxisTilt))); break; } @@ -342,7 +342,7 @@ public: mLongitudinal += gesture.displacement.x/4.0f; mAxisTilt -= gesture.displacement.y/6.0f; mAxisTilt = Clamp(mAxisTilt, -90.0f, 90.0f); - mContents.SetRotation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); + mContents.SetOrientation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); break; } @@ -351,7 +351,7 @@ public: mObjectLongitudinal += gesture.displacement.x/4.0f; mObjectAxisTilt -= gesture.displacement.y/6.0f; mObjectAxisTilt = Clamp(mObjectAxisTilt, -90.0f, 90.0f); - mSceneActor.SetRotation(CalculateWorldRotation(Radian(mObjectLongitudinal), Radian(mObjectAxisTilt))); + mSceneActor.SetOrientation(CalculateWorldRotation(Radian(mObjectLongitudinal), Radian(mObjectAxisTilt))); break; } } @@ -415,7 +415,7 @@ public: // Align scene so that light anchor orientation is Z Axis mAxisTilt = -mLightAxisTilt; mLongitudinal = -mLightLongitudinal; - mContents.SetRotation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); + mContents.SetOrientation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); return true; } diff --git a/resources/scripts/animation.json b/resources/scripts/animation.json index 0bbe545..ad13fd1 100644 --- a/resources/scripts/animation.json +++ b/resources/scripts/animation.json @@ -59,7 +59,7 @@ "duration": 10.0, "properties": [{ "actor": "image", // referenced actors must exist on stage - "property": "rotation", + "property": "orientation", "value": [0, 0, -45], "alpha-function": "EASE_IN_OUT", "time-period": { @@ -90,7 +90,7 @@ "styles": ["basic-text"], "position": [0, -120, 0], "size": [200, 200, 1], - "rotation": [0, 0, 30], + "orientation": [0, 0, 30], "signals": [{ "name": "touched", "action": "play", @@ -102,7 +102,7 @@ "parent-origin": "CENTER", "anchor-point": "CENTER", "size": [200, 200, 1], - "rotation": [0, 0, 39], + "orientation": [0, 0, 39], "position": [-150, -50, 0], "text": "or me", "signals": [{ diff --git a/shared/view.h b/shared/view.h index 2c164b1..123fdef 100644 --- a/shared/view.h +++ b/shared/view.h @@ -110,10 +110,14 @@ Dali::Layer CreateView( Dali::Application& application, // Add the view to the stage before setting the background. stage.Add( view ); - // Set background image. - if ( ! backgroundImagePath.empty() ) + // Set background image, loading it at screen resolution: + if ( !backgroundImagePath.empty() ) { - Dali::Image backgroundImage = Dali::ResourceImage::New( backgroundImagePath ); + Dali::ImageAttributes backgroundAttributes; + backgroundAttributes.SetSize( stage.GetSize() ); + backgroundAttributes.SetFilterMode( Dali::ImageAttributes::BoxThenLinear ); + backgroundAttributes.SetScalingMode( Dali::ImageAttributes::ScaleToFill ); + Dali::Image backgroundImage = Dali::ResourceImage::New( backgroundImagePath, backgroundAttributes ); Dali::ImageActor backgroundImageActor = Dali::ImageActor::New( backgroundImage ); view.SetBackground( backgroundImageActor ); }