-const char * const EFFECT_WAVE_IMAGE( DALI_IMAGE_DIR "icon-effect-wave.png" );
-const char * const EFFECT_CROSS_IMAGE( DALI_IMAGE_DIR "icon-effect-cross.png" );
-const char * const EFFECT_FOLD_IMAGE( DALI_IMAGE_DIR "icon-effect-fold.png" );
-const char * const SLIDE_SHOW_START_ICON( DALI_IMAGE_DIR "icon-play.png" );
-const char * const SLIDE_SHOW_STOP_ICON( DALI_IMAGE_DIR "icon-stop.png" );
+const char * const EFFECT_WAVE_IMAGE( DEMO_IMAGE_DIR "icon-effect-wave.png" );
+const char * const EFFECT_WAVE_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-effect-wave-selected.png" );
+const char * const EFFECT_CROSS_IMAGE( DEMO_IMAGE_DIR "icon-effect-cross.png" );
+const char * const EFFECT_CROSS_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-effect-cross-selected.png" );
+const char * const EFFECT_FOLD_IMAGE( DEMO_IMAGE_DIR "icon-effect-fold.png" );
+const char * const EFFECT_FOLD_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-effect-fold-selected.png" );
+const char * const SLIDE_SHOW_START_ICON( DEMO_IMAGE_DIR "icon-play.png" );
+const char * const SLIDE_SHOW_START_ICON_SELECTED( DEMO_IMAGE_DIR "icon-play-selected.png" );
+const char * const SLIDE_SHOW_STOP_ICON( DEMO_IMAGE_DIR "icon-stop.png" );
+const char * const SLIDE_SHOW_STOP_ICON_SELECTED( DEMO_IMAGE_DIR "icon-stop-selected.png" );
- DALI_IMAGE_DIR "gallery-large-1.jpg",
- DALI_IMAGE_DIR "gallery-large-2.jpg",
- DALI_IMAGE_DIR "gallery-large-3.jpg",
- DALI_IMAGE_DIR "gallery-large-4.jpg",
- DALI_IMAGE_DIR "gallery-large-5.jpg",
- DALI_IMAGE_DIR "gallery-large-6.jpg",
- DALI_IMAGE_DIR "gallery-large-7.jpg",
- DALI_IMAGE_DIR "gallery-large-8.jpg",
- DALI_IMAGE_DIR "gallery-large-9.jpg",
- DALI_IMAGE_DIR "gallery-large-10.jpg",
- DALI_IMAGE_DIR "gallery-large-11.jpg",
- DALI_IMAGE_DIR "gallery-large-12.jpg",
- DALI_IMAGE_DIR "gallery-large-13.jpg",
- DALI_IMAGE_DIR "gallery-large-14.jpg",
- DALI_IMAGE_DIR "gallery-large-15.jpg",
- DALI_IMAGE_DIR "gallery-large-16.jpg",
- DALI_IMAGE_DIR "gallery-large-17.jpg",
- DALI_IMAGE_DIR "gallery-large-18.jpg",
- DALI_IMAGE_DIR "gallery-large-19.jpg",
- DALI_IMAGE_DIR "gallery-large-20.jpg",
- DALI_IMAGE_DIR "gallery-large-21.jpg",
+ DEMO_IMAGE_DIR "gallery-large-1.jpg",
+ DEMO_IMAGE_DIR "gallery-large-2.jpg",
+ DEMO_IMAGE_DIR "gallery-large-3.jpg",
+ DEMO_IMAGE_DIR "gallery-large-4.jpg",
+ DEMO_IMAGE_DIR "gallery-large-5.jpg",
+ DEMO_IMAGE_DIR "gallery-large-6.jpg",
+ DEMO_IMAGE_DIR "gallery-large-7.jpg",
+ DEMO_IMAGE_DIR "gallery-large-8.jpg",
+ DEMO_IMAGE_DIR "gallery-large-9.jpg",
+ DEMO_IMAGE_DIR "gallery-large-10.jpg",
+ DEMO_IMAGE_DIR "gallery-large-11.jpg",
+ DEMO_IMAGE_DIR "gallery-large-12.jpg",
+ DEMO_IMAGE_DIR "gallery-large-13.jpg",
+ DEMO_IMAGE_DIR "gallery-large-14.jpg",
+ DEMO_IMAGE_DIR "gallery-large-15.jpg",
+ DEMO_IMAGE_DIR "gallery-large-16.jpg",
+ DEMO_IMAGE_DIR "gallery-large-17.jpg",
+ DEMO_IMAGE_DIR "gallery-large-18.jpg",
+ DEMO_IMAGE_DIR "gallery-large-19.jpg",
+ DEMO_IMAGE_DIR "gallery-large-20.jpg",
+ DEMO_IMAGE_DIR "gallery-large-21.jpg",
-/**
- * @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 );
-}
-
Stage::GetCurrent().KeyEventSignal().Connect(this, &CubeTransitionApp::OnKeyEvent);
// Creates a default view with a default tool bar, the view is added to the stage.
mContent = DemoHelper::CreateView( application, mView, mToolBar, "", TOOLBAR_IMAGE, "" );
Stage::GetCurrent().KeyEventSignal().Connect(this, &CubeTransitionApp::OnKeyEvent);
// Creates a default view with a default tool bar, the view is added to the stage.
mContent = DemoHelper::CreateView( application, mView, mToolBar, "", TOOLBAR_IMAGE, "" );
- // Add an effect-changing button on the right of the tool bar.
- mImageWave = ResourceImage::New( EFFECT_WAVE_IMAGE );
- mImageCross = ResourceImage::New( EFFECT_CROSS_IMAGE );
- mImageFold = ResourceImage::New( EFFECT_FOLD_IMAGE );
- mEffectChangeButton = Toolkit::PushButton::New();
- mEffectChangeButton.SetBackgroundImage(mImageWave);
- mEffectChangeButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnEffectButtonClicked );
- mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
+ // Add an effect changing toggle button
+ Toolkit::ToggleButton effectChangeToggleButton = Toolkit::ToggleButton::ToggleButton::New();
+
+ effectChangeToggleButton.SetProperty( Toolkit::ToggleButton::Property::STATE_VISUALS,
+ Property::Array{ EFFECT_WAVE_IMAGE,
+ EFFECT_CROSS_IMAGE,
+ EFFECT_FOLD_IMAGE }
+ );
+
+ effectChangeToggleButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnEffectButtonClicked );
+ mToolBar.AddControl( effectChangeToggleButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
mSlideshowButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnSildeshowButtonClicked );
mToolBar.AddControl( mSlideshowButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING );
// Set size to stage size to avoid seeing a black border on transition
mViewSize = Stage::GetCurrent().GetSize();
mSlideshowButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnSildeshowButtonClicked );
mToolBar.AddControl( mSlideshowButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING );
// Set size to stage size to avoid seeing a black border on transition
mViewSize = Stage::GetCurrent().GetSize();
- mParent = Actor::New();
- mParent.SetSize( mViewSize );
- mParent.SetPositionInheritanceMode( USE_PARENT_POSITION );
- mContent.Add( mParent );
-
- // use pan gesture to detect the cursor or finger movement
- mPanGestureDetector = PanGestureDetector::New();
- mPanGestureDetector.DetectedSignal().Connect( this, &CubeTransitionApp::OnPanGesture );
- mPanGestureDetector.Attach( mParent );
+ // show the first image
+ mCurrentTexture = LoadStageFillingTexture( IMAGES[mIndex] );
- mCubeFoldEffect = Toolkit::CubeTransitionFoldEffect::New(NUM_ROWS_FOLD, NUM_COLUMNS_FOLD, mViewSize);
- mCubeFoldEffect.SetTransitionDuration( ANIMATION_DURATION_FOLD);
+ mCubeCrossEffect.SetSize( mViewSize );
+ mCubeCrossEffect.SetParentOrigin( ParentOrigin::CENTER );
+ mCubeCrossEffect.SetCurrentTexture( mCurrentTexture );
+
+ mCubeFoldEffect = Toolkit::CubeTransitionFoldEffect::New( NUM_ROWS_FOLD, NUM_COLUMNS_FOLD );
+ mCubeFoldEffect.SetTransitionDuration( ANIMATION_DURATION_FOLD );
- ResourceImage image = LoadStageFillingImage( IMAGES[ mIndex ] );
- mNextImage = ImageActor::New( image );
-
- mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION);
- mNextImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
- mNextImage.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO );
- mNextImage.SetRelayoutEnabled( false );
- mCurrentEffect.SetTargetImage(mNextImage);
- if( image.GetLoadingState() == ResourceLoadingSucceeded )
- {
- mIsImageLoading = false;
- OnImageLoaded( image );
- }
- else
- {
- mIsImageLoading = true;
- image.LoadingFinishedSignal().Connect( this, &CubeTransitionApp::OnImageLoaded );
- }
-}
-
-void CubeTransitionApp::OnImageLoaded(ResourceImage image)
-{
- mIsImageLoading = false;
- mCurrentEffect.StartTransition( mPanPosition, mPanDisplacement );
- mParent.Remove(mCurrentImage);
- mParent.Add(mNextImage);
- mCurrentImage = mNextImage;
+ mNextTexture = LoadStageFillingTexture( IMAGES[ mIndex ] );
+ mCurrentEffect.SetTargetTexture( mNextTexture );
+ mIsImageLoading = false;
+ mCurrentEffect.StartTransition( mPanPosition, mPanDisplacement );
+ mCurrentTexture = mNextTexture;
+Texture CubeTransitionApp::LoadStageFillingTexture( const char* filepath )
+{
+ ImageDimensions dimensions( Stage::GetCurrent().GetSize().x, Stage::GetCurrent().GetSize().y );
+ Devel::PixelBuffer pixelBuffer = LoadImageFromFile( filepath, dimensions, FittingMode::SCALE_TO_FILL );
+ PixelData pixelData = Devel::PixelBuffer::Convert(pixelBuffer);
+
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight() );
+ texture.Upload( pixelData );
+ return texture;
+}
+