diff --git a/examples/atlas/atlas-example.cpp b/examples/atlas/atlas-example.cpp index cad730d..bdabc2e 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 ) ); } } @@ -221,7 +221,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 4279fee..37ede2b 100644 --- a/examples/buttons/buttons-example.cpp +++ b/examples/buttons/buttons-example.cpp @@ -484,7 +484,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 ecc7b06..50b6d4d 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; @@ -865,7 +873,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 ac2fb2a..7fa1545 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 @@ -266,7 +285,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 ); @@ -308,8 +327,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); @@ -417,7 +437,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 374ac96..ac4e699 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 @@ -235,7 +254,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 ); @@ -263,7 +282,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 ); @@ -375,7 +394,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 ); @@ -410,7 +429,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 d441dcc..3685333 100644 --- a/examples/hello-world/hello-world-example.cpp +++ b/examples/hello-world/hello-world-example.cpp @@ -79,7 +79,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 437194c..09bfe9e 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/item-view/item-view-example.cpp b/examples/item-view/item-view-example.cpp index a3cd43a..d86306e 100644 --- a/examples/item-view/item-view-example.cpp +++ b/examples/item-view/item-view-example.cpp @@ -99,6 +99,10 @@ const char* IMAGE_PATHS[] = { const unsigned int NUM_IMAGES = sizeof(IMAGE_PATHS) / sizeof(char*); +const unsigned int IMAGE_WIDTH = 256; +const unsigned int IMAGE_HEIGHT = 256; +const unsigned int NUM_IMAGE_PER_ROW_IN_ATLAS = 8; + AlphaFunction ALPHA_FUNCTIONS[] = { AlphaFunctions::Linear, AlphaFunctions::EaseIn, AlphaFunctions::EaseOut }; @@ -312,6 +316,7 @@ public: stage.Add( mReplaceButton ); // Create the item view actor + mImageAtlas = CreateImageAtlas(); mItemView = ItemView::New(*this); mItemView.SetParentOrigin(ParentOrigin::CENTER); mItemView.SetAnchorPoint(AnchorPoint::CENTER); @@ -876,8 +881,12 @@ public: // From ItemFactory virtual Actor NewItem(unsigned int itemId) { // Create an image actor for this item - Image image = ResourceImage::New( IMAGE_PATHS[itemId % NUM_IMAGES] ); - Actor actor = ImageActor::New(image); + unsigned int imageId = itemId % NUM_IMAGES; + ImageActor::PixelArea pixelArea( (imageId%NUM_IMAGE_PER_ROW_IN_ATLAS)*IMAGE_WIDTH, + (imageId/NUM_IMAGE_PER_ROW_IN_ATLAS)*IMAGE_HEIGHT, + IMAGE_WIDTH, + IMAGE_HEIGHT ); + Actor actor = ImageActor::New(mImageAtlas, pixelArea); actor.SetPosition( INITIAL_OFFSCREEN_POSITION ); // Add a border image child actor @@ -936,6 +945,23 @@ public: // From ItemFactory private: /** + * Create an Atlas to tile the images inside. + */ + Atlas CreateImageAtlas() + { + const unsigned int atlas_width = IMAGE_WIDTH*NUM_IMAGE_PER_ROW_IN_ATLAS; + const unsigned int atlas_height = IMAGE_HEIGHT*ceil( static_cast(NUM_IMAGES)/ static_cast(NUM_IMAGE_PER_ROW_IN_ATLAS)); + Atlas atlas = Atlas::New(atlas_width, atlas_height, Pixel::RGB888); + + for( unsigned int i = 0; i < NUM_IMAGES; i++ ) + { + atlas.Upload( IMAGE_PATHS[i], (i%NUM_IMAGE_PER_ROW_IN_ATLAS)*IMAGE_WIDTH, (i/NUM_IMAGE_PER_ROW_IN_ATLAS)*IMAGE_HEIGHT ); + } + + return atlas; + } + + /** * Sets/Updates the title of the View * @param[in] title The new title for the view. */ @@ -1107,6 +1133,7 @@ private: ItemView mItemView; Image mBorderImage; + Atlas mImageAtlas; unsigned int mCurrentLayout; float mDurationSeconds; diff --git a/examples/logging/logging-example.cpp b/examples/logging/logging-example.cpp index a02ea3c..94f7ac0 100644 --- a/examples/logging/logging-example.cpp +++ b/examples/logging/logging-example.cpp @@ -763,7 +763,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 d09c54e..02032c7 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); } @@ -498,6 +519,7 @@ private: // Motion blur MotionBlurEffect mMotionBlurEffect; ImageActor mMotionBlurImageActor; + Size mMotionBlurActorSize; #ifdef MULTIPLE_MOTION_BLURRED_ACTORS MotionBlurEffect mMotionBlurEffect2; @@ -537,7 +559,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 545c9f2..a7fc7d4 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 ); } } @@ -435,7 +435,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 5952308..3d4f72d 100644 --- a/examples/new-window/new-window-example.cpp +++ b/examples/new-window/new-window-example.cpp @@ -262,7 +262,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); @@ -449,7 +449,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 5dea82a..2611be4 100644 --- a/examples/path-animation/path-animation.cpp +++ b/examples/path-animation/path-animation.cpp @@ -247,7 +247,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 7993519..b69ea83 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); @@ -343,7 +343,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; } @@ -359,7 +359,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; } @@ -368,7 +368,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; } } @@ -460,7 +460,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/examples/text-view/text-view-example.cpp b/examples/text-view/text-view-example.cpp index b397d43..155a8c4 100644 --- a/examples/text-view/text-view-example.cpp +++ b/examples/text-view/text-view-example.cpp @@ -150,7 +150,7 @@ public: Toolkit::TextView textView = Toolkit::TextView::New( tableString.text ); textView.SetStyleToCurrentText( textStyle ); - textView.SetRotation( Dali::Degree( tableString.orientation ), Vector3( 0.0f, 0.0f, 1.0f ) ); + textView.SetOrientation( Dali::Degree( tableString.orientation ), Vector3( 0.0f, 0.0f, 1.0f ) ); Toolkit::Alignment alignmentContainer = Toolkit::Alignment::New( tableString.horizontalAlignment, tableString.verticalAlignment ); alignmentContainer.SetPadding( Toolkit::Alignment::Padding( tableString.padding, tableString.padding, tableString.padding, tableString.padding ) ); @@ -189,7 +189,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/packaging/com.samsung.dali-demo.spec b/packaging/com.samsung.dali-demo.spec index d32893b..5480518 100755 --- a/packaging/com.samsung.dali-demo.spec +++ b/packaging/com.samsung.dali-demo.spec @@ -2,7 +2,7 @@ Name: com.samsung.dali-demo Summary: The OpenGLES Canvas Core Demo -Version: 1.0.33 +Version: 1.0.34 Release: 1 Group: System/Libraries License: Apache-2.0 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 fe73652..aba2d2d 100644 --- a/shared/view.h +++ b/shared/view.h @@ -142,10 +142,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 ); }