X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fimage-scaling-and-filtering%2Fimage-scaling-and-filtering-example.cpp;h=981c6f0ec821452022ef9ce3dac951eadbd4c1ff;hb=1a473d5189ca7e7d55aca3a64a8a4ff2dc3b6c67;hp=c6f842e3ac04efa3d485c38ddf0f416d581f1088;hpb=694dced621016315f10a5bdbd3f4552f5e29e380;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp b/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp index c6f842e..981c6f0 100644 --- a/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp +++ b/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp @@ -270,7 +270,7 @@ public: imagePrevious.SetProperty( Actor::Property::OPACITY, 0.6f ); controlsLayer.Add( imagePrevious ); imagePrevious.SetProperty( Dali::Actor::Property::NAME, PREVIOUS_BUTTON_ID ); - imagePrevious.TouchSignal().Connect( this, &ImageScalingAndFilteringController::OnControlTouched ); + imagePrevious.TouchedSignal().Connect( this, &ImageScalingAndFilteringController::OnControlTouched ); // Next image button: Toolkit::ImageView imageNext = Toolkit::ImageView::New( DALI_ICON_PLAY, ImageDimensions( playWidth, playWidth ) ); @@ -280,7 +280,7 @@ public: imageNext.SetProperty( Actor::Property::OPACITY, 0.6f ); controlsLayer.Add( imageNext ); imageNext.SetProperty( Dali::Actor::Property::NAME, NEXT_BUTTON_ID ); - imageNext.TouchSignal().Connect( this, &ImageScalingAndFilteringController::OnControlTouched ); + imageNext.TouchedSignal().Connect( this, &ImageScalingAndFilteringController::OnControlTouched ); // Buttons to popup selectors for fitting and sampling modes: @@ -495,7 +495,7 @@ public: } } - bool OnControlTouched( Actor actor, const TouchData& event ) + bool OnControlTouched( Actor actor, const TouchEvent& event ) { if(event.GetPointCount() > 0) { @@ -530,11 +530,11 @@ public: void OnPinch( Actor actor, const PinchGesture& pinch ) { - if( pinch.state == Gesture::Started ) + if( pinch.GetState() == Gesture::Started ) { - mLastPinchScale = pinch.scale; + mLastPinchScale = pinch.GetScale(); } - const float scale = pinch.scale; + const float scale = pinch.GetScale(); if( ! Equals( scale, mLastPinchScale ) ) { @@ -557,16 +557,18 @@ public: { Window window = mApplication.GetWindow(); Vector2 windowSize = window.GetSize(); + const Vector2& displacement = gesture.GetDisplacement(); + // 1.0f and 0.75f are the maximum size caps of the resized image, as a factor of window-size. - mImageWindowScale.x = std::max( 0.05f, std::min( 0.95f, mImageWindowScale.x + ( gesture.displacement.x * 2.0f / windowSize.width ) ) ); - mImageWindowScale.y = std::max( 0.05f, std::min( 0.70f, mImageWindowScale.y + ( gesture.displacement.y * 2.0f / windowSize.height ) ) ); + mImageWindowScale.x = std::max( 0.05f, std::min( 0.95f, mImageWindowScale.x + ( displacement.x * 2.0f / windowSize.width ) ) ); + mImageWindowScale.y = std::max( 0.05f, std::min( 0.70f, mImageWindowScale.y + ( displacement.y * 2.0f / windowSize.height ) ) ); ResizeImage(); } void OnKeyEvent(const KeyEvent& event) { - if( event.state == KeyEvent::Down ) + if( event.GetState() == KeyEvent::DOWN ) { if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) ) { @@ -580,50 +582,50 @@ public: mApplication.Quit(); } } - else if ( event.keyPressedName == "Right" ) + else if ( event.GetKeyName() == "Right" ) { mImageWindowScale.x = std::max( 0.05f, std::min( 1.0f, mImageWindowScale.x * 1.1f ) ); } - else if ( event.keyPressedName == "Left" ) + else if ( event.GetKeyName() == "Left" ) { mImageWindowScale.x = std::max( 0.05f, mImageWindowScale.x * 0.9f ); } - else if ( event.keyPressedName == "Up" ) + else if ( event.GetKeyName() == "Up" ) { mImageWindowScale.y = std::max( 0.05f, std::min( 1.0f, mImageWindowScale.y * 1.1f ) ); } - else if ( event.keyPressedName == "Down" ) + else if ( event.GetKeyName() == "Down" ) { mImageWindowScale.y = std::max( 0.05f, mImageWindowScale.y * 0.9f ); } - else if ( event.keyPressedName == "o" ) + else if ( event.GetKeyName() == "o" ) { mImageWindowScale.x = std::max( 0.05f, mImageWindowScale.x * 0.9f ); mImageWindowScale.y = std::max( 0.05f, mImageWindowScale.y * 0.9f ); } - else if ( event.keyPressedName == "p" ) + else if ( event.GetKeyName() == "p" ) { mImageWindowScale.x = std::max( 0.05f, std::min( 1.0f, mImageWindowScale.x * 1.1f ) ); mImageWindowScale.y = std::max( 0.05f, std::min( 1.0f, mImageWindowScale.y * 1.1f ) ); } - else if ( event.keyPressedName == "n" ) + else if ( event.GetKeyName() == "n" ) { mCurrentPath = mCurrentPath + 1; mCurrentPath = mCurrentPath < NUM_IMAGE_PATHS ? mCurrentPath : 0; } - else if ( event.keyPressedName == "b" ) + else if ( event.GetKeyName() == "b" ) { mCurrentPath = mCurrentPath - 1; mCurrentPath = mCurrentPath >= 0 ? mCurrentPath : NUM_IMAGE_PATHS - 1; } // Cycle filter and scaling modes: - else if ( event.keyPressedName == "f" ) + else if ( event.GetKeyName() == "f" ) { mSamplingMode = NextFilterMode( mSamplingMode ); mSamplingModeButton.SetProperty( Toolkit::Button::Property::LABEL, StringFromFilterMode( mSamplingMode ) ); } // Cycle filter and scaling modes: - else if ( event.keyPressedName == "s" ) + else if ( event.GetKeyName() == "s" ) { mFittingMode = NextScalingMode( mFittingMode ); mFittingModeButton.SetProperty( Toolkit::Button::Property::LABEL, StringFromScalingMode( mFittingMode ) );