From: Jisung Ahn Date: Tue, 11 Dec 2012 10:47:55 +0000 (+0900) Subject: remove useless file X-Git-Tag: 2.1b_release~3^2~35 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=da12d6b974acb478607abb53b8912757942a4ec8;p=apps%2Fhome%2Fug-image-viewer-efl.git remove useless file Change-Id: I9db3b3ddd43a604e6ae9299b20d19d644f4b84bc --- diff --git a/slideshow/src/dali_effect/include/ivug-app-navigation.h b/slideshow/src/dali_effect/include/ivug-app-navigation.h deleted file mode 100644 index fe47bbe..0000000 --- a/slideshow/src/dali_effect/include/ivug-app-navigation.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef __IVUG_APPNAVIGATION_H__ -#define __IVUG_APPNAVIGATION_H__ - -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -// EXTERNAL INCLUDES -#include -#include -#include -#include - -// INTERNAL INCLUDES -#include "ivug-includes.h" -//#include "toolbar-3d.h" -#include "ivug-view-stack-info.h" -#include "ivug-medialist.h" -#include "ivug-slideshow.h" - -using namespace Dali; - -namespace Imageview3D -{ -class ImageView; - -/** -* Views -*/ -enum ViewId -{ - VIEW_INVALID = -1, - SLIDESHOW_VIEW -}; - -class AppNavigation -{ -public: - typedef boost::shared_ptr ViewPtr; - typedef std::map ViewContainer; - typedef ViewContainer::iterator ViewIter; - typedef ViewContainer::const_iterator ConstViewIter; - typedef boost::shared_ptr ViewStackInfoPtr; - typedef std::vector ViewStacks; - - static const unsigned int NAVIGATION_TIME_MS; - static const float NAVIGATION_TIME_S; - - AppNavigation( Adaptor &application ); - virtual ~AppNavigation(); - - void CreateViews(SlideShow *ss_handle); - void Rotate(Imageview3D::Orientation orientation); - - /// Called directly by views with an ID of where they should go to - void NavigateForward(Imageview3D::ViewId); - - /// this method is imageview called by a back button - void NavigateBack(); - - void ShowStack(size_t stackIdx); - void HideStack(size_t stackIdx); - ImageView *GetViewById(int viewId); - void StartImageView(ImageView* view); - void InitializeViews(SlideShow *ss_handle); - -private: - - // Called whenever a new view has got focus. - void OnFocusView(ImageView *activeView); - bool OnNavigateForwardEnd(); - bool OnNavigateBackwardEnd(); - ViewStackInfo& GetCurrentViewStackInfo() { return *mViewStacks[static_cast(mCurrentStackId)]; } - ViewStackInfo& GetViewStackInfoByIndex(size_t stackIdx) { return *mViewStacks[static_cast(stackIdx)]; } - - void StackPush(size_t i, ViewId viewId); - //void CheckForExitButton(); - -private: - - Adaptor& mApplication; - ViewContainer mViews; // owned views - - bool mClearNavigationHistory; - - ViewStacks mViewStacks; // stacks of unowned views. Vector is indexed by mCurrentViewId - size_t mCurrentStackId; // Current stack - size_t mPreviousStackId; // Previous stack - Dali::Animation mTabAnimation; - - Dali::Timer mNavigationEndTimer; - Dali::Connection mNavigationEndConnection; -}; - -} // namespace - -#endif // __GALLERY_APPNAVIGATION_H__ diff --git a/slideshow/src/dali_effect/include/ivug-constraints.h b/slideshow/src/dali_effect/include/ivug-constraints.h deleted file mode 100644 index 12bfe27..0000000 --- a/slideshow/src/dali_effect/include/ivug-constraints.h +++ /dev/null @@ -1,442 +0,0 @@ -#ifndef __DALI_IVUG_CONSTRAINTS_H__ -#define __DALI_IVUG_CONSTRAINTS_H__ - -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -/** - * Constraint that sets the child width and depth to be same as parents - * and constraints the height to be constant - */ -struct ParentWidthConstantHeight -{ - /** - * @param height for the child - */ - ParentWidthConstantHeight( float height ) - : mHeight( height ) - { - } - - /** - * function operator to apply the constant height - */ - Dali::Vector3 operator()(const Dali::Vector3& current, - const Dali::PropertyInput& parentSize) - { - //return Dali::Vector3( parentSize.GetFloat().width, mHeight, parentSize.GetFloat().depth ); - return Dali::Vector3( parentSize.GetVector3().width, mHeight, parentSize.GetVector3().depth ); - } - - float mHeight; -}; - -/** - * Constraint that sets the child position relative to parents size - */ -struct PercentageOfParentWidth -{ - PercentageOfParentWidth(float percentage) - : mScaleFactor( percentage ) - { - } - - Dali::Vector3 operator()(const Dali::Vector3& current, - const Dali::PropertyInput& parentSize) - { - return Dali::Vector3( parentSize.GetVector3().width * mScaleFactor, current.y, current.z ); - } - - float mScaleFactor; -}; - -struct ParentSizeEightyPercentSquare -{ - ParentSizeEightyPercentSquare() - { - } - - /** - * function operator to apply the parent size - */ - Dali::Vector3 operator()(const Dali::Vector3& current, - const Dali::Vector3& parentOrigin, - const Dali::Vector3& anchorPoint, - const Dali::Vector3& parentSize, - const Dali::Vector3& parentPosition, - const Dali::Quaternion& parentRotation, - const Dali::Vector3& parentScale) - { - float minSize = std::min(parentSize.width, parentSize.height) * 0.8f; - return Dali::Vector3(minSize, minSize, parentSize.depth ); - } -}; - - -/** - * Constraint that removes horizontal/vertical/depth margins from parent size. - */ -struct ParentSizeWithFixedMargin -{ - ParentSizeWithFixedMargin(Dali::Vector3 margin) - { - mMargin = margin*2; - } - Dali::Vector3 operator()(const Dali::Vector3& current, - const Dali::Vector3& parentOrigin, - const Dali::Vector3& anchorPoint, - const Dali::Vector3& parentSize, - const Dali::Vector3& parentPosition, - const Dali::Quaternion& parentRotation, - const Dali::Vector3& parentScale) - { - return parentSize - mMargin; - } - Dali::Vector3 mMargin; -}; - -/** - * Constraint that fills to parent width, keeping own height - */ -struct ParentWidthChildHeight -{ - ParentWidthChildHeight() - { - } - - Dali::Vector3 operator()(const Dali::Vector3& current, - const Dali::Vector3& parentOrigin, - const Dali::Vector3& anchorPoint, - const Dali::Vector3& parentSize, - const Dali::Vector3& parentPosition, - const Dali::Quaternion& parentRotation, - const Dali::Vector3& parentScale) - { - return Dali::Vector3(parentSize.width, current.height, parentSize.depth); - } -}; - -/** - * Constraint that sets the child position relative to parents height - */ -struct RelativeToHeight -{ - /** - * Constraint that is relative (%) to parent height - * @param heightFactor between 0 and 1 - */ - RelativeToHeight( float heightFactor ) : mHeightFactor(heightFactor) - { - } - - Dali::Vector3 operator()(const Dali::Vector3& current, - const Dali::Vector3& parentOrigin, - const Dali::Vector3& anchorPoint, - const Dali::Vector3& parentSize, - const Dali::Vector3& parentPosition, - const Dali::Quaternion& parentRotation, - const Dali::Vector3& parentScale) - { - return Dali::Vector3( 0.0f, parentSize.height * mHeightFactor, 0.0f); - } - float mHeightFactor; -}; - -struct RelativeToHeightFixedZ -{ - /** - * Constraint that is relative (%) to parent height - * @param heightFactor between 0 and 1 - * @param z the Z value - */ - RelativeToHeightFixedZ( float heightFactor, float z ) : mHeightFactor(heightFactor), mZ(z) - { - } - - Dali::Vector3 operator()(const Dali::Vector3& current, - const Dali::Vector3& parentOrigin, - const Dali::Vector3& anchorPoint, - const Dali::Vector3& parentSize, - const Dali::Vector3& parentPosition, - const Dali::Quaternion& parentRotation, - const Dali::Vector3& parentScale) - { - return Dali::Vector3( 0.0f, parentSize.height * mHeightFactor, mZ); - } - float mHeightFactor; - float mZ; -}; - -/** - * Constraint that sets the child position relative to parents height - */ -struct ParentWidthFixedHeight -{ - /** - * Constraint that is relative (%) to parent height - * @param heightFactor between 0 and 1 - */ - ParentWidthFixedHeight( float height ) : mHeight(height) - { - } - - Dali::Vector3 operator()(const Dali::Vector3& current, - const Dali::Vector3& parentOrigin, - const Dali::Vector3& anchorPoint, - const Dali::Vector3& parentSize, - const Dali::Vector3& parentPosition, - const Dali::Quaternion& parentRotation, - const Dali::Vector3& parentScale) - { - return Dali::Vector3( parentSize.width, mHeight, parentSize.depth); - } - float mHeight; -}; - - -/** - * Constraint that sets the model actor positions appropriately for their index vs current index - */ -struct ParentPositionOutsideOffsetY -{ - /** - * Constraint that is relative (%) to parent height - * @param heightFactor between 0 and 1 - */ - ParentPositionOutsideOffsetY(size_t idx, size_t curIdx, float z, bool offsetY) - : mIdx(idx), mCurIdx(curIdx), mZ(z), mOffsetY(offsetY) - { - } - - Dali::Vector3 operator()(const Dali::Vector3& current, - const Dali::Vector3& parentOrigin, - const Dali::Vector3& anchorPoint, - const Dali::Vector3& parentSize, - const Dali::Vector3& parentPosition, - const Dali::Quaternion& parentRotation, - const Dali::Vector3& parentScale) - { - Dali::Vector3 position(0.0f, 0.0f, mZ); - - if(mIdx < mCurIdx) - position.x = -3*parentSize.width/4; - else if(mCurIdx < mIdx) - position.x = 3*parentSize.width/4; - - if(mOffsetY) - position.y = parentSize.height; // Note that parent is the popup background, not the full screen dark background - - return position; - } - size_t mIdx; - size_t mCurIdx; - float mZ; - bool mOffsetY; -}; - - -struct ParentPositionFakeOrigin -{ - /** - * Constraint that takes an origin, and constrains to that - * @param heightFactor between 0 and 1 - */ - ParentPositionFakeOrigin(Dali::Vector3 origin) - : mOrigin (origin) - { - } - - Dali::Vector3 operator()(const Dali::Vector3& current, - const Dali::Vector3& parentOrigin, - const Dali::Vector3& anchorPoint, - const Dali::Vector3& parentSize, - const Dali::Vector3& parentPosition, - const Dali::Quaternion& parentRotation, - const Dali::Vector3& parentScale) - { - return Dali::Vector3((mOrigin.x - parentOrigin.x) * parentSize.width, - (mOrigin.y - parentOrigin.y) * parentSize.height, - (mOrigin.z - parentOrigin.z) * parentSize.depth); - - } - Dali::Vector3 mOrigin; -}; - - -struct ParentSizeRelativeXY -{ - /** - * @param scale vector for width, height and depth - */ - ParentSizeRelativeXY( float xScale, float yScale, float zPosition ) - : mXScale( xScale ), mYScale( yScale ), mZPosition(zPosition) - { - } - - /** - * function operator to apply the scaled parent size - */ - Dali::Vector3 operator()(const Dali::Vector3& current, - const Dali::Vector3& parentOrigin, - const Dali::Vector3& anchorPoint, - const Dali::Vector3& parentSize, - const Dali::Vector3& parentPosition, - const Dali::Quaternion& parentRotation, - const Dali::Vector3& parentScale) - { - return Dali::Vector3(parentSize.x * mXScale, parentSize.y * mYScale, mZPosition); - } - - float mXScale; - float mYScale; - float mZPosition; -}; - - -struct ParentSizeRotatedRelative -{ - /** - * @param scale vector for width, height and depth - */ - ParentSizeRotatedRelative( Dali::Vector3 scales) - : mScales(scales) - { - } - - /** - * function operator to apply the scaled parent size - */ - Dali::Vector3 operator()(const Dali::Vector3& current, - const Dali::Vector3& parentOrigin, - const Dali::Vector3& anchorPoint, - const Dali::Vector3& parentSize, - const Dali::Vector3& parentPosition, - const Dali::Quaternion& parentRotation, - const Dali::Vector3& parentScale) - { - return Dali::Vector3(parentSize.height * mScales.y, parentSize.width * mScales.x, parentSize.z * mScales.z); - } - - Dali::Vector3 mScales; -}; - - - - -struct LocalPositionOffsets -{ - LocalPositionOffsets(Dali::Vector3 offsets) : mOffsets(offsets) - { - } - - Dali::Vector3 operator()(const Dali::Vector3& size, - const Dali::Vector3& position, - const Dali::Quaternion& rotation, - const Dali::Vector3& scaled, - const Dali::Vector4& color) - { - return mOffsets; - } - Dali::Vector3 mOffsets; -}; - -/** - * Constraint that sets the local orientation - */ -struct LocalOrientation -{ - LocalOrientation(const Dali::Quaternion& rotateTo) : mRotateTo(rotateTo) - { - } - Dali::Quaternion operator()(const Dali::Vector3& size, - const Dali::Vector3& position, - const Dali::Quaternion& rotation, - const Dali::Vector3& scale, - const Dali::Vector4& color) - { - return mRotateTo; - } - Dali::Quaternion mRotateTo; -}; - -/** - * Constraint that sets the local visibility - * (Doesn't seem to work as expected with SetApplyTime) - */ -struct LocalVisibility -{ - LocalVisibility(bool visible) : mVisible(visible) - { - } - bool operator()(const Dali::Vector3& size, - const Dali::Vector3& position, - const Dali::Quaternion& rotation, - const Dali::Vector3& scale, - const Dali::Vector4& color) - { - return mVisible; - } - bool mVisible; -}; - - -/** - * Constraint to change just the opacity of the actor's color - */ -struct LocalOpacity -{ - LocalOpacity(float opacity) : mOpacity(opacity) - { - } - - Dali::Vector4 operator()(const Dali::Vector3& size, - const Dali::Vector3& position, - const Dali::Quaternion& rotation, - const Dali::Vector3& scale, - const Dali::Vector4& color) - { - Dali::Vector4 newColor(color); - newColor.a = mOpacity; - return newColor; - } - float mOpacity; -}; - - -struct TumbleFunc -{ - static TumbleFunc GetRandom() - { - return TumbleFunc(Dali::Random::Range(0.5f, 1.0f), Dali::Random::Range(0.0f, 0.5f), Dali::Random::Range(0.0f, 0.6f)); - } - - TumbleFunc(float x, float y, float z) - : tumbleAxis(Dali::Vector3(x,y,z)) - { - tumbleAxis.Normalize(); - } - - Dali::Quaternion operator()(const Dali::Quaternion& current, const Dali::Quaternion& target, float progress) - { - if (progress>0.001f && progress<1.0f) - { - Dali::Quaternion tumbleRotation(Dali::Quaternion(progress * Dali::Math::PI * 2.0f, tumbleAxis)); - - return tumbleRotation * current; - } - - return current; - } - - Dali::Vector3 tumbleAxis; -}; - - -#endif //__DALI_GALLERY_CONSTRAINTS_H__ diff --git a/slideshow/src/dali_effect/include/ivug-dali-imageview.h b/slideshow/src/dali_effect/include/ivug-dali-imageview.h deleted file mode 100644 index 2709161..0000000 --- a/slideshow/src/dali_effect/include/ivug-dali-imageview.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -#ifndef __IVUG_DALI_IMAGEVIEWER_H__ -#define __IVUG_DALI_IMAGEVIEWER_H__ - -/* EXTERNAL INCLUDES */ -#include - -/* INTERNAL INCLUDES */ -#include "ivug-app-navigation.h" -#include "ivug-includes.h" -#include "ivug-effect.h" - -using namespace Dali; -using namespace Imageview3D; -using namespace std; - - -namespace Imageview3D -{ -/* Available layers*/ -enum -{ - BACKGROUND_LAYER, - MAIN_VIEW_LAYER, - NAVIGATION_BAR_LAYER, - LAYER_COUNT -}; - -//class ImageView; - -/** - * - */ -class Imageviewer -{ -public: - - /** - * Constructor - * @param application reference - */ - Imageviewer(Adaptor& application, SlideShow *ss_handle); - - /** - * Destructor - */ - virtual ~Imageviewer(); - - /** - * Adds an actor to the Stage then a particular layer. - * Allows toolbars to be put in a layer above the main layer. - * @pre CreateLayers has been called so layers exist. - * @param layer, enum related to the layer actor needs to be added to - * @param actor, the actor to be added to the given layer. - */ - void AddToLayer(int layer, Dali::Actor actor); - - /** - * Remove the actor from the layer - * @param layer, enum related to the layer - * @param actor to be removed from the given layer. - */ - void RemoveFromLayer(int layer, Dali::Actor actor); - void RemoveFromLayerMain(); - - AppNavigation& GetAppNavigation (); - Dali::Layer GetLayer(int layer); - /** - *Can't be used now. - * Sets the visibility of screen furniture (title, toolbar, background) - * @param enable the screen furniture - */ - void SetScreenFurnitureVisibility(bool enable); - - float GetNaviBarHeight(); - - void SetTitleBarText(std::string); - - void SetSize(float width, float height); - void SetPosition(float x, float y); - void ResumeViewAndTransitionTimer(); - void OrientationChanged(const int orientation); - void SignalResizeSend(void); - -private: // Implementation - - void CreateViews(); - void Resize(Adaptor& app); - void CreateLayers(); - void CreateBackground(); - void CreateNavigationBar(); - -private: - - AppNavigation mAppNavigation; - Adaptor& mApplication; - int mOrientation; - Imageview3D::Orientation mCurOrientation; - Dali::ImageActor mBackground; /* This might be a 3D model one day! */ - - Dali::Actor mNavigationBar; /* Contains a background with 2 buttons. */ - Dali::ImageActor mNavigationBarBg; - Dali::TextActor mTitleText; - - float mNavigationBarHeight; - - /* static layers can be added to by view classes */ - Dali::Layer mBackgroundLayer; - Dali::Layer mNavigationBarLayer; - Dali::Layer mMainLayer; - - /* Used to show/hide furniture */ - Dali::Animation mFadeAnimation; - - /* Size, Position */ - float mX; - float mY; - float mWidth; - float mHeight; - SlideShow *mSSHandle; -}; - - -} /* namespace */ - -#endif /* __GL_DALI_GALLERY_H__ */ - - diff --git a/slideshow/src/dali_effect/include/ivug-dali-slideshow-view.h b/slideshow/src/dali_effect/include/ivug-dali-slideshow-view.h deleted file mode 100644 index 271a5fd..0000000 --- a/slideshow/src/dali_effect/include/ivug-dali-slideshow-view.h +++ /dev/null @@ -1,134 +0,0 @@ -#ifndef __DALI_IVUG_SLIDESHOW_VIEW_H__ -#define __DALI_IVUG_SLIDESHOW_VIEW_H__ - -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -// EXTERNAL INCLUDES -#include -#include -#include - -// INTERNAL INCLUDES -#include "ivug-image-view.h" - -namespace Imageview3D -{ - -// FORWARD DECLARES -class SlideshowControl; -class SlideshowEffect; - -/** - * View to show slide show - */ -class SlideshowView : public ImageView -{ -public: - typedef boost::shared_ptr EffectPtr; - /** - * Static constructor - * @return the new instance of the Slideshow View - */ - static ImageView* New(); - - /** - * Destructor - */ - ~SlideshowView(); - -public: // from ImageView - /** - * @copydoc ImageView::DoActivationBegin - */ - virtual void DoActivationBegin(Dali::Animation slideAnimation); - /** - * @copydoc ImageView::DoActivationEnd - */ - virtual void DoActivationEnd(); - /** - * @copydoc ImageView::DoDeactivationBegin - */ - virtual void DoDeactivationBegin(Dali::Animation slideAnimation); - /** - * @copydoc ImageView::DoDeactivationEnd - */ - virtual void DoDeactivationEnd(); - - /** - * @copydoc ImageView::DoEnterForwardBegin - */ - virtual void DoEnterForwardBegin( float navigationDuration ); - - /** - * @copydoc ImageView::DoEnterForwardEnd - */ - virtual void DoEnterForwardEnd(); - - /** - * @copydoc ImageView::DoEnterBackwardBegin - */ - virtual void DoEnterBackwardBegin( float navigationDuration ); - - /** - * @copydoc ImageView::DoEnterBackwardEnd - */ - virtual void DoEnterBackwardEnd(); - - /** - * @copydoc ImageView::DoLeaveForwardBegin - */ - virtual void DoLeaveForwardBegin( float navigationDuration ); - - /** - * @copydoc ImageView::DoLeaveForwardEnd - */ - virtual void DoLeaveForwardEnd(); - - /** - * @copydoc ImageView::DoLeaveBackwardBegin - */ - virtual void DoLeaveBackwardBegin( float navigationDuration ); - - /** - * @copydoc ImageView::DoLeaveBackwardEnd - */ - virtual void DoLeaveBackwardEnd(); - - /** - * @copydoc ImageView::DoSetOrientation - */ - virtual void DoSetOrientation(); - - /** - * @copydoc ImageView::DoFocusView - */ - virtual void DoFocusView(); - - void SlideShowResume(void); - - void DoInitialize(void); - -private: - - SlideshowView(); - void SetSlideshowSize(); - bool OnClick( Dali::Actor actor, const Dali::TouchEvent& event ); - - boost::shared_ptr< SlideshowControl > mSlideshowControl; - std::vector mEffects; - //std::map mEffects; - //typedef EffectContainer::iterator ViewIter; -}; - -} // namespace Imageview3D - - -#endif // __DALI_DEMO_SLIDESHOW_VIEW_H__ diff --git a/slideshow/src/dali_effect/include/ivug-dali.h b/slideshow/src/dali_effect/include/ivug-dali.h deleted file mode 100644 index bcb0a9b..0000000 --- a/slideshow/src/dali_effect/include/ivug-dali.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -#ifndef __IVUG_DALI_H__ -#define __IVUG_DALI_H__ - -#include -#include "ivug-dali-imageview.h" -#include "ivug-slideshow.h" - -using namespace Imageview3D; -typedef enum { - EVASPLUGIN_INITED = 0x00, - EVASPLUGIN_RESIZED, -}evasplugin_state_e; - -#ifdef __cplusplus -extern "C" { -#endif - -void ivug_dali_pause(SlideShow *ss_handle); - -void ivug_dali_resume(SlideShow *ss_handle); - -void ivug_return_main_view(SlideShow *ss_handle); - -void ivug_dali_create_xWin(SlideShow *data); - -void ivug_imageviewer_init_xWin(SlideShow *data, int state); - - -#ifdef __cplusplus -} -#endif - -#endif /* __GL_DALI_H__ */ - diff --git a/slideshow/src/dali_effect/include/ivug-image-view.h b/slideshow/src/dali_effect/include/ivug-image-view.h deleted file mode 100644 index 5999106..0000000 --- a/slideshow/src/dali_effect/include/ivug-image-view.h +++ /dev/null @@ -1,362 +0,0 @@ -#ifndef __IVUG_IMAGE_VIEW_H__ -#define __IVUG_INAGE_VIEW_H__ - -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include "ivug-app-navigation.h" -#include "ivug-includes.h" -//#include "toolbar-3d.h" -//#include "lighting.h" - -namespace Imageview3D -{ - -/** - * Base class for all gallery views - */ -class ImageView -{ -public: - static const float ROTATION_ANIMATION_DURATION; - - /** - * Virtual destructor as this is a base class - */ - virtual ~ImageView(); - - /** - * Initialize the view. - * @param appNavigation to navigate between views - */ - void Initialize( AppNavigation* appNavigation, SlideShow *ss_handle); - - /** - * Set the orientation of the view. - * Rotates the root actor to match the orientation. - * @param orientation Imageview3D::Orientation of the view: PORTRAIT, LANDSCAPE, PORTRAIT_INVERSE or LANDSCAPE_INVERSE - */ - void SetOrientation( Imageview3D::Orientation orientation ); - - /** - * Retrieve the current orientation - * @return Imageview3D::Orientation, either PORTRAIT, LANDSCAPE, PORTRAIT_INVERSE or LANDSCAPE_INVERSE - */ - Orientation GetOrientation() const - { - return mOrientation; - } - - /** - * Query whether the view is the active view. - * @return True if the view is active. - */ - bool IsActive() - { - return mActive; - } - - // Lighting GetLighting() - //{ - // return mLighting; - // } - - /** - * Called by the AppNavigation class when this view is becoming active by tab selection. - * @param[in] slideAnimation - the animation used to perform the slide transition - */ - void ActivationBegin(Dali::Animation slideAnimation); - - /** - * Called by the AppNavigation class when this view has become active by tab selection. - */ - void ActivationEnd(); - - /** - * Called by the AppNavigation class when this view is becoming inactive by tab selection. - * @param[in] slideAnimation - the animation used to perform the slide transition - */ - void DeactivationBegin(Dali::Animation slideAnimation); - - /** - * Called by the AppNavigation class when this view has become inactive by tab selection. - */ - void DeactivationEnd(); - - - - /** - * Called by the navigation class when this view is becoming active by moving forward to it - * in the navigation chain. - * @param navigationDuration for the view entry in seconds - */ - void EnterForwardBegin( float navigationDuration ); - - /** - * Called by the navigation class when this view has become active by moving forward to it - * in the navigation chain. - */ - void EnterForwardEnd(); - - /** - * Called by the navigation class when this view is becoming active in a backwards navigation - * direction. i.e. the 'back' button pressed. - * @param navigationDuration for the view entry in seconds - */ - void EnterBackwardBegin( float navigationDuration ); - - /** - * Called by the navigation class when this view has become active in a backwards navigation - * direction. i.e. the 'back' button pressed. - */ - void EnterBackwardEnd(); - - /** - * Called by the navigation class when this view is being deactivated by going forwards in the - * navigation chain. - * @param navigationDuration for the view exit in seconds - */ - void LeaveForwardBegin( float navigationDuration ); - - /** - * Called by the navigation class when this view has been deactivated by going forwards in the - * navigation chain. - */ - void LeaveForwardEnd(); - - /** - * Called by the navigation class when this view is being deactivated by going backwards in the - * navigation chain. - * @param navigationDuration for the view exit in seconds - */ - void LeaveBackwardBegin( float navigationDuration ); - - /** - * Called by the navigation class when this view has been deactivated by going backwards in the - * navigation chain. - */ - void LeaveBackwardEnd(); - - std::string GetTitleText() - { - return mTitleBarText; - } - - /** - * Called by the navigation class when this view has come into focus (regardless of whether by - * Entering/Leaving, or shuffling across tools (stacks)) - */ - void FocusView(); - - /** - * Retrieve the root actor of the view. - * All view-specific actors should be added to a root actor, not directly on stage. - * See also GetRotatingActor(). - */ - Dali::Actor GetRootActor() const { return mRootActor; } - - /** - * Retrieve the rotating root actor of the view. - * This is a direct child of mRootActor, which auto rotates when the orientation changes. - * See also GetRootActor(). - */ - Dali::Actor GetRotatingRootActor() const { return mRotatingRootActor; } - - /** - * Convenience function to set the contents of a view to be visible/invisible - * @param [in] True if the view contents should be visible - */ - void SetVisible(bool visible) - { - mRootActor.SetVisible(visible); - } - - /** - * Sets the ViewStackInfo instance that this view uses, such that it can - * store stack (tool) specific state information e.g. Currently selected item. - * - * @param viewStackInfo that this view uses. - */ - void SetViewStackInfo(ViewStackInfo *viewStackInfo) { mViewStackInfo = viewStackInfo; } - - /** - * Returns the current view stack Info - * - * @return currentViewStackInfo (if exists) - */ - ViewStackInfo *GetViewStackInfo(void) - { - DALI_ASSERT_ALWAYS( mViewStackInfo ); - return mViewStackInfo; - } - -protected: // API for deriving classes - - /** - * Navigates to the given view. - * This is only allowed if this view is the current view, - * if not this is a no-op. - * @param view to navigate to - */ - void NavigateTo( ViewId view ); - - /** - * Navigates back to previous view - */ - void NavigateBack(); - -private: // API for deriving classes - - /** - * Customizable part of orientation change - * Deriving views can override this to do custom layout for specific orientation - */ - virtual void DoSetOrientation() {}; - - /** - * Customizable part of initialization - * Deriving views can override this to do custom initialization - */ - virtual void DoInitialize() {}; - - /** - * Called by the base class when this view is becoming active when the user presses a tab - * button, and this view slides on. The slide animation is passed in so that other - * animations can be synchronised with it. - * @param[in] slideAnimation - the animation used to perform the slide transition - */ - virtual void DoActivationBegin(Dali::Animation slideAnimation) = 0; - - /** - * Called by the base class when this view has become active after the user presses a tab - * button, and this view has finished sliding on. - */ - virtual void DoActivationEnd() = 0; - - /** - * Called by the base class when this view is becoming inactive when the user presses a tab - * button, and this view slides off. The slide animation is passed in so that other - * animations can be synchronised with it. - * @param[in] slideAnimation - the animation used to perform the slide transition - */ - virtual void DoDeactivationBegin(Dali::Animation slideAnimation) = 0; - - /** - * Called by the base class when this view has become inactive after the user presses a tab - * button, and this view has finished sliding off. - */ - virtual void DoDeactivationEnd() = 0; - - /** - * Called by the base class when this view is becoming active by moving forward to it - * in the navigation chain. In this case the view may be expected to perform some sort of - * animation as it becomes the active view. Shared actors etc. should not be used until - * DoEnterForwardEnd() has been called, since they may be animated by the leaving view. - * @param navigationDuration for the view entry in seconds - */ - virtual void DoEnterForwardBegin( float navigationDuration ) = 0; - - /** - * Called by the base class when this view has become active by moving forward to it - * in the navigation chain. Animations may now be applied to shared actors. - */ - virtual void DoEnterForwardEnd() = 0; - - /** - * Called by the base class when this view is becoming active in a backwards navigation - * direction. i.e. the 'back' button pressed. In this case the view may be expected to perform - * some sort of animation as it becomes the active view. Shared actors etc. should not be used - * until DoEnterBackwardEnd() has been called, since they may be animated by the leaving view. - * @param navigationDuration for the view entry in seconds - */ - virtual void DoEnterBackwardBegin( float navigationDuration ) = 0; - - /** - * Called by the base class when this view has become active by moving backward to it - * in the navigation chain. Animations may now be applied to shared actors. - */ - virtual void DoEnterBackwardEnd() = 0; - - /** - * Called by the base class when this view is being deactivated by going forwards in the - * navigation chain. The view may be expected to perform leave animations, and may do so - * using shared actors. - * @param navigationDuration for the view exit in seconds - */ - virtual void DoLeaveForwardBegin( float navigationDuration ) = 0; - - /** - * Called by the base class when this view has been deactivated by going forwards in the - * navigation chain. The view may be expected to free resources while inactive. - */ - virtual void DoLeaveForwardEnd() = 0; - - /** - * Called by the base class when this view is being deactivated by going backwards in the - * navigation chain. The view may be expected to perform leave animations, and may do so - * using shared actors. - * @param navigationDuration for the view exit in seconds - */ - virtual void DoLeaveBackwardBegin( float navigationDuration ) = 0; - - /** - * Called by the base class when this view has been deactivated by going backwards in the - * navigation chain. The view may be expected to free resources while inactive. - */ - virtual void DoLeaveBackwardEnd() = 0; - - /** - * Called by the base class when this view has just been activated (regardless of whether by - * Entering/Leaving, or shuffling across stacks) - */ - virtual void DoFocusView() = 0; - -protected: - /** - * Constructor - */ - ImageView(); - - void CreateModel(); - void CreateAlbumModel(); - - void CreateNewAlbumView(); - - Dali::Actor mRootActor; ///< root actor for the view, auto added to stage - Dali::Actor mRotatingRootActor; ///< direct child of root, auto rotates when orientation changes - SlideShow *mSSHandle; - - Imageview3D::Orientation mOrientation; - - bool mActive; ///< True when the view has been entered i.e. after EnterForwardEnd() or EnterBackwardEnd() have been called. - ///< Only active views are allowed to initiate navigation to other views. - - std::string mTitleBarText; - //Lighting mLighting; - - AppNavigation* mAppNavigation; ///< Pointer to the AppNavigation class that this ImageView is controlled by. - ViewStackInfo* mViewStackInfo; ///< Pointer to the ViewStackInfo class that this ImageView resides in. - -private: - - // not implemented - ImageView( const ImageView& ); - ImageView& operator=( const ImageView& ); - - Dali::Animation mRotateAnimation; -}; - -} // namespace - -#endif // __DALI_GALLERY_VIEW_H__ diff --git a/slideshow/src/dali_effect/include/ivug-includes.h b/slideshow/src/dali_effect/include/ivug-includes.h deleted file mode 100644 index 39212bc..0000000 --- a/slideshow/src/dali_effect/include/ivug-includes.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -#ifndef __IVUG_INCLUDES_H__ -#define __IVUG_INCLUDES_H__ - -// EXTERNAL INCLUDES -#include -#include - -#define DALI_IMAGE_DIR "/usr/apps/com.samsung.ug-image-viewer-efl/res/images/" - -namespace Imageview3D -{ - /** - * Enumeration for view orientation - */ - enum Orientation{ - PORTRAIT, ///< hw buttons on the bottom - LANDSCAPE, ///< hw buttons on the left - PORTRAIT_INVERSE, ///< hw buttons on the top - LANDSCAPE_INVERSE ///< hw buttons on the right - }; - - /** - * Helper to convert between view & control orientations. - * @param[in] The view orientation. - * @return The control orientation. - */ - Dali::Toolkit::ControlOrientation::Type GetControlOrientation(Orientation orientation); - void PrintCurrentTime(); - // Nav bar constants - const float MARGIN_X = 0.0; /*margin from left and right of stage*/ - const float MARGIN_Y = 0.0; /*margin from top of stage*/ - const float NAVIGATION_BAR_TO_SCREEN_HEIGHT_RATIO = 15.8; /*Used to work out height of Navi bar when resoultion changes*/ - const float NAVIGATION_BUTTONS_TO_SCREEN_HEIGHT_RATIO = 15.8; /*As above but for buttons*/ - const float NAVIGATION_BUTTONS_TO_SCREEN_WIDTH_RATIO = 5.77; /*As above but for buttons*/ - const int TRANSITIONTIME = 1200; //more than 1 second --effect show time (milliseconds) - const float SECONDTIME = 1000.0f; // 1second - const float RIPPLEAMPLITUDE = 20.0f; //used for ripple - // Detail view film-strip - const float FILMSTRIP_HEIGHT_TO_SCREEN_HEIGHT_RATIO = 8; - /* Scale animation duration for face effect */ - const int FACE_SCALE_DURATION = 600; - const int FACE_DEFAULT_GAP_TIME = 200; - const float FACE_DEFAULT_SCALE = 2.0; - const int SECOND_MS = 1000; - const int SMALL_TRANSITIONTIME = 600; -} - -#endif /* __INCLUDES_H__ */ diff --git a/slideshow/src/dali_effect/include/ivug-slideshow-control.h b/slideshow/src/dali_effect/include/ivug-slideshow-control.h deleted file mode 100644 index ab83de4..0000000 --- a/slideshow/src/dali_effect/include/ivug-slideshow-control.h +++ /dev/null @@ -1,181 +0,0 @@ -#ifndef __DALI_IVUG_SLIDESHOW_CONTROL_H__ -#define __DALI_IVUG_SLIDESHOW_CONTROL_H__ - -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -// EXTERNAL INCLUDES -#include -#include -#include -#include "ivug-includes.h" -#include "ivug-dali-util.h" -#include "ivug-slideshow-priv.h" -// INTERNAL INCLUDES -#include "ivug-medialist.h" -//suport video playback -#include - - -namespace Imageview3D -{ - -// FORWARD DECLARES -class SlideshowEffect; - -/** - * Slide show control logic - */ -class SlideshowControl -{ -public: // API - - /** - * Constructor - * @param parent actor - * @param images to display - * @param effects to use - */ - SlideshowControl( Dali::Actor parent, - SlideShow *ss_handle, - const std::vector< boost::shared_ptr< SlideshowEffect > >& effects ); - - /** - * Destructor - */ - ~SlideshowControl(); - - /** - * Play the slide show - */ - void Play(); - - /** - * Sets the starting image index - */ - void SetStartIndex( unsigned int startIndex ); - - /** - * Gets the current image index - */ - unsigned int GetCurrentIndex() const; - - /** - * Pause the slide show. Current transition will still finish before control is paused. - */ - void Pause(); - - /** - * @return true if slideshow is paused - */ - bool IsPaused(); - - /** - * Resume the slide show. Slide show resumes from transition to next image. - */ - void Resume(); - - /** - * Stop the slide show - */ - void Stop(); - - /** - * Sets the playing area size for slideshow - * @param size new size for the slideshow - */ - void SetSize( Dali::Size size, int Orientation); - void CreatePixmapImage(); - void DestroyXPixmap(); - void EndVideoPlay(); - -public: // Signal handlers - - bool OnClick( Dali::Actor actor, const Dali::TouchEvent& event ); - void NewViewAndTransitionTimer(void); - void StopViewAndTransitionTimer(void); - void SetViewAndTransitionTime(int time); - -private: // Implementation - - void LoadNextImage(); - void ImageLoaded(); - bool TimerTick(); - void StartTransition(); - bool TransitionCompleted(); - void FitViewActorAndBorders(); - bool FirstFaceCompleted(); - void StartVideoPlay(const char *path); - void CreateXHPixmap(); - - // Not implemented, copy constructor and assignment operator - SlideshowControl( const SlideshowControl& copy ); - SlideshowControl& operator=( const SlideshowControl& copy ); - -private: // Data - - Dali::Actor mParent; - SlideShow *mSSHandle; - const std::vector< boost::shared_ptr< SlideshowEffect > >& mEffects; - - Dali::Actor mSlideshowRoot; - Dali::Layer mLayers[ 2 ]; - unsigned int mCurrentLayer; - Dali::ImageActor mInView; - Dali::ImageActor mFadingIn; - Dali::ImageActor mBorder1; //Top border in the PORTRAIT orientation. Left border in LANDSCAPE orientation. - Dali::ImageActor mBorder2; //Bottom border in the PORTRAIT orientation. Right border in LANDSCAPE orientation. - Dali::Image mNextImage; - Dali::Connection mConnection; - Dali::BitmapImage mSolid; - - Dali::Size mSlideshowSize; - int mCurrentIndex; - int mCurrentEffect; - - bool mPlaying; - bool mImageReady; - bool mTimerReady; - bool mPaused; - bool mFirstImage; - - Dali::Timer mViewTimer; - Dali::Timer mTransitionTimer; - Dali::Timer mFirstFaceTimer; - - Dali::Animation mFadeAnimation; - Imageview3D::Orientation mOrientation; - int mViewTime; - int mTransitionTime; - int mVideoTime; - bool mShowRepeat; - bool mbFinishPlay; - int mFaceCount; - int mCurrentFace; - bool mbFaceEffect; - Media_Item *mCurItem; - bool mCurIsVideo; - bool mPreIsVideo; - - //for video play - Dali::ImageActor mImageActor; - Dali::Image mVideoImage; - Dali::Animation mAnimVideo; - Ecore_X_Pixmap mXPixmap; - Ecore_Event_Handler *mEventHandler; - Ecore_X_Damage mDamage; - Dali::Layer mVideoLayer; - float mVideoWidth; - float mVideoHeight; -}; - -} // namespace Imageview3D - -#endif // __DALI_DEMO_SLIDESHOW_CONTROL_H__ diff --git a/slideshow/src/dali_effect/include/ivug-slideshow-effect.h b/slideshow/src/dali_effect/include/ivug-slideshow-effect.h deleted file mode 100644 index e968480..0000000 --- a/slideshow/src/dali_effect/include/ivug-slideshow-effect.h +++ /dev/null @@ -1,157 +0,0 @@ -#ifndef __DALI_IVUG_SLIDESHOW_EFFECT_H__ -#define __DALI_IVUG_SLIDESHOW_EFFECT_H__ - -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -// EXTERNAL INCLUDES -#include -#include "ivug-slideshow.h" - -// INTERNAL INCLUDES -#define RIPPLE_FADE_EFFECT_NAME "ripple-fade" -#define DISSOLVE_EFFECT_NAME "dissolve" -#define ZOOM_EFFECT_NAME "zoom" -#define FACE_EFFECT_NAME "face-slide-show" -#define SPLIT_EFFECT_NAME "split" -#define SWIRL_EFFECT_NAME "swirl" -#define WATER_RIPPLE_EFFECT_NAME "water-ripple" -#define SLIDE_EFFECT_NAME "slide" -#define IRIS_EFFECT_NAME "iris" -#define SQUARE_DISSOLVE_EFFECT_NAME "square-dissolve" - -namespace Imageview3D -{ - -/** -* Slide show effect interface -*/ -class SlideshowEffect -{ -public: // API - - /** - * Virtual destructor as this is a base - * Derived classes can be deleted using this interface - */ - virtual ~SlideshowEffect() {} - - /** - * Gets the name of the effect - * @return name of the effect - */ - virtual std::string Name() = 0; - - /** - * Initializes the effect - * @param size of the slideshow area - */ - virtual void Initialize( Dali::Vector3 size ) = 0; - - /** - * Start the viewing of the image - * @param imageactor that is in view - * @param duration of the viewing in milliseconds - */ - virtual void StartView( Dali::ImageActor imageactor, unsigned int duration ) = 0; - - /** - * Start the transitioning from oldImage to newImage - * @param oldActor that has been viewed. Note! this may also be NULL if its the first transition - * @param newActor that should be revealed - * @param duration of the transition in milliseconds - * @return true if crossfade should be done on actors - */ - virtual bool StartTransition( Dali::ImageActor oldActor, - Dali::ImageActor newActor, - unsigned int duration, - int face_count) = 0; - - /** - * Transitioning from oldImage to newImage has completed - * @param oldActor that has been viewed. Note! this may also be NULL if its the first transition - * @param newActor that should now be visible - */ - virtual void TransitionCompleted( Dali::ImageActor oldActor, Dali::ImageActor newActor ) = 0; - - virtual void Stop( void ) = 0; - - virtual void SetImageSize(const char *path) = 0; - -protected: - - // constructor for derived classes, dont allow stack allocation - SlideshowEffect() {} - -private: // Not implemented - SlideshowEffect( const SlideshowEffect& ); - SlideshowEffect& operator=( const SlideshowEffect& ); - -}; - -namespace EffectFactory -{ -/** - * Creates a new RippleFade effect - * @param amplitude of the wave -*/ -SlideshowEffect* NewRippleFadeEffect( float amplitude = 4.0f ); - -/** - * Creates a new Dissolve effect - * @param randomize the dissolve -*/ -SlideshowEffect* NewDissolveFadeEffect( bool randomize = false ); - -/** - * Creates a new Zoom effect -*/ -SlideshowEffect* NewZoomEffect(); - -/** - * Creates a new Face effect -*/ -SlideshowEffect* NewFaceEffect(SlideShow *ss_handle); - -/** - * Creates a new Split effect -*/ -SlideshowEffect* NewSplitEffect(); - -/** - * Creates a new swirl effect -*/ -SlideshowEffect* NewSwirlEffect( bool warp = false ); - -/** - * Creates a new 2D ripple effect -*/ -SlideshowEffect* NewWaterRippleEffect(); - -/** - * Creates a new Slide effect -*/ -SlideshowEffect* NewSlideEffect(); - -/** - * Creates a newIris effect -*/ -SlideshowEffect* NewIrisEffect(); - -/** - * Creates a newSquare effect -*/ -SlideshowEffect* NewSquareEffect(); - -} - -} // namespace Imageview3D - -#endif // __DALI_DEMO_SLIDESHOW_EFFECT_H__ diff --git a/slideshow/src/dali_effect/include/ivug-slideshow-face.h b/slideshow/src/dali_effect/include/ivug-slideshow-face.h deleted file mode 100644 index fdcd334..0000000 --- a/slideshow/src/dali_effect/include/ivug-slideshow-face.h +++ /dev/null @@ -1,109 +0,0 @@ -#ifndef __DALI_IVUG_SLIDESHOW_FACE_EFFECT_H__ -#define __DALI_IVUG_SLIDESHOW_FACE_EFFECT_H__ - -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -using namespace Dali; -using namespace Dali::Toolkit; -using namespace std; - -namespace Imageview3D -{ - -/** -* Slide show effect interface -*/ -class SlideshowFaceEffect : public SlideshowEffect -{ -public: // API - - /** - * Virtual destructor as this is a base - * Derived classes can be deleted using this interface - */ - virtual ~SlideshowFaceEffect() {} - // constructor for derived classes, dont allow stack allocation - SlideshowFaceEffect(SlideShow *ss_handle); - - /** - * Gets the name of the effect - * @return name of the effect - */ - virtual std::string Name(); - - /** - * Initializes the effect - * @param size of the slideshow area - */ - void Initialize(Dali::Vector3 size); - - /** - * Start the viewing of the image - * @param imageactor that is in view - * @param duration of the viewing in milliseconds - */ - void StartView(Dali::ImageActor imageactor, unsigned int duration); - - /** - * Start the transitioning from oldImage to newImage - * @param oldActor that has been viewed. Note! this may also be NULL if its the first transition - * @param newActor that should be revealed - * @param duration of the transition in milliseconds - * @return true if crossfade should be done on actors - */ - bool StartTransition( Dali::ImageActor oldActor, - Dali::ImageActor newActor, - unsigned int duration, - int face_count); - - /** - * Transitioning from oldImage to newImage has completed - * @param oldActor that has been viewed. Note! this may also be NULL if its the first transition - * @param newActor that should now be visible - */ - void TransitionCompleted( Dali::ImageActor oldActor, - Dali::ImageActor newActor); - - void Stop( void ); - void TransitionNextFace(); - void SetFaceScale(float value); - void SetGapTime(int value); - void SetImageSize(const char *path); - -private: // Not implemented - SlideshowFaceEffect(const SlideshowEffect&); - bool GetScaleAttribute(double divi_h, double divi_w); - void MoveFaceToCenter(void); - -private: // Data - - Animation mAnimation; - Dali::ImageActor mCurrentActor; - int mFaceRecordIndex; - int mFaceRectX; - int mFaceRectY; - int mFaceRectW; - int mFaceRectH; - SlideShow *mSSHandle; - float mFaceScale; - int mGapTime; - int mImgWith; - int mImgHeight; -}; - -} // namespace Imageview3D - -#endif // __DALI_DEMO_SLIDESHOW_EFFECT_H__ - diff --git a/slideshow/src/dali_effect/include/ivug-view-stack-info.h b/slideshow/src/dali_effect/include/ivug-view-stack-info.h deleted file mode 100644 index 370d312..0000000 --- a/slideshow/src/dali_effect/include/ivug-view-stack-info.h +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef __IVUG_VIEWSTACKINFO_H__ -#define __IVUG_VIEWSTACKINFO_H__ - -/* - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include "ivug-medialist.h" -#include "ivug-effect.h" - -namespace Imageview3D -{ - -class ImageView; - -typedef std::vector ViewStack; - -/** - * ViewStackInfo manages a stack of views and accompanying - * stack (tool)-specific state information. - */ -class ViewStackInfo -{ -// Constructor/Destructor -public: - /** - * Creates a View stack, with a unique name and access to a set of images. - * @param[in] name The name of this view stack for identification purposes. - * @param[in] images Pointer to the image database to be used within this stack. - */ - ViewStackInfo(const std::string name, const Media_List* images); - - /** - * Copy constructor - * @param[in] viewStackInfo A reference to the object to copy. - */ - ViewStackInfo(const ViewStackInfo& viewStackInfo); - - /** - * Copy Assignment operator - */ - ViewStackInfo& operator=(const ViewStackInfo& rhs); - - /** - * Destructor - */ - ~ViewStackInfo(); - // Methods -public: - - /** - * Gets the top-most view on the stack - * - * @return Top-most view on stack - */ - ImageView *GetTopView() const; - - /** - * Gets the previous (second from top) view on the stack - * - * @return Previous view on stack - */ - ImageView *GetPreviousView() const; - - /** - * Pushes a view onto the stack. - * - * @param[in] view View to push onto stack. - */ - void PushView(ImageView *view); - - /** - * Pops a view from the stack. - * - * @return The popped view is returned - */ - ImageView *PopView(); - - /** - * Gets the number of views on the stack. - * - * @return The size of the stack - */ - size_t GetSize() const { return mViewStack.size(); } - - /** - * Sets visibility of stack (all the views within the stack - * have their visibility altered) - * @param[in] visible Whether to show (true) or hide (false) - */ - void SetVisible(bool visible); - - /** - * Get the name of this stack. - * @return the name of this stack. - */ - std::string GetName() const { return mName; } - -private: - - ViewStack mViewStack; ///< History of views this stack has visited. - std::string mName; ///< Name of stack for identification/debugging purposes. - const Media_List* mAllImagesList; ///< The image list that this stack is referring to. - -}; - -} // namespace Imageview3D - -#endif // __GALLERY_VIEWSTACKINFO_H__ diff --git a/slideshow/src/dali_effect/include/ivug-water-ripple-effect.h b/slideshow/src/dali_effect/include/ivug-water-ripple-effect.h deleted file mode 100644 index 26fcbdb..0000000 --- a/slideshow/src/dali_effect/include/ivug-water-ripple-effect.h +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef __IVUG_WATER_EFFECT_RIPPLE2D_H__ -#define __IVUG_WATER_EFFECT_RIPPLE2D_H__ - -/* -Copyright (c) 2000-2012 Samsung Electronics Co., Ltd All Rights Reserved - -This file is part of Dali Toolkit - -PROPRIETARY/CONFIDENTIAL - -This software is the confidential and proprietary information of -SAMSUNG ELECTRONICS ("Confidential Information"). You shall not -disclose such Confidential Information and shall use it only in -accordance with the terms of the license agreement you entered -into with SAMSUNG ELECTRONICS. - -SAMSUNG make no representations or warranties about the suitability -of the software, either express or implied, including but not limited -to the implied warranties of merchantability, fitness for a particular -purpose, or non-infringement. SAMSUNG shall not be liable for any -damages suffered by licensee as a result of using, modifying or -distributing this software or its derivatives. -*/ - -// EXTERNAL INCLUDES - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -namespace Toolkit -{ - -/** - * ShaderEffectRipple2D is a custom shader effect to achieve 2d ripple effects on Image actors - */ -class WaterEffectRipple2D : public ShaderEffect -{ -public: - - /** - * Create an uninitialized ShaderEffectRipple2D; this can be initialized with ShaderEffectRipple2D::New() - * Calling member functions with an uninitialized Dali::Object is not allowed. - */ - WaterEffectRipple2D(); - - /** - * Virtual destructor. - */ - virtual ~WaterEffectRipple2D(); - - /** - * Create an initialized ShaderEffectRipple2D. - * @return A handle to a newly allocated Dali resource. - */ - static WaterEffectRipple2D New(); - - /** - * Set the amplitude of the 2d ripple. - * @param[in] amplitude The amplitude in float. - */ - void SetAmplitude(float amplitude); - - /** - * Set the time duration for the 2d ripple. - * @param[in] time The time duration in float. - */ - void SetTime(float time); - - /** - * Get the name for the amplitude property - * @return A std::string containing the property name - */ - const std::string& GetAmplitudePropertyName() const; - - /** - * Get the name for the time property - * which can be used in Animation API's - * @return A std::string containing the property name - */ - const std::string& GetTimePropertyName() const; - /** - * Set the texture size of the 2d ripple. - * @param[in] textureSize The texture size in Vector2. - */ - void SetTextureSize(const Vector2& textureSize); - - /** - * Get the name for the texture size property - * @return A std::string containing the property name - */ - const std::string& GetTextureSizePropertyName() const; - - -private: - WaterEffectRipple2D(ShaderEffect handle); - -}; - -} // namespace Toolkit - -} // namespace Dali - -#endif // __DALI_TOOLKIT_SHADER_EFFECT_RIPPLE2D_H__ - diff --git a/slideshow/src/dali_effect/src/ivug-app-navigation.cpp b/slideshow/src/dali_effect/src/ivug-app-navigation.cpp deleted file mode 100644 index 26a7d4c..0000000 --- a/slideshow/src/dali_effect/src/ivug-app-navigation.cpp +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -#include -#include "ivug-app-navigation.h" -#include "ivug-dali-slideshow-view.h" -#include "ivug-debug.h" -#include "ivug-slideshow-priv.h" - -//#include "zoomable-gallery-view/zoomable-gallery-view.h" - -using namespace Dali; -using namespace Imageview3D; - -namespace // unnamed namespace begin -{ - -typedef ImageView* (*ViewFunc)(); - -/* ShowViewInfo (IMAGE_VIEWS) Table - * - * contains list of view ids and their associated class instances. - */ - -struct ShowViewInfo -{ - unsigned int mId; // view id - ViewFunc mFunc; // pointer to static New method -}; - -const ShowViewInfo SHOW_VIEWS[] = -{ - { SLIDESHOW_VIEW, SlideshowView::New }, // '>' SlideShow (Images fade/swirl effect) -}; - -const size_t NUMBER_OF_VIEWS = sizeof SHOW_VIEWS / sizeof SHOW_VIEWS[0]; - -} -const unsigned int AppNavigation::NAVIGATION_TIME_MS = 500; -const float AppNavigation::NAVIGATION_TIME_S = ((float)NAVIGATION_TIME_MS)/1e3; - -AppNavigation::AppNavigation( Dali::Adaptor& application ) -: mApplication( application ), - mClearNavigationHistory (false), - mCurrentStackId(0) -{ - IVUG_FUNC_ENTER(); - mNavigationEndTimer = Timer::New( NAVIGATION_TIME_MS ); - IVUG_FUNC_LEAVE(); - // check that there is a tool info entry for every tool - //DALI_ASSERT( NUMBER_OF_TOOLS == TOOL_INFO_SIZE ); -} - -AppNavigation::~AppNavigation() -{ - // Views have to be deleted before the application quits - // and core is deleted (otherwise it seg faults). - IVUG_FUNC_ENTER(); - mViews.clear(); - IVUG_FUNC_LEAVE(); -} - -void AppNavigation::CreateViews(SlideShow *ss_handle) -{ - IVUG_FUNC_ENTER(); - if(!ss_handle || (!ss_handle->media_list)){ - return; - } - int image_count = ivug_medialist_get_count(ss_handle->media_list); - MSG_IVUG_HIGH("images count = %d", image_count); - // Setup map from view id to view - for (unsigned i = 0; i < NUMBER_OF_VIEWS; ++i) { - ViewPtr view = ViewPtr(SHOW_VIEWS[i].mFunc()); - if (view){ - mViews[SHOW_VIEWS[i].mId] = view; - } - } - /* create ViewStackInfo */ - mViewStacks.push_back(ViewStackInfoPtr(new ViewStackInfo("Pictures", ss_handle->media_list))); - /* Set up first view in each stack */ - StackPush(0, SLIDESHOW_VIEW); - - IVUG_FUNC_LEAVE(); -} - -void AppNavigation::InitializeViews(SlideShow *ss_handle) -{ - IVUG_FUNC_ENTER(); - if(NULL == ss_handle){ - return; - } - // Setup map from view id to view - for (unsigned i = 0; i < NUMBER_OF_VIEWS; ++i) { - ViewPtr view = mViews[SHOW_VIEWS[i].mId]; - if (view){ - view->Initialize(this, ss_handle); - } - } - IVUG_FUNC_LEAVE(); -} - - -// Pushes the view on to the correct navigation stack. Also creates a navigation stack -// if one doesn't exist at the last location -void AppNavigation::StackPush(size_t stackIndex, ViewId viewId) -{ - DALI_ASSERT_ALWAYS(stackIndex < mViewStacks.size()); - - ViewIter iter = mViews.find(viewId); - if(iter != mViews.end()) { - ImageView* view = iter->second.get(); - DALI_ASSERT_ALWAYS(view != NULL); - - ViewStackInfo& viewStackInfo = GetViewStackInfoByIndex(stackIndex); - - viewStackInfo.PushView(view); - view->SetViewStackInfo(&viewStackInfo); - /* only display views in the current stack */ - if(stackIndex != mCurrentStackId) { - view->SetVisible(false); - } - } -} - -void AppNavigation::StartImageView(ImageView* view) -{ - if(!view) { - return; - } - // start up view. - view->EnterForwardBegin( AppNavigation::NAVIGATION_TIME_S ); - view->EnterForwardEnd(); -} - - -void AppNavigation::Rotate(Imageview3D::Orientation orientation) -{ - ViewIter it = mViews.begin(); - - while (it != mViews.end() ) { - it->second->SetOrientation(orientation); - ++it; - } -} - -void AppNavigation::NavigateForward(Imageview3D::ViewId nextViewID) -{ - // Short-circuit if we're already navigating - if (mNavigationEndConnection.connected()) { - return; - } - - ImageView* nextView = NULL; - - ViewIter iter = mViews.find(nextViewID); - ViewStackInfo& viewStackInfo = GetCurrentViewStackInfo(); - - if (iter != mViews.end()) { - nextView = iter->second.get(); - } - - if (nextView) { - nextView->SetViewStackInfo(&viewStackInfo); - OnFocusView(nextView); - - // and the current one that's it's just been deactivated by the new one - // going forward - viewStackInfo.GetTopView()->LeaveForwardBegin( AppNavigation::NAVIGATION_TIME_S ); - - // tell the next view that it's just been activated, and going forward - nextView->EnterForwardBegin( AppNavigation::NAVIGATION_TIME_S ); - - // save the new view - viewStackInfo.PushView(nextView); - - //CheckForExitButton(); - - // Allow some time for enter/leave animations - mNavigationEndConnection.disconnect(); - mNavigationEndConnection = mNavigationEndTimer.SignalTick().Connect( this, &AppNavigation::OnNavigateForwardEnd ); - mNavigationEndTimer.Start(); - - //Imageviewer::RigNewLighting(nextView->GetLighting(), NAVIGATION_TIME_MS); - } -} - -void AppNavigation::NavigateBack() -{ - // Short-circuit if we're already navigating - if (mNavigationEndConnection.connected()) { - return; - } - MSG_IVUG_HIGH("NavigateBack"); - - ViewStackInfo& viewStack = GetCurrentViewStackInfo(); - - // if there is only one view on the stack, we are back at the start - if (viewStack.GetSize() <= 1) { - // last back means exit the application - //mApplication.Stop(); - return; - } - - // Tell the current view that it has just been deactivated by going backwards. - ImageView* currentView = viewStack.GetTopView(); - currentView->LeaveBackwardBegin( AppNavigation::NAVIGATION_TIME_S ); - - // Tell the previous view that it has been made active, but by going backwards. - ImageView* newView = viewStack.GetPreviousView(); - OnFocusView(newView); - - // Take off the top view, and push back on again, this is done as - // CheckForExitButton updates based on current stack size. - ImageView *oldView = viewStack.PopView(); - //CheckForExitButton(); - viewStack.PushView(oldView); - - newView->EnterBackwardBegin( AppNavigation::NAVIGATION_TIME_S ); - - // Allow some time for enter/leave animations - mNavigationEndConnection.disconnect(); - mNavigationEndConnection = mNavigationEndTimer.SignalTick().Connect( this, &AppNavigation::OnNavigateBackwardEnd ); - mNavigationEndTimer.Start(); - - //Imageviewer::RigNewLighting(newView->GetLighting(), NAVIGATION_TIME_MS); -} - -void AppNavigation::OnFocusView(ImageView *activeView) -{ - // set the title - //std::string text = activeView->GetTitleText(); - //Imageviewer::SetTitleBarText(text); - activeView->SetVisible(true); - activeView->FocusView(); -} - -bool AppNavigation::OnNavigateForwardEnd() -{ - ViewStackInfo& viewStack = GetCurrentViewStackInfo(); - - // Tell the newly deactivated view it's finished animating (previous view) - if(viewStack.GetSize() > 1) { - ImageView* oldView = viewStack.GetPreviousView(); - - oldView->LeaveForwardEnd(); - oldView->SetVisible(false); - } - - // Tell the newly active view it's finished animating (current view) - ImageView* newView = viewStack.GetTopView(); - - newView->EnterForwardEnd(); - mNavigationEndConnection.disconnect(); - return false; -} - -bool AppNavigation::OnNavigateBackwardEnd() -{ - ViewStackInfo& viewStack = GetCurrentViewStackInfo(); - ImageView* oldView = viewStack.GetTopView(); - - // Tell the newly deactivated view - oldView->LeaveBackwardEnd(); - // Set view's stack info to NULL, to avoid potentially undefined behaviour. - oldView->SetViewStackInfo(NULL); - viewStack.PopView(); - - if(viewStack.GetSize() > 0) { - // Tell the newly active view - ImageView* newView = viewStack.GetTopView(); - newView->EnterBackwardEnd(); - } - - mNavigationEndConnection.disconnect(); - return false; -} - -/*void AppNavigation::CheckForExitButton() -{ - ViewStackInfo& viewStack = GetCurrentViewStackInfo(); - - if( 1 == viewStack.GetSize() ) { - Gallery::SetBackButtonStyle( BACK_BUTTON_STYLE_EXIT_APPLICATION ); - } else { - Gallery::SetBackButtonStyle( BACK_BUTTON_STYLE_PREVIOUS_VIEW ); - } -}*/ - -void AppNavigation::HideStack(size_t stackIdx) -{ - ViewStackInfo& viewStack = GetViewStackInfoByIndex(stackIdx); - viewStack.SetVisible(false); -} - -void AppNavigation::ShowStack(size_t stackIdx) -{ - ViewStackInfo& viewStack = GetViewStackInfoByIndex(stackIdx); - viewStack.SetVisible(true); -} - -ImageView *AppNavigation::GetViewById(int viewId) -{ - ViewIter iter = mViews.find(viewId); - if (iter != mViews.end()) { - ImageView* view = iter->second.get(); - return view; - } - return NULL; -} - - diff --git a/slideshow/src/dali_effect/src/ivug-dali-imageview.cpp b/slideshow/src/dali_effect/src/ivug-dali-imageview.cpp deleted file mode 100644 index c4d589d..0000000 --- a/slideshow/src/dali_effect/src/ivug-dali-imageview.cpp +++ /dev/null @@ -1,324 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ -#include "ivug-dali-imageview.h" -#include "ivug-constraints.h" -#include "ivug-debug.h" -#include "ivug-dali-slideshow-view.h" - -namespace -{ - const float BACKGROUND_DEPTH_MODIFIER(200); -} - -Imageviewer::Imageviewer(Adaptor& application, SlideShow *ss_handle) - : mAppNavigation(application), - mApplication(application), - mSSHandle(ss_handle) -{ - IVUG_FUNC_ENTER(); - //application.SignalResize().Connect(this, &Imageviewer::Resize); - - IVUG_FUNC_LEAVE(); -} - -void Imageviewer::SignalResizeSend(void) -{ - IVUG_FUNC_ENTER(); - //mApplication.SignalResize().Connect(this, &Imageviewer::Resize); - Resize(mApplication); -} - -void Imageviewer::SetSize(float width, float height) -{ - IVUG_FUNC_ENTER(); - MSG_IVUG_HIGH("width=%f, height=%f", width, height); - - mWidth = width; - mHeight = height; - - IVUG_FUNC_LEAVE(); -} - -void Imageviewer::SetPosition(float x, float y) -{ - IVUG_FUNC_ENTER(); - - mX = x; - mY = y; - mNavigationBarHeight = y; - - IVUG_FUNC_LEAVE(); -} - - -Imageviewer::~Imageviewer() -{ - IVUG_FUNC_ENTER(); - - mBackgroundLayer = NULL; - mMainLayer = NULL; - mNavigationBarLayer = NULL; - IVUG_FUNC_LEAVE(); -} - - -void Imageviewer::Resize(Adaptor& app) -{ - IVUG_FUNC_ENTER(); - - if(!mBackgroundLayer) { - /* Create layer */ - CreateLayers(); - /* Create background */ - CreateBackground(); - /* Create Navigation before Views as buttons required */ - CreateNavigationBar(); - if(mSSHandle) { - //create view - mAppNavigation.CreateViews(mSSHandle); - //init view - ImageView *view = mAppNavigation.GetViewById(SLIDESHOW_VIEW); - mAppNavigation.InitializeViews(mSSHandle); - //start view - if(view) { - mAppNavigation.StartImageView(view); - } - } - } - - IVUG_FUNC_LEAVE(); -} - -void Imageviewer::CreateLayers() -{ - IVUG_FUNC_ENTER(); - - /* the parent of the layers is the root, which is the size of the stage */ - MSG_IVUG_HIGH("mWidth=%f, mHeight=%f", mWidth, mHeight); - mBackgroundLayer = Layer::New(); - mBackgroundLayer.SetSize(mWidth, mHeight); - mBackgroundLayer.SetPosition(mX, mY); - mBackgroundLayer.SetAnchorPoint(AnchorPoint::CENTER); - mBackgroundLayer.SetParentOrigin(ParentOrigin::CENTER); - mBackgroundLayer.SetName("background"); - - mMainLayer = Layer::New(); - mMainLayer.SetSize(mWidth, mHeight); - mMainLayer.SetPosition(mX, mY); - mMainLayer.SetAnchorPoint(AnchorPoint::CENTER); - mMainLayer.SetParentOrigin(ParentOrigin::CENTER); - mMainLayer.SetName("main"); - - mNavigationBarLayer = Layer::New(); - mNavigationBarLayer.SetAnchorPoint(AnchorPoint::CENTER); - mNavigationBarLayer.SetParentOrigin(ParentOrigin::CENTER); - mNavigationBarLayer.SetSize(mWidth, mHeight); - mNavigationBarLayer.SetPosition(mX, mY); - mNavigationBarLayer.SetName("navigation"); - - //Dali::Stage::GetCurrent().Add(mBackgroundLayer); - Dali::Stage::GetCurrent().Add(mMainLayer); - //Dali::Stage::GetCurrent().Add(mNavigationBarLayer); - IVUG_FUNC_LEAVE(); -} - -void Imageviewer::AddToLayer(int layer, Dali::Actor actor) -{ - IVUG_FUNC_ENTER(); - /* todo replace switch with an index to an array of layers */ - switch (layer) { - case BACKGROUND_LAYER: - mBackgroundLayer.Add(actor); - break; - case MAIN_VIEW_LAYER: - mMainLayer.Add(actor); - break; - case NAVIGATION_BAR_LAYER: - mNavigationBarLayer.Add(actor); - break; - default: - MSG_SLIDER_WARN ("Gallery::AddToLayer LAYER NOT FOUND"); - } - IVUG_FUNC_LEAVE(); -} - -void Imageviewer::RemoveFromLayer( int layer, Dali::Actor actor ) -{ - IVUG_FUNC_ENTER(); - /* todo replace switch with an index to an array of layers */ - switch (layer) { - case BACKGROUND_LAYER: - mBackgroundLayer.Remove(actor); - break; - case MAIN_VIEW_LAYER: - mMainLayer.Remove(actor); - break; - case NAVIGATION_BAR_LAYER: - mNavigationBarLayer.Remove(actor); - break; - default: - MSG_SLIDER_WARN ("Imageviewer::RemoveFromLayer LAYER NOT FOUND"); - } - - if (actor.GetParent()) { - Dali::Stage::GetCurrent().Remove(actor); - } - IVUG_FUNC_LEAVE(); -} - -void Imageviewer::RemoveFromLayerMain(void) -{ - IVUG_FUNC_ENTER(); - /* todo replace switch with an index to an array of layers */ - - Dali::Stage::GetCurrent().Remove(mMainLayer); - Dali::Stage::GetCurrent().Remove(mBackgroundLayer); - Dali::Stage::GetCurrent().Remove(mNavigationBarLayer); - - IVUG_FUNC_LEAVE(); -} - - -Layer Imageviewer::GetLayer(int id) -{ - IVUG_FUNC_ENTER(); - - Layer layer; - switch (id) { - case BACKGROUND_LAYER: - layer = mBackgroundLayer; - break; - case MAIN_VIEW_LAYER: - layer = mMainLayer; - break; - case NAVIGATION_BAR_LAYER: - layer = mNavigationBarLayer; - break; - default: - MSG_SLIDER_WARN ("Imageviewer::GetLayer LAYER NOT FOUND"); - } - - IVUG_FUNC_LEAVE(); - return layer; -} - -void Imageviewer::SetScreenFurnitureVisibility(bool enable) -{ - IVUG_FUNC_ENTER(); - - Animation& animation = mFadeAnimation; - animation = Animation::New(0.5f); - /* leave opacity to target once animation is done */ - animation.SetEndAction(Animation::Bake); - /* linear fade in/out */ - float targetAlpha = enable ? 1.0f : 0.0f; - if (mNavigationBar) - animation.OpacityTo(mNavigationBar, targetAlpha); - - if (mNavigationBarBg) - animation.OpacityTo(mNavigationBarBg, targetAlpha); - - if (mBackground) - animation.OpacityTo(mBackground, targetAlpha); - animation.Play(); - - IVUG_FUNC_LEAVE(); -} - -float Imageviewer::GetNaviBarHeight() -{ - IVUG_FUNC_ENTER(); -#if 0 - Vector3 stageSize = Stage::GetCurrent().GetSize(); - - mNavigationBarHeight = stageSize.y / NAVIGATION_BAR_TO_SCREEN_HEIGHT_RATIO; -#endif - /* Use Naviframe height got from Gallery App */ - IVUG_FUNC_LEAVE(); - return mNavigationBarHeight; -} - -void Imageviewer::SetTitleBarText(std::string newText) -{ - IVUG_FUNC_ENTER(); - //ivInstance->mTitleText.SetText(newText); - /* TODO: this updates the text sizes */ - IVUG_FUNC_LEAVE(); -} - -void Imageviewer::CreateBackground() -{ - IVUG_FUNC_ENTER(); - - Image image = Image::New(DALI_IMAGE_DIR "T01_3d_view_bg.png"); - mBackground = ImageActor::New(image); - - Vector2 stageSize = Stage::GetCurrent().GetSize(); - mBackground.SetSize(stageSize.width, stageSize.height); - /* background in the middle */ - mBackground.SetAnchorPoint(AnchorPoint::CENTER); - mBackground.SetParentOrigin(ParentOrigin::CENTER); - - /* add to layer and stage */ - AddToLayer(BACKGROUND_LAYER, mBackground); - - IVUG_FUNC_LEAVE(); -} - -void Imageviewer::CreateNavigationBar() -{ - IVUG_FUNC_ENTER(); - mNavigationBar = Actor::New(); - /* constrain the navi bar to be the width of its parent and constant height */ - //Constraint constraint = ParentConstraint::Size::New(ParentWidthConstantHeight(GetNaviBarHeight())); - Constraint constraint = Constraint::New( Actor::SIZE,ParentSource( Actor::SIZE ),ParentWidthConstantHeight(GetNaviBarHeight())); - mNavigationBar.ApplyConstraint(constraint ); - mNavigationBar.SetParentOrigin(ParentOrigin::TOP_CENTER); - mNavigationBar.SetAnchorPoint(AnchorPoint::TOP_CENTER); - /* add to layer and stage */ - AddToLayer(NAVIGATION_BAR_LAYER, mNavigationBar); - IVUG_FUNC_LEAVE(); -} - -AppNavigation& Imageviewer::GetAppNavigation() -{ - IVUG_FUNC_ENTER(); - - return mAppNavigation; -} - -void Imageviewer::ResumeViewAndTransitionTimer() -{ - IVUG_FUNC_ENTER(); - ImageView *view_item = mAppNavigation.GetViewById(SLIDESHOW_VIEW); - SlideshowView *view= dynamic_cast(view_item); - if(view) { - view->SlideShowResume(); - } - IVUG_FUNC_LEAVE(); -} - -void Imageviewer::OrientationChanged(const int orientation) -{ - // work out the new orientation - IVUG_FUNC_ENTER(); - Orientation newOrientation = PORTRAIT; - int angle = orientation; - if( 90 == angle ) { - newOrientation = LANDSCAPE; - } else if( 180 == angle ) { - newOrientation = PORTRAIT_INVERSE; - } else if( 270 == angle ) { - newOrientation = LANDSCAPE_INVERSE; - } - - mAppNavigation.Rotate( newOrientation ); - IVUG_FUNC_LEAVE(); -} diff --git a/slideshow/src/dali_effect/src/ivug-dali-slideshow-view.cpp b/slideshow/src/dali_effect/src/ivug-dali-slideshow-view.cpp deleted file mode 100644 index 3f928a0..0000000 --- a/slideshow/src/dali_effect/src/ivug-dali-slideshow-view.cpp +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -// CLASS HEADER -#include "ivug-dali-slideshow-view.h" - -// EXTERNAL INCLUDES -#include -#include - -// INTERNAL INCLUDES -#include "ivug-dali-imageview.h" -#include "ivug-slideshow-control.h" -#include "ivug-slideshow-effect.h" -#include "ivug-debug.h" -#include "ivug-includes.h" -#include "ivug-effect.h" -#include "ivug-dali.h" -#include "ivug-dali-util.h" - -// LOCAL STUFF -namespace -{ -} // end LOCAL STUFF - -//using namespace Dali; -using namespace std; - -namespace Imageview3D -{ - -ImageView* SlideshowView::New() -{ - IVUG_FUNC_ENTER(); - SlideshowView* self = new SlideshowView; - IVUG_FUNC_LEAVE(); - - return self; -} - -SlideshowView::~SlideshowView() -{ - IVUG_FUNC_ENTER(); - mSlideshowControl.reset(); - IVUG_FUNC_LEAVE(); -} - -void SlideshowView::DoActivationBegin(Dali::Animation slideAnimation) -{ -} - -void SlideshowView::DoActivationEnd() -{ -} - -void SlideshowView::DoDeactivationBegin(Dali::Animation slideAnimation) -{ -} - -void SlideshowView::DoDeactivationEnd() -{ -} - - -void SlideshowView::DoEnterForwardBegin( float /*navigationDuration*/ ) -{ - IVUG_FUNC_ENTER(); - - DALI_ASSERT_ALWAYS(mSSHandle); - // create a list of images - // create new slideshow control - int iTime = floor(mSSHandle->ss_interval_time); - MSG_IVUG_HIGH("ivug_dali_view_time_set=%d", iTime); - mSlideshowControl.reset( new SlideshowControl( mRotatingRootActor, mSSHandle, mEffects )); - mSlideshowControl->SetViewAndTransitionTime(iTime*SECOND_MS); - // set initial size - SetSlideshowSize(); - // hide screen furniture - //Imageviewer *iv = (Imageviewer *)mSSHandle->dali_viewer_handle; - //if (iv) { - // iv->SetScreenFurnitureVisibility( false ); - //} - - IVUG_FUNC_LEAVE(); -} - -void SlideshowView::DoEnterForwardEnd() -{ - // start the slideshow - IVUG_FUNC_ENTER(); - mSlideshowControl->Play(); - - mRootActor.SignalTouched().Connect( this, &SlideshowView::OnClick ); - IVUG_FUNC_LEAVE(); - // no toolbar in slideshow - //Imageviewer::GetToolBar()->GetActor().SetVisible(false); - - // We do not want the slideshow button in slideshow either - //Gallery::GetSlideshowButton().SetVisible(false); -} - -void SlideshowView::DoEnterBackwardBegin( float navigationDuration ) -{ - EnterForwardBegin( navigationDuration ); -} - -void SlideshowView::DoEnterBackwardEnd() -{ - // no toolbar in slideshow - //Gallery::GetToolBar()->GetActor().SetVisible(false); - - // We do not want the slideshow button in slideshow either - //Gallery::GetSlideshowButton().SetVisible(false); -} - -void SlideshowView::DoLeaveForwardBegin( float navigationDuration ) -{ - LeaveBackwardBegin( navigationDuration ); -} - -void SlideshowView::DoLeaveForwardEnd() -{ -} - -void SlideshowView::DoLeaveBackwardBegin( float /*navigationDuration*/ ) -{ - // stop slideshow - IVUG_FUNC_ENTER(); - if( mSlideshowControl ) { - mSlideshowControl->Stop(); - } - mRootActor.SignalTouched().Disconnect( this, &SlideshowView::OnClick ); - - int image_count = ivug_medialist_get_count(mSSHandle->media_list); - MSG_IVUG_HIGH("images count = %d", image_count); - - // show screen furniture - //Imageviewer *iv = (Imageviewer *)mSSHandle->dali_viewer_handle; - //if (iv) { - // iv->SetScreenFurnitureVisibility( true ); - //} -} - -void SlideshowView:: DoLeaveBackwardEnd() -{ - // if slideshow is there, delete it - if( mSlideshowControl ) { - mSlideshowControl.reset(); - } -} - -void SlideshowView::DoFocusView() -{ -} - -void SlideshowView::DoSetOrientation() -{ - // set slideshow control in correct size - if( mSlideshowControl ) { - // get stage size for image loading - SetSlideshowSize(); - } -} - -SlideshowView::SlideshowView() -{ - ImageView::mTitleBarText = std::string(""); -} - -void SlideshowView::SetSlideshowSize() -{ - // get stage size for image loading - IVUG_FUNC_ENTER(); - Stage stage = Dali::Stage::GetCurrent(); - Vector2 stageSize = stage.GetSize(); - if( mOrientation == LANDSCAPE || mOrientation == LANDSCAPE_INVERSE ) { - stageSize = Vector2( stageSize.height, stageSize.width); - } - // set size based on orientation - MSG_IVUG_HIGH("stageSize.x = %f, stageSize.y = %f, mOrientation=%d", stageSize.x, stageSize.y, mOrientation); - if( mSlideshowControl ) { - if( PORTRAIT == mOrientation || PORTRAIT_INVERSE == mOrientation ) { - // portrait - mSlideshowControl->SetSize( Dali::Size( stageSize.x, stageSize.y ), mOrientation); - } else { - // landscape - mSlideshowControl->SetSize( Dali::Size( stageSize.x, stageSize.y ), mOrientation); - } - } - IVUG_FUNC_LEAVE(); -} - -bool SlideshowView::OnClick( Dali::Actor actor, const Dali::TouchEvent& event ) -{ - IVUG_FUNC_ENTER(); - - Dali::TouchPoint point = event.GetPoint( 0 ); - if( point.state == Dali::TouchPoint::Up ) { - // if slideshow is running, and its paused - if( mSlideshowControl ) { - ivug_ss_set_mouse_tag(true, mSSHandle); - //mRootActor.SignalTouch().Disconnect( this, &SlideshowView::OnClick ); - mSlideshowControl->StopViewAndTransitionTimer(); - mSlideshowControl->Pause(); - ivug_return_main_view(mSSHandle); - } - } - // consume all clicks - return true; -} - -void SlideshowView::SlideShowResume(void) -{ - if( mSlideshowControl ){ - if(mSlideshowControl->IsPaused()) { - mSlideshowControl->NewViewAndTransitionTimer(); - mSlideshowControl->Resume(); - //Imageviewer *iv = (Imageviewer *)mSSHandle->dali_viewer_handle; - //if (iv) { - // iv ->SetScreenFurnitureVisibility( true ); - //} - - } - } -} - -void SlideshowView::DoInitialize(void) -{ - IVUG_FUNC_ENTER(); - Effect_Type StyleEffect = EFFECT_3D_RAND; - EffectPtr effect; - if(mSSHandle) { - StyleEffect = mSSHandle->effect_type; - } - MSG_IVUG_HIGH("StyleEffect = %d", StyleEffect); - - if (EFFECT_DISSOLVE == StyleEffect || (EFFECT_3D_RAND == StyleEffect)) { - effect = EffectPtr(EffectFactory::NewSquareEffect()); - if(effect) { - mEffects.push_back(effect); - } - } - - if(EFFECT_SLIDE == StyleEffect ||(EFFECT_3D_RAND == StyleEffect)) { - effect = EffectPtr(EffectFactory::NewSlideEffect()); - if(effect) { - mEffects.push_back(effect); - } - } - if(EFFECT_IRIS == StyleEffect ||(EFFECT_3D_RAND == StyleEffect)) { - effect = EffectPtr(EffectFactory::NewIrisEffect()); - if(effect) { - mEffects.push_back(effect); - } - } - if (EFFECT_RIPPLE_FADE == StyleEffect || (EFFECT_3D_RAND == StyleEffect)) { - effect = EffectPtr(EffectFactory::NewRippleFadeEffect(RIPPLEAMPLITUDE)); - if (effect) { - mEffects.push_back(effect); - } - } - if(EFFECT_DISSOLVE_FADE == StyleEffect||(EFFECT_3D_RAND == StyleEffect)){ - effect = EffectPtr(EffectFactory::NewDissolveFadeEffect()); - if(effect) { - mEffects.push_back(effect); - } - } - if(EFFECT_SWIRL == StyleEffect ||(EFFECT_3D_RAND == StyleEffect)){ - effect = EffectPtr(EffectFactory::NewSwirlEffect()); - if(effect) { - mEffects.push_back(effect); - } - } - if(EFFECT_WATER_RIPPLE == StyleEffect ||(EFFECT_3D_RAND == StyleEffect)){ - effect = EffectPtr(EffectFactory::NewWaterRippleEffect()); - if(effect) { - mEffects.push_back(effect); - } - } - if(EFFECT_ZOOM == StyleEffect ||(EFFECT_3D_RAND == StyleEffect)){ - effect = EffectPtr(EffectFactory::NewZoomEffect()); - if(effect) { - mEffects.push_back(effect); - } - } - if(EFFECT_SPLIT == StyleEffect ||(EFFECT_3D_RAND == StyleEffect)){ - effect = EffectPtr(EffectFactory::NewSplitEffect()); - if(effect) { - mEffects.push_back(effect); - } - } - if(EFFECT_FACE == StyleEffect){ - /** - * when enable face effect, images without face display slide effect - ** images with face display face effect - */ - - effect = EffectPtr(EffectFactory::NewFaceEffect(mSSHandle)); - if(effect) { - mEffects.push_back(effect); - } - } - IVUG_FUNC_LEAVE(); -} - - -} // namespace Imageview3D - diff --git a/slideshow/src/dali_effect/src/ivug-dali.cpp b/slideshow/src/dali_effect/src/ivug-dali.cpp deleted file mode 100644 index db78cf8..0000000 --- a/slideshow/src/dali_effect/src/ivug-dali.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -#include -#include -#include -#include /*EFL*/ - -//#include "gl-ui-util.h" -#include "ivug-dali.h" -#include "ivug-debug.h" -#include "ivug-dali-util.h" -#include "ivug-includes.h" -#include "ivug-slideshow-priv.h" - -using namespace std; -//using namespace Dali; -using namespace Imageview3D; - -static void _ivug_dali_resize_image_view(Evas_Object *obj, Imageviewer* iv) -{ - IVUG_FUNC_ENTER(); - - if (NULL == obj) { - MSG_SLIDER_HIGH ("obj is null"); - return; - } - ivug_ret_if(NULL == iv); - int x, y, w, h; - evas_object_geometry_get(obj, &x, &y, &w, &h); - MSG_IVUG_HIGH ("x=%d,y=%d,w=%d,h=%d", x, y, w, h); - - float fx =0.0; - float fy = 0.0; - float fw = 0.0; - float fh = 0.0; - fx = (float)x; - fy = (float)y; - fw = (float)w; - fh = (float)h; - iv->SetSize(fw,fh); - iv->SetPosition(fx,fy); - - IVUG_FUNC_LEAVE(); -} - -#if 0 -static void _ivug_dali_adaptor_image_resized_xWin(Adaptor &adp) -{ - IVUG_FUNC_ENTER(); - Evas_Object * main_win = (Evas_Object *)ug_get_window(); - evas_object_smart_callback_call(main_win, "evasplugin,create", (void *)EVASPLUGIN_RESIZED); - - IVUG_FUNC_LEAVE(); -} -#endif - -void ivug_imageviewer_init_xWin(SlideShow *ss_handle, int state) -{ - IVUG_FUNC_ENTER(); - IV_ASSERT(ss_handle != NULL); - - int ep_state = state; - if (NULL == ss_handle->adaptor) { - return; - } - Evas_Object *main_lay = (Evas_Object *)ug_get_window(); - if (ep_state == EVASPLUGIN_INITED) { - Adaptor *adaptor = ss_handle->adaptor; - if (!ss_handle->dali_viewer_handle) { - Imageviewer* iv = new Imageviewer(*adaptor, ss_handle); - ss_handle->dali_viewer_handle = (void *)iv; - } - if(ss_handle->dali_viewer_handle) { - MSG_IVUG_HIGH("create image viewer"); - Imageviewer *iv_handle = (Imageviewer *)ss_handle->dali_viewer_handle; - _ivug_dali_resize_image_view(main_lay, iv_handle); - iv_handle->SignalResizeSend(); - } - - } else if (ep_state == EVASPLUGIN_RESIZED) { - int range = elm_win_rotation_get(main_lay); - ecore_x_window_prop_property_set(ss_handle->xwin, - ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, - ECORE_X_ATOM_CARDINAL, 32, &range, 1); - if(ss_handle->dali_viewer_handle) { - Imageviewer *iv_handle = (Imageviewer *)ss_handle->dali_viewer_handle; - _ivug_dali_resize_image_view(main_lay, iv_handle); - iv_handle->OrientationChanged((const int)range); - } - } - IVUG_FUNC_LEAVE(); - -} - -void ivug_dali_create_xWin(SlideShow *data) -{ - IVUG_FUNC_ENTER(); - - if (NULL == data) { - MSG_IVUG_HIGH("box or object is NULL"); - return; - } - SlideShow* ss_handle = (SlideShow*)data; - - // create window surface - Dali::PositionSize windowPosition(0, 0, 0, 0); // this will use full screen - - ss_handle->winHandle= Dali::Window::New(windowPosition, "slider Show"); - ss_handle->adaptor = &Dali::Adaptor::New(ss_handle->winHandle); - if (!ss_handle->adaptor) { - return; - } - ss_handle->winHandle.SetClass("Slide Show", "SLIDE_SHOW"); - ss_handle->winHandle.ShowIndicator(false); - - //get window - Adaptor *adaptor = ss_handle->adaptor; - Dali::RenderSurface& surface = adaptor->GetSurface(); - //Get the X-Renderable for which the pixmap is created on - boost::any renderableSurface = surface.GetSurface(Dali::RenderSurface::ECORE_X11); - // if Dali is using a Pixmap or Window to render to it doesn't matter because they have the same - // underlying type of unsigned long - Ecore_X_Window daliWindow = boost::any_cast< Ecore_X_Window >(renderableSurface); - ss_handle->xwin = daliWindow; - - ss_handle->adaptor->Start(); - //resize xWin - ivug_imageviewer_init_xWin(ss_handle, EVASPLUGIN_INITED); - ivug_imageviewer_init_xWin(ss_handle, EVASPLUGIN_RESIZED); - - IVUG_FUNC_LEAVE(); -} - -/* Call this one whenever Dali is hidden */ -void ivug_dali_pause(SlideShow *ss_handle) -{ - IVUG_FUNC_ENTER(); - if (NULL == ss_handle) { - return; - } - if(ss_handle->adaptor!= NULL) { - if (ss_handle->evas_plugin_state == EVASPLUGIN_PAUSED) { - MSG_IVUG_HIGH("Dali is paused."); - return; - } - MSG_IVUG_HIGH("Pause Dali."); - ss_handle->evas_plugin_state = EVASPLUGIN_PAUSED; - ss_handle->adaptor->Pause(); - } - IVUG_FUNC_LEAVE(); -} - -void ivug_dali_resume(SlideShow *ss_handle) -{ - IVUG_FUNC_ENTER(); - if (NULL == ss_handle) { - return; - } - if(ss_handle->adaptor != NULL) { - if (ss_handle->evas_plugin_state == EVASPLUGIN_RESUMED) { - MSG_IVUG_HIGH("Dali is resumed."); - return; - } - MSG_IVUG_HIGH("Resume Dali."); - ss_handle->evas_plugin_state = EVASPLUGIN_RESUMED; - ss_handle->adaptor->Resume(); - } - IVUG_FUNC_LEAVE(); -} - -static Eina_Bool _ivug_ss_return_timer_cb(void *data) -{ - IVUG_FUNC_ENTER(); - - SlideShow *pSlideShow = (SlideShow *)data; - if (NULL == pSlideShow) { - return ECORE_CALLBACK_CANCEL; - } - if(pSlideShow->click_timer) - { - ecore_timer_del(pSlideShow->click_timer); - pSlideShow->click_timer = NULL; - } - - if(pSlideShow->state == SLIDE_SHOW_RUNNING) { - ivug_ss_stop(pSlideShow); - //EFL::dump_obj(pSlideShow->obj, 0); - return ECORE_CALLBACK_CANCEL; - } - - MSG_HIGH("-------------_ivug_ss_clicked_timer_cb--------------"); - - pSlideShow->state = SLIDE_SHOW_INTERRUPTED; - evas_object_smart_callback_call(ivug_ss_object_get(pSlideShow), "slideshow,finished", (void *)SLIDE_SHOW_STOPPED); - - return ECORE_CALLBACK_CANCEL; -} - - -void ivug_return_main_view(SlideShow *ss_handle) -{ - IVUG_FUNC_ENTER(); - if(NULL == ss_handle) { - return; - } - Media_List *list = (Media_List*)ss_handle->media_list; - int image_count = ivug_medialist_get_count(list); - MSG_IVUG_HIGH("images count = %d", image_count); - //ivug_dali_pause(ss_handle); - const char *profile = elm_config_profile_get(); - if (!strcmp(profile,"mobile")) - { - elm_win_indicator_mode_set((Evas_Object *)ug_get_window(), ELM_WIN_INDICATOR_SHOW); - } - if(ss_handle->click_timer) - { - ecore_timer_del(ss_handle->click_timer); - } - ss_handle->click_timer = ecore_timer_add(0.3f, _ivug_ss_return_timer_cb, ss_handle); -} - - diff --git a/slideshow/src/dali_effect/src/ivug-image-view.cpp b/slideshow/src/dali_effect/src/ivug-image-view.cpp deleted file mode 100644 index 9f5a460..0000000 --- a/slideshow/src/dali_effect/src/ivug-image-view.cpp +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -// CLASS HEADER -#include "ivug-image-view.h" - -// INTERNAL INCLUDES -#include "ivug-dali-imageview.h" -#include "ivug-debug.h" -#include "ivug-slideshow-priv.h" - -//#include "gallery.h" - -using namespace Dali; -using namespace Imageview3D; - -// LOCAL STUFF -namespace -{ -} - -const float ImageView::ROTATION_ANIMATION_DURATION = 0.5f; - -ImageView::~ImageView() -{ - //mRotateAnimation.Stop(); -} - -void ImageView::Initialize( AppNavigation* appNavigation, SlideShow *ss_handle) -{ - mAppNavigation = appNavigation; - - mSSHandle= ss_handle; - //mLighting.keyLightActive = false; - - // call deriving class - DoInitialize(); -} - -void ImageView::SetOrientation( Imageview3D::Orientation orientation ) -{ - // Resize the root actor - Vector2 stageSize = Stage::GetCurrent().GetSize(); - MSG_IVUG_HIGH("stageSize.x = %f, stageSize.y = %f", stageSize.x, stageSize.y); - Vector3 targetSize = Dali::Vector3( stageSize ); - if( orientation == LANDSCAPE || orientation == LANDSCAPE_INVERSE ) { - //targetSize = Vector3( stageSize.height, stageSize.width, stageSize.depth ); - targetSize = Vector3( stageSize.height, stageSize.width, std::max(stageSize.height, stageSize.width) ); - } - MSG_IVUG_HIGH("targetSize.x = %f, targetSize.y = %f", targetSize.x, targetSize.y); - - // set layout orientation - unsigned int orientationAngle = ( orientation == PORTRAIT ? 0 : - ( orientation == LANDSCAPE ? 270 : - ( orientation == PORTRAIT_INVERSE ? 180 : - ( orientation == LANDSCAPE_INVERSE ? 90 : 0 ) ) ) ); - //main window layout rotate when change screen. so we needn't retate. - //orientationAngle = 0; - - // only do something if the orientation changes - if (mOrientation != orientation) { - mOrientation = orientation; - - // check if actor is on stage - if( mRotatingRootActor.OnStage() ) { - mRotatingRootActor.SetRotation( Degree( orientationAngle ), Vector3::ZAXIS ); - Vector3 currentSize( mRotatingRootActor.GetCurrentSize() ); - MSG_IVUG_HIGH("orientationAngle = %d", orientationAngle); - mRotateAnimation = Animation::New( ROTATION_ANIMATION_DURATION ); - mRotateAnimation.RotateTo(mRotatingRootActor, Degree(orientationAngle), Vector3::ZAXIS, AlphaFunctions::EaseOut); - MSG_IVUG_HIGH("currentSize.x = %f, currentSize.y = %f", currentSize.x, currentSize.y); - - // if we linearly resize from portrait to landscape halfway through the animation - // we get size which is square between the both. This would cause a square image to grow - // if it is fitted to be 100% of root size. Therefore we do a nonlinear size animation - // where we shrink faster - // which one grows - if( targetSize.width > currentSize.width) { - // width grows, shrink height faster - Vector3 shrink( currentSize ); - shrink.height = targetSize.height; - mRotateAnimation.Resize( mRotatingRootActor, shrink, AlphaFunctions::EaseOut, 0.0f, ROTATION_ANIMATION_DURATION * 0.5f ); - mRotateAnimation.Resize( mRotatingRootActor, targetSize, AlphaFunctions::EaseIn, 0.0f, ROTATION_ANIMATION_DURATION ); - } else { - // height grows, shrink width faster - Vector3 shrink( currentSize ); - shrink.width = targetSize.width; - mRotateAnimation.Resize( mRotatingRootActor, shrink, AlphaFunctions::EaseOut, 0.0f, ROTATION_ANIMATION_DURATION * 0.5f ); - mRotateAnimation.Resize( mRotatingRootActor, targetSize, AlphaFunctions::EaseIn, 0.0f, ROTATION_ANIMATION_DURATION ); - } - mRotateAnimation.SetDestroyAction( Animation::Bake ); - mRotateAnimation.Play(); - } - else - { - // set the rotation to match the orientation - mRotatingRootActor.SetRotation( Degree( orientationAngle ), Vector3::ZAXIS ); - mRotatingRootActor.SetSize( targetSize ); - } - - // call subclass - DoSetOrientation(); - } - else - { - // for first time just set size - mRotatingRootActor.SetSize( targetSize ); - } -} - -void ImageView::NavigateTo( ViewId view ) -{ - // Only an active view may initiate navigation - if (mActive) { - mAppNavigation->NavigateForward( view ); - } -} - -void ImageView::NavigateBack() -{ - // Only an active view may initiate navigation - if (mActive) { - mAppNavigation->NavigateBack(); - } -} - -void ImageView::ActivationBegin(Animation slideAnimation) -{ - mActive = true; - DoActivationBegin(slideAnimation); -} - -void ImageView::ActivationEnd() -{ - DoActivationEnd(); -} - -void ImageView::DeactivationBegin(Animation slideAnimation) -{ - DoDeactivationBegin(slideAnimation); -} - -void ImageView::DeactivationEnd() -{ - mActive = false; - DoDeactivationEnd(); -} - -void ImageView::EnterForwardBegin( float navigationDuration ) -{ - // add root actor to stage - if(!mRootActor.GetParent()) { - Imageviewer *iv = (Imageviewer *)mSSHandle->dali_viewer_handle; - if (iv) { - iv->AddToLayer(MAIN_VIEW_LAYER, mRootActor); - } - } - // reset rotating-root actor, this is needed because we might navigated away from - // view whilst it was doing portrait & landscape rotation - unsigned int orientationAngle = ( mOrientation == PORTRAIT ? 0 : - ( mOrientation == LANDSCAPE ? 270 : - ( mOrientation == PORTRAIT_INVERSE ? 180 : - ( mOrientation == LANDSCAPE_INVERSE ? 90 : 0 ) ) ) ); - //orientationAngle = 0; - mRotatingRootActor.SetRotation( Degree( orientationAngle ), Vector3::ZAXIS ); - - // deriving class is called last - DoEnterForwardBegin(navigationDuration); -} - -void ImageView::EnterForwardEnd() -{ - mActive = true; - - // deriving class is called last - DoEnterForwardEnd(); -} - -void ImageView::EnterBackwardBegin( float navigationDuration ) -{ - // add root actor to stage - if (!mRootActor.GetParent()) { - Imageviewer *iv = (Imageviewer *)mSSHandle->dali_viewer_handle; - if (iv) { - iv->AddToLayer(MAIN_VIEW_LAYER, mRootActor); - } - } - - // reset rotating-root actor, this is needed because we might navigated away from - // view whilst it was doing portrait & landscape rotation - unsigned int orientationAngle = ( mOrientation == PORTRAIT ? 0 : - ( mOrientation == LANDSCAPE ? 270 : - ( mOrientation == PORTRAIT_INVERSE ? 180 : - ( mOrientation == LANDSCAPE_INVERSE ? 90 : 0 ) ) ) ); - //if (0 != orientationAngle) { - // orientationAngle = 0; - //} - mRotatingRootActor.SetRotation( Degree(orientationAngle), Vector3::ZAXIS ); - - // deriving class is called last - DoEnterBackwardBegin(navigationDuration); -} - -void ImageView::EnterBackwardEnd() -{ - mActive = true; - - // deriving class is called last - DoEnterBackwardEnd(); -} - -void ImageView::LeaveForwardBegin(float navigationDuration) -{ - mActive = false; - - // deriving class is called last - DoLeaveForwardBegin(navigationDuration); -} - -void ImageView::LeaveForwardEnd() -{ - // remove root actor from stage - if(mRootActor.GetParent()) { - Dali::Stage::GetCurrent().Remove(mRootActor); - } - - // deriving class is called last - DoLeaveForwardEnd(); -} - -void ImageView::LeaveBackwardBegin(float navigationDuration) -{ - mActive = false; - - // deriving class is called last - DoLeaveBackwardBegin(navigationDuration); -} - -void ImageView::LeaveBackwardEnd() -{ - // remove root actor from stage - if(mRootActor.GetParent()) { - Dali::Stage::GetCurrent().Remove(mRootActor); - } - - // deriving class is called last - DoLeaveBackwardEnd(); -} - -void ImageView::FocusView() -{ - DoFocusView(); -} - -ImageView::ImageView() -: mOrientation( PORTRAIT ), // default orientation upright - mActive(false), - mAppNavigation( NULL ), - mViewStackInfo( NULL ) -{ - // create root actor in the middle of the stage with the size of the stage - mRootActor = Actor::New(); - mRootActor.SetAnchorPoint(AnchorPoint::CENTER); - mRootActor.SetParentOrigin(ParentOrigin::CENTER ); - Vector2 stageSize = Dali::Stage::GetCurrent().GetSize(); - mRootActor.SetSize(Dali::Vector3( stageSize )); - - // create a rotating actor, to use as a root for actors which rotate with the device orientation - mRotatingRootActor = Actor::New(); - mRotatingRootActor.SetAnchorPoint(AnchorPoint::CENTER); - mRotatingRootActor.SetParentOrigin(ParentOrigin::CENTER); - mRotatingRootActor.SetSize(Dali::Vector3(stageSize)); - mRootActor.Add(mRotatingRootActor); -} - diff --git a/slideshow/src/dali_effect/src/ivug-includes.cpp b/slideshow/src/dali_effect/src/ivug-includes.cpp deleted file mode 100644 index 6e866d6..0000000 --- a/slideshow/src/dali_effect/src/ivug-includes.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -#include "ivug-includes.h" -#include "ivug-debug.h" - -using namespace Dali::Toolkit; - -namespace Imageview3D -{ - -ControlOrientation::Type GetControlOrientation(Orientation orientation) -{ - ControlOrientation::Type result(ControlOrientation::Up); - - switch (orientation) { - case PORTRAIT: - result = ControlOrientation::Up; - break; - - case LANDSCAPE: - result = ControlOrientation::Left; - break; - - case PORTRAIT_INVERSE: - result = ControlOrientation::Down; - break; - - case LANDSCAPE_INVERSE: - result = ControlOrientation::Right; - break; - - default: - break; - } - - return result; -} - -void PrintCurrentTime() -{ - time_t tt; - struct tm *t = NULL; - time(&tt); - t = localtime(&tt); - char currentTime[100] = { '0', }; - if(t) { - snprintf(currentTime, sizeof(currentTime), "current time:%d%d%d", - t->tm_hour, t->tm_min, t->tm_sec); - } - MSG_EFFECT_HIGH(currentTime); -} - - -} - diff --git a/slideshow/src/dali_effect/src/ivug-slideshow-control.cpp b/slideshow/src/dali_effect/src/ivug-slideshow-control.cpp deleted file mode 100755 index 1e3c14e..0000000 --- a/slideshow/src/dali_effect/src/ivug-slideshow-control.cpp +++ /dev/null @@ -1,916 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -// CLASS HEADER -#include "ivug-slideshow-control.h" - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include "ivug-slideshow-effect.h" -#include "ivug-debug.h" -#include "ivug-includes.h" -#include "ivug-dali.h" -#include "ivug-slideshow-face.h" - -// LOCAL STUFF -namespace -{ -const int VIEWINGTIME = 2000; // 2 second (milliseconds) -const int TRANSITIONTIME = 3000; // 3 seconds (milliseconds) -const int EIGHTY_MILLISECOND = 80; // 80milliseconds - -const float DefaultVideoWidth = 720.0f; -const float DefaultVideoHeight = 396.0f; - -} // end unnamed namespace - -using namespace Dali; -using namespace std; - -namespace Imageview3D -{ -static Eina_Bool pixmap_update (void *data, int type, void *event); - -SlideshowControl::SlideshowControl( Dali::Actor parent, - SlideShow *ss_handle, - const std::vector< boost::shared_ptr< SlideshowEffect > >& effects) -: mParent(parent), - mSSHandle(ss_handle), - mEffects(effects), - mCurrentLayer(0), - mSlideshowSize(parent.GetCurrentSize().width, parent.GetCurrentSize().height), - mCurrentIndex(0), - mCurrentEffect(0), - mPlaying(false), - mImageReady(false), - mTimerReady(false), - mPaused(false), - mFirstImage(true), - mViewTime(VIEWINGTIME), - mTransitionTime(TRANSITIONTIME), - mVideoTime(TRANSITIONTIME + VIEWINGTIME), - mbFinishPlay(false), - mFaceCount(0), - mCurrentFace(0), - mbFaceEffect(false), - mCurItem(NULL), - mCurIsVideo(false), - mPreIsVideo(false), - mXPixmap(0), - mEventHandler(NULL), - mDamage(0), - mVideoWidth(DefaultVideoWidth), - mVideoHeight(DefaultVideoHeight) -{ - IVUG_FUNC_ENTER(); - // slideshow root - mSlideshowRoot = Actor::New(); - mSlideshowRoot.SetColor(Color::WHITE); - // root anchor in the middle - mSlideshowRoot.SetAnchorPoint(AnchorPoint::CENTER); - mSlideshowRoot.SetParentOrigin(ParentOrigin::CENTER); - // constrain to same size as parent actor - //mSlideshowRoot.ApplyConstraint(ParentConstraint::Size::New(Dali::ParentSize())); - mSlideshowRoot.ApplyConstraint(Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() )); - // dont multiply parents color - mSlideshowRoot.SetColorMode( Dali::USE_OWN_COLOR ); - - // layers, create back first as last layer is on top - mLayers[ 0 ] = Layer::New(); - mLayers[ 0 ].SetAnchorPoint( AnchorPoint::CENTER ); - mLayers[ 0 ].SetParentOrigin( ParentOrigin::CENTER ); - // constrain to same size as parent actor - //mLayers[ 0 ].ApplyConstraint(ParentConstraint::Size::New(Dali::ParentSize())); - mLayers[ 0 ].ApplyConstraint(Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() )); - mSlideshowRoot.Add( mLayers[ 0 ] ); - - mLayers[ 1 ] = Layer::New(); - mLayers[ 1 ].SetAnchorPoint(AnchorPoint::CENTER); - mLayers[ 1 ].SetParentOrigin(ParentOrigin::CENTER); - // constrain to same size as parent actor - //mLayers[ 1 ].ApplyConstraint(ParentConstraint::Size::New(Dali::ParentSize())); - mLayers[ 1 ].ApplyConstraint(Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() )); - mSlideshowRoot.Add(mLayers[ 1 ]); - - mVideoLayer = Layer::New(); - mVideoLayer.SetAnchorPoint(AnchorPoint::CENTER); - mVideoLayer.SetParentOrigin(ParentOrigin::CENTER); - // constrain to same size as parent actor - //mVideoLayer.ApplyConstraint(ParentConstraint::Size::New(Dali::ParentSize())); - mVideoLayer.ApplyConstraint(Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() )); - mSlideshowRoot.Add(mVideoLayer); - - // two actors to cover the area of screen that the image in view does not cover - mSolid = BitmapImage::WHITE(); - // create borders to cover the rest of the screen - mBorder1 = ImageActor::New(mSolid); - mBorder2 = ImageActor::New(mSolid); - // border1 anchors to top left - mBorder1.SetParentOrigin(ParentOrigin::TOP_LEFT); - mBorder1.SetAnchorPoint(AnchorPoint::TOP_LEFT); - // border2 anchors to bottom right - mBorder2.SetParentOrigin(ParentOrigin::BOTTOM_RIGHT); - mBorder2.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); - - // we dont add root to parent until slideshow starts - // as that would make actors visible too soon - - // initialize effects - for_each( effects.begin(), - effects.end(), - boost::bind(&SlideshowEffect::Initialize, _1, parent.GetCurrentPosition())); - IVUG_FUNC_LEAVE(); -} - -SlideshowControl::~SlideshowControl() -{ - IVUG_FUNC_ENTER(); - Stop(); - // release remaining actors - mBorder1 = NULL; - mBorder2 = NULL; - mLayers[ 0 ] = NULL; - mLayers[ 1 ] = NULL; - mVideoLayer = NULL; - mSlideshowRoot = NULL; - if (mDamage) { - ecore_x_damage_free(mDamage); - } - if (mEventHandler) { - ecore_event_handler_del(mEventHandler); - mEventHandler = NULL; - } - if (mXPixmap){ - ecore_x_pixmap_free(mXPixmap); - } - IVUG_FUNC_LEAVE(); -} - -void SlideshowControl::Play() -{ - if (NULL == mSSHandle || (NULL == mSSHandle->media_list)) { - return; - } - int image_count = ivug_medialist_get_count(mSSHandle->media_list); - MSG_IVUG_HIGH("images count = %d", image_count); - if ( !mPlaying && image_count > 0) { - //Disable screen lock during slideshow using power manager - power_lock_state(POWER_STATE_NORMAL, 0); - - // add root to stage - mParent.Add( mSlideshowRoot ); - - // move layers below parent layer to make sure we dont draw over screen furniture - mLayers[ 0 ].MoveBelow( mParent.GetLayer()); - mLayers[ 1 ].MoveBelow(mParent.GetLayer()); - mVideoLayer.MoveBelow(mParent.GetLayer()); - // create the timers - NewViewAndTransitionTimer(); - - // first time we run immediately to fade the image in - mTimerReady = true; - mFirstImage = true; - // start loading first image - if (mEffects.size() > 0) { - boost::shared_ptr effect = mEffects[mCurrentEffect]; - if (0 == strcmp(effect->Name().c_str(), FACE_EFFECT_NAME)) { - mbFaceEffect = true; - } else { - mbFaceEffect = false; - } - } - LoadNextImage(); - // set flag - mPlaying = true; - } -} - -void SlideshowControl::SetStartIndex(unsigned int startIndex) -{ - // set the start index - if (NULL == mSSHandle || (NULL == mSSHandle->media_list)) { - return; - } - - int image_count = ivug_medialist_get_count(mSSHandle->media_list); - MSG_IVUG_HIGH("images count = %d", image_count); - mCurrentIndex = startIndex; - // wrap around in case too big index given - if(image_count > 0) - mCurrentIndex %= image_count; -} - -unsigned int SlideshowControl::GetCurrentIndex() const -{ - return mCurrentIndex; -} - -void SlideshowControl::Pause() -{ - // only pause if playing - if( mPlaying ) { - mPaused = true; - } -} - -bool SlideshowControl::IsPaused() -{ - return mPaused; -} - -void SlideshowControl::Resume() -{ - if( mPlaying ) { - mPaused = false; - if( mTimerReady && mImageReady ) { - StartTransition(); - } else { - // start viewing timer - mTimerReady = false; - mViewTimer.Start(); - } - } -} - -void SlideshowControl::Stop() -{ - IVUG_FUNC_ENTER(); - //reset screen lock state - power_unlock_state(POWER_STATE_NORMAL); - - // disconnect from the image loading signal - mConnection.disconnect(); - ImageActor emptyInstance; - // remove actors from the stage - if( mParent ) { - if( mSlideshowRoot ) { - // remove it, don't delete in stop - if( mSlideshowRoot.GetParent() ) { - mSlideshowRoot.GetParent().Remove( mSlideshowRoot ); - } - - // remove layers, don't delete in stop - if ( mLayers[ 0 ] && mLayers[ 0 ].GetParent()) { - mLayers[ 0 ].GetParent().Remove(mLayers[ 0 ]); - } - if (mLayers[ 1 ] && mLayers[ 1 ].GetParent()) { - mLayers[ 1 ].GetParent().Remove(mLayers[ 1 ]); - } - if (mVideoLayer && mVideoLayer.GetParent()) { - mVideoLayer.GetParent().Remove(mVideoLayer); - } - // remove borders, don't delete in stop - if ( mBorder1 && mBorder1.GetParent() ) { - mBorder1.GetParent().Remove( mBorder1 ); - } - if ( mBorder2 && mBorder2.GetParent() ) { - mBorder2.GetParent().Remove( mBorder2 ); - } - - // release the actors after borders - if ( mInView && mInView.GetParent() ) { - mInView.GetParent().Remove( mInView ); - mInView = emptyInstance; - } - if ( mFadingIn && mFadingIn.GetParent()) { - mFadingIn.GetParent().Remove( mFadingIn ); - mFadingIn = emptyInstance; - } - if (mImageActor) { - if (mImageActor.GetParent()) { - mImageActor.GetParent().Remove(mImageActor); - mImageActor = emptyInstance; - } - - } - } - } - - // delete timers - mViewTimer.Reset(); - mTransitionTimer.Reset(); - mFirstFaceTimer.Reset(); - // no more playing - mPlaying = false; - IVUG_FUNC_LEAVE(); -} - -void SlideshowControl::SetSize( Dali::Size size, int Orientation) -{ - // if size changed - if( size != mSlideshowSize ) { - mSlideshowSize = size; - mSlideshowRoot.SetSize( mSlideshowSize ); - // refit the actor and borders - FitViewActorAndBorders(); - } - int video_width = 0; - int video_height = 0; - float scale = 0.55; - bool ret = ivug_ss_get_player_attribute(mSSHandle, &video_width, &video_height); - MSG_IVUG_HIGH("*******************=%d:%d",video_width,video_height); - if ((0 != video_height) && ret ) { - scale = (float)video_height/video_width; - } - - if ((Orientation == PORTRAIT) || (Orientation == PORTRAIT_INVERSE)) { - mVideoWidth = mSlideshowSize.width; - mVideoHeight = mVideoWidth*scale; - } else { - mVideoWidth = mSlideshowSize.width; - mVideoHeight = mVideoWidth*scale; - } - if (mImageActor && mCurIsVideo) { - mImageActor.SetSize(mVideoWidth, mVideoHeight); - } - MSG_IVUG_HIGH("mVideoWidth:mVideoHeight=%f:%f:%f",mVideoWidth,mVideoHeight,scale); -} - -void SlideshowControl::LoadNextImage() -{ - IVUG_FUNC_ENTER(); - ImageAttributes attr; - attr.SetSize( mSlideshowSize.width, mSlideshowSize.height ); - attr.SetScalingMode(ImageAttributes::ShrinkToFit); - // get the item - //Media_Item* item = ivug_medialist_find_item_by_index((Media_List *)mImages, mCurrentIndex); - - /*mPreItem is NULL, will get the first item*/ - mPreIsVideo = mCurIsVideo; - mCurIsVideo = false; - if (NULL == mSSHandle) { - return; - } - mCurrentFace = 0; - boost::shared_ptr< SlideshowEffect > effect = mEffects[mCurrentEffect]; - mCurItem = ivug_ss_dali_get_next_item(mCurItem, mSSHandle); - if(mCurItem) { - Media_Data *data= ivug_medialist_get_data(mCurItem); - if(NULL == data) { - return; - } - if(data->slide_type == SLIDE_TYPE_VIDEO - || data->slide_type == SLIDE_TYPE_STREAMING) { - if(data->thumbnail_path || data->filepath) { - if (data->thumbnail_path) { - if (mbFaceEffect) { - if(effect) { - effect->SetImageSize((const char*)data->thumbnail_path); - } - mFaceCount = ivug_get_face_cnt(data->mediaID, mSSHandle); - } - mNextImage = Image::New( data->thumbnail_path, attr ); - } - - if (data->filepath) { - mCurIsVideo = true; - /*only be created once*/ - if (!mImageActor) { - ivug_ss_create_player_handle(mSSHandle); - CreateXHPixmap(); - } - StartVideoPlay(data->filepath); - } - }else { - LoadNextImage(); - } - } else { - if (data->filepath) { - if (mbFaceEffect) { - if(effect) { - effect->SetImageSize((const char*)data->filepath); - } - mFaceCount = ivug_get_face_cnt(data->mediaID, mSSHandle); - } - mNextImage = Image::New( data->filepath, attr ); - } else { - LoadNextImage(); - } - } - mImageReady = false; - // observe image loaded - if (!mCurIsVideo) { - MSG_IVUG_HIGH("mCurIsVideo = %d",mCurIsVideo); - if(Dali::ResourceLoading == mNextImage.GetLoadingState()) { - mConnection = mNextImage.SignalLoadingFinished().Connect( this, - &SlideshowControl::ImageLoaded ); - } else if(Dali::ResourceLoadingFailed == mNextImage.GetLoadingState()) { - LoadNextImage(); - } else { - // image already loaded - ImageLoaded(); - } - } - } else { - mbFinishPlay = true; - TimerTick(); - } - IVUG_FUNC_LEAVE(); -} - -void SlideshowControl::ImageLoaded() -{ - IVUG_FUNC_ENTER(); - if(Dali::ResourceLoadingFailed == mNextImage.GetLoadingState()) { - MSG_IVUG_HIGH("GetLoadingState = %d", mNextImage.GetLoadingState()); - LoadNextImage(); - - return; - } - // ready to start transition - mImageReady = true; - /* direct to start transition if pre item is video*/ - if (mPreIsVideo) { - if(mbFinishPlay) { - mTimerReady = false; - StopViewAndTransitionTimer(); - ivug_return_main_view(mSSHandle); - mbFinishPlay = false; - } else { - StartTransition(); - } - } else { - // check if timer is ready - if( mTimerReady && mFirstImage) { - StartTransition(); - } - } - IVUG_FUNC_LEAVE(); -} - -bool SlideshowControl::TimerTick() -{ - IVUG_FUNC_ENTER(); - mTimerReady = true; - // check if image is ready - // judge for repeat - if(mbFinishPlay) { - mTimerReady = false; - StopViewAndTransitionTimer(); - ivug_return_main_view(mSSHandle); - mbFinishPlay = false; - return false; - } - if (mCurIsVideo) { - //mTransitionTimer.Start(); - return false; - } else if (mImageReady) { - StartTransition(); - // tell timer not to call us again - return false; - } - IVUG_FUNC_LEAVE(); - // else, tick again as image loading seems to take some time - return true; -} - -void SlideshowControl::StartTransition() -{ - IVUG_FUNC_ENTER(); - bool bShowPlayIcon = false; - // if we're paused or if the slideshow timer is already running, just skip - if (mPaused || mTransitionTimer.IsRunning()) { - return; - } - ivug_ss_dali_set_current_item(mCurItem, mSSHandle); - if (mCurItem) { - Media_Data *data= ivug_medialist_get_data(mCurItem); - if(NULL != data) { - if(data->slide_type == SLIDE_TYPE_VIDEO - || data->slide_type == SLIDE_TYPE_STREAMING) { - bShowPlayIcon = true; - } - } - } - - // actor in view is opaque, fading in is transparent - // move front to back, back is now opaque since animation completed - - mInView = mFadingIn; - // make a new actor for image that is going to be displayed - mFadingIn = ImageActor::New( mNextImage ); - // position actor in the middle of root - mFadingIn.SetAnchorPoint( AnchorPoint::CENTER ); - mFadingIn.SetParentOrigin( ParentOrigin::CENTER ); - - // add new actor to front layer - mLayers[ mCurrentLayer ].Add( mFadingIn ); - mLayers[ mCurrentLayer ].Raise(); - // parent borders to top layer - mLayers[ mCurrentLayer ].Add( mBorder1 ); - mLayers[ mCurrentLayer ].Add( mBorder2 ); - // old actor is in back layer - ++mCurrentLayer; - mCurrentLayer %= 2; - mLayers[ mCurrentLayer ].Lower(); - if (mPreIsVideo) { - mVideoLayer.LowerToBottom(); - } - if (mImageActor) { - mImageActor.SetVisible(false); - } - - // fit new and old actor inside preserving aspect ratio - FitViewActorAndBorders(); - bool fadein = true; - // start transition effect - boost::shared_ptr< SlideshowEffect > effect; - if (mEffects.size() > 0) { - effect = mEffects[ mCurrentEffect ]; - if ( effect ) { - if (mbFaceEffect) { - if (mFaceCount > 0) { - mCurrentFace = 1; - } - } - } - } - - if (mFirstImage) { - ; - } else { - //EIGHTY_MILLISECOND used to avoid flashing - if (effect.get()) { - if (mbFaceEffect) { - int face_time = mTransitionTime + FACE_SCALE_DURATION - + EIGHTY_MILLISECOND; - fadein = effect->StartTransition( mInView, mFadingIn, - face_time, mFaceCount); - } else { - /*fix the blink EIGHTY_MILLISECOND*/ - fadein = effect->StartTransition( mInView, mFadingIn, - mTransitionTime + EIGHTY_MILLISECOND, mFaceCount); - } - } - } - - /* first image we don't fade in*/ - if( fadein && !mFirstImage) { - // make fading in invisible (zero alpha) - Vector4 color; - color = Vector4( Color::WHITE ); - color.a = 0; - mFadingIn.SetColor( color ); - // borders black with zero alpha - color = Vector4( Color::BLACK ); - color.a = 0; - mBorder1.SetColor( color ); - mBorder2.SetColor( color ); - // front actor fade in animation - // linear fade in, dali::animation takes seconds thus the divide - mFadeAnimation = Animation::New(float( mTransitionTime ) / SECONDTIME); - mFadeAnimation.OpacityTo( mBorder1, 1.0 ); - mFadeAnimation.OpacityTo( mBorder2, 1.0 ); - mFadeAnimation.OpacityTo( mFadingIn, 1.0 ); - // leave opacity to 1 once animation is done - mFadeAnimation.SetEndAction( Animation::Bake ); - mFadeAnimation.Play(); - } else { - // borders solid black - mBorder1.SetColor( Color::BLACK ); - mBorder2.SetColor( Color::BLACK ); - } - // start timer to call transition completed - if (mbFaceEffect && mFaceCount > 0) { - mFirstFaceTimer.Start(); - } else { - mTransitionTimer.Start(); - } - IVUG_FUNC_LEAVE(); -} - -bool SlideshowControl::TransitionCompleted() -{ - IVUG_FUNC_ENTER(); - MSG_IVUG_HIGH("mCurrentEffect:%d, size:%d",mCurrentEffect, mEffects.size()); - if(mEffects.size() < 1) { - return false; - } - boost::shared_ptr< SlideshowEffect > effect = mEffects[mCurrentEffect]; - if (mbFaceEffect && (!mFirstImage)) { - MSG_IVUG_HIGH("cu face:%d,sum face:%d", mCurrentFace, mFaceCount); - mCurrentFace++; - SlideshowEffect *pare_effect = effect.get(); - if (pare_effect && mCurrentFace <= mFaceCount) { - SlideshowFaceEffect *face_effect = - dynamic_cast(pare_effect); - if (face_effect) { - face_effect->TransitionNextFace(); - mTransitionTimer.Start(); - } - } - } - // complete transition effect - if (!mbFaceEffect || mFirstImage - || (mbFaceEffect && (mCurrentFace > mFaceCount))) { - if (effect) { - effect->TransitionCompleted( mInView, mFadingIn ); - } - - // unparent borders - if (mBorder1.GetParent()) { - mBorder1.GetParent().Remove( mBorder1 ); - } - if (mBorder2.GetParent()) { - mBorder2.GetParent().Remove( mBorder2 ); - } - - // fading in is now fully visible so inview can be removed - if (mInView) { - if (mInView.GetParent()) { - mInView.GetParent().Remove(mInView); - } - } - if (mFirstImage) { - mFirstImage = false; - } - // start loading next image - LoadNextImage(); - // move to next effect - ++mCurrentEffect; - mCurrentEffect %= mEffects.size(); - effect = mEffects[ mCurrentEffect ]; - if( effect ) { - // start viewing mode for the actor with next effect - effect->StartView( mFadingIn, mViewTime ); - } - // start viewing timer - mTimerReady = false; - mViewTimer.Start(); - // tell timer not to call us again - return false; - } - - IVUG_FUNC_LEAVE(); - // tell timer call us again - return true; -} - -bool SlideshowControl::FirstFaceCompleted() -{ - IVUG_FUNC_ENTER(); - MSG_IVUG_HIGH("mCurrentEffect:%d, size:%d",mCurrentEffect, mEffects.size()); - if(mEffects.size() < 1) { - return false; - } - boost::shared_ptr< SlideshowEffect > effect = mEffects[mCurrentEffect]; - // complete transition effect - if(mFaceCount <=1 || mFirstImage) { - if( effect ) { - effect->TransitionCompleted( mInView, mFadingIn ); - } - - // unparent borders - if( mBorder1.GetParent() ) { - mBorder1.GetParent().Remove( mBorder1 ); - } - if( mBorder2.GetParent() ) { - mBorder2.GetParent().Remove( mBorder2 ); - } - - // fading in is now fully visible so inview can be removed - if( mInView ) { - if( mInView.GetParent() ) { - mInView.GetParent().Remove( mInView ); - } - } - if (mFirstImage) { - mFirstImage = false; - } - // start loading next image - LoadNextImage(); - // move to next effect - ++mCurrentEffect; - mCurrentEffect %= mEffects.size(); - effect = mEffects[ mCurrentEffect ]; - if( effect ) { - // start viewing mode for the actor with next effect - effect->StartView( mFadingIn, mViewTime ); - } - // start viewing timer - mTimerReady = false; - mViewTimer.Start(); - - } else { - if (mbFaceEffect) { - MSG_IVUG_HIGH("cu face:%d,sum face:%d", mCurrentFace, mFaceCount); - mCurrentFace++; - SlideshowEffect *pare_effect = effect.get(); - if (pare_effect && mCurrentFace <= mFaceCount) { - SlideshowFaceEffect *face_effect = - dynamic_cast(pare_effect); - if (face_effect) { - face_effect->TransitionNextFace(); - mTransitionTimer.Start(); - } - } - } - } - - IVUG_FUNC_LEAVE(); - // tell timer not to call us again - return false; -} - -void SlideshowControl::FitViewActorAndBorders() -{ - // if actor has been created resize and position it. Its possible - // that actor has not yet been created but we switch orientation - if( mFadingIn ) { - // get image size from the actors image - const ImageAttributes imageAttributes = mFadingIn.GetImage().GetAttributes(); - const Size imageSize( imageAttributes.GetSize() ); - // fit it inside preserving aspect ratio - Size targetSize = Dali::FitInside( mSlideshowSize, imageSize ); - // check whether to fit width or height - float widthScale = mSlideshowSize.width / imageSize.width; - float heightScale = mSlideshowSize.height / imageSize.height; - if( widthScale < heightScale ) { - // fitting width = 1.0f, constrain height - //mFadingIn.ApplyConstraint( ParentConstraint::Size::New( - //Dali::ParentSizeRelative( Vector3( 1.0f, targetSize.height / mSlideshowSize.height, 1.0f ) ) ) ); - mFadingIn.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), RelativeToConstraint( Vector3( 1.0f, targetSize.height / mSlideshowSize.height, 1.0f ) ) ) ); - - // borders top and bottom - // borders are full width and half the full height minus images size - Size bordersize( mSlideshowSize.width, ( mSlideshowSize.height - targetSize.height ) * 0.5f ); - mBorder1.SetSize( bordersize.width, bordersize.height ); - mBorder2.SetSize( bordersize.width, bordersize.height ); - } else { - // fitting height = 1.0f, constrain height - //mFadingIn.ApplyConstraint( ParentConstraint::Size::New( - //Dali::ParentSizeRelative( Vector3( targetSize.width / mSlideshowSize.width, 1.0f, 1.0f ) ) ) ); - mFadingIn.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), RelativeToConstraint( Vector3( targetSize.width / mSlideshowSize.width, 1.0f, 1.0f ) ) ) ); - // fitting height so Borders left and right, resize the borders - // borders are full height and half the full width minus images size - Size bordersize( ( mSlideshowSize.width - targetSize.width ) * 0.5, mSlideshowSize.height ); - mBorder1.SetSize( bordersize.width, bordersize.height ); - mBorder2.SetSize( bordersize.width, bordersize.height ); - } - } - // if we got old actor, position it to new center and resize - // (this is needed for orientation change case) - if( mInView ) { - // get image size - const ImageAttributes imageAttributes = mInView.GetImage().GetAttributes(); - const Size imageSize( imageAttributes.GetSize() ); - // fit it inside preserving aspect ratio - Size targetSize = Dali::FitInside( mSlideshowSize, imageSize ); - // check whether to fit width or height - float widthScale = mSlideshowSize.width / imageSize.width; - float heightScale = mSlideshowSize.height / imageSize.height; - if( widthScale < heightScale ) { - // fitting width = 1.0f, constrain height - //mInView.ApplyConstraint( ParentConstraint::Size::New( - //ParentSizeRelative( Vector3( 1.0f, targetSize.height / mSlideshowSize.height, 1.0f ) ) ) ); - mInView.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), RelativeToConstraint( Vector3( 1.0f, targetSize.height / mSlideshowSize.height, 1.0f ) ) ) ); - } else { - // fitting height = 1.0f, constrain height - //mInView.ApplyConstraint( ParentConstraint::Size::New( - //ParentSizeRelative( Vector3( targetSize.width / mSlideshowSize.width, 1.0f, 1.0f ) ) ) ); - mInView.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), RelativeToConstraint( Vector3( targetSize.width / mSlideshowSize.width, 1.0f, 1.0f ) ) ) ); - } - } -} - -void SlideshowControl::SetViewAndTransitionTime(int time) -{ - if (time > TRANSITIONTIME) { - mViewTime = time - TRANSITIONTIME; - mTransitionTime = TRANSITIONTIME; - } else if (time > SMALL_TRANSITIONTIME){ - mViewTime = time - SMALL_TRANSITIONTIME; - mTransitionTime = SMALL_TRANSITIONTIME; - } else { - mViewTime = time; - mTransitionTime = TRANSITIONTIME; - } - /* mVideoTime = 2*mViewTime + mTransitionTime */ - mVideoTime = time + mViewTime; -} - -void SlideshowControl::NewViewAndTransitionTimer(void) -{ - // create the timers - mViewTimer = Timer::New( mViewTime ); - mViewTimer.SignalTick().Connect( this, &SlideshowControl::TimerTick ); - mTransitionTimer = Timer::New( mTransitionTime ); - mTransitionTimer.SignalTick().Connect(this, &SlideshowControl::TransitionCompleted); - mFirstFaceTimer = Timer::New(mTransitionTime + FACE_SCALE_DURATION); - mFirstFaceTimer.SignalTick().Connect(this, &SlideshowControl::FirstFaceCompleted); -} - -void SlideshowControl::StopViewAndTransitionTimer(void) -{ - mViewTimer.Stop(); - mTransitionTimer.Stop(); - mFirstFaceTimer.Stop(); -} - -void SlideshowControl::CreatePixmapImage() -{ - //IVUG_FUNC_ENTER(); - if(!mImageActor) { - MSG_IVUG_HIGH("***************_mImageActor = NULL"); - boost::any anyPix = mXPixmap; - // create the PixmapImage object - Adaptor *adaptor = mSSHandle->adaptor; - if (!adaptor) { - return; - } - PixmapImagePtr PixmapImage = PixmapImage::New(anyPix, *adaptor); - if (PixmapImage) { - mVideoImage = Image::New(*PixmapImage); - mImageActor = ImageActor::New(mVideoImage); - } - if (mImageActor) { - mImageActor.SetSize(mVideoWidth, mVideoHeight); - - // Center the image - mImageActor.SetAnchorPoint(AnchorPoint::CENTER); - mImageActor.SetParentOrigin(ParentOrigin::CENTER); - mImageActor.SetPosition(0.0f, 0.0f); - Vector4 color; - color = Vector4(Color::TRANSPARENT); - mBorder2.SetColor(color); - // Display the actor on the stage - mVideoLayer.Add(mImageActor); - mAnimVideo = Animation::New((float)mVideoTime/(SECONDTIME*2.0)); - mAnimVideo.SetLooping(true); - //mAnimVideo.RotateTo(mImageActor, Degree(0), Vector3(0.0f, 0.0f, 0.0f), AlphaFunctions::Bounce); - //mAnimVideo.MoveTo(mImageActor, Vector3(20, 20, 200), AlphaFunctions::Bounce); - mAnimVideo.Play(); - } - } - //IVUG_FUNC_LEAVE(); -} - - -static Eina_Bool -pixmap_update (void *data, int type, void *event) -{ - /** - * This function means video steam was updated. - * We can do something to let dali know the updating. - */ - SlideshowControl* ssc = (SlideshowControl*)data; - if (ssc) { - ssc->CreatePixmapImage(); - } - return ECORE_CALLBACK_PASS_ON; -} - -void SlideshowControl::CreateXHPixmap() -{ - IVUG_FUNC_ENTER(); - - // create the PixmapImage object - if(NULL == mSSHandle) { - return; - } - - if(!mXPixmap) - { - mXPixmap = ecore_x_pixmap_new(mSSHandle->xwin, mVideoWidth, mVideoHeight, - ecore_x_default_depth_get(ecore_x_display_get(), ecore_x_default_screen_get())); - } - // Default the foreground is black is the same with the background color. - unsigned int foreground; - Ecore_X_GC gc; - foreground = 0x000000; - gc = ecore_x_gc_new(mXPixmap, - ECORE_X_GC_VALUE_MASK_FOREGROUND, - &foreground); - ecore_x_drawable_rectangle_fill((Ecore_X_Drawable)mXPixmap, gc, 0, 0, mVideoWidth, mVideoHeight); - ecore_x_gc_free(gc); - ecore_x_sync(); - - //reset - if (mEventHandler) { - ecore_event_handler_del(mEventHandler); - } - if (mDamage){ - ecore_x_damage_free(mDamage); - } - - //new - mDamage = ecore_x_damage_new (mXPixmap, ECORE_X_DAMAGE_REPORT_RAW_RECTANGLES); - mEventHandler = ecore_event_handler_add (ECORE_X_EVENT_DAMAGE_NOTIFY, pixmap_update, this); - mSSHandle->xPixmapId = mXPixmap; - - MSG_IVUG_HIGH("**********mSSHandle->xPixmapId = %d", mSSHandle->xPixmapId); - - IVUG_FUNC_LEAVE(); - -} - -} // namespace Imageview3D diff --git a/slideshow/src/dali_effect/src/ivug-slideshow-effect.cpp b/slideshow/src/dali_effect/src/ivug-slideshow-effect.cpp deleted file mode 100644 index 7fbea06..0000000 --- a/slideshow/src/dali_effect/src/ivug-slideshow-effect.cpp +++ /dev/null @@ -1,1358 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -// CLASS HEADER -#include "ivug-slideshow-effect.h" -#include - -// EXTERNAL INCLUDES - -// INTERNAL INCLUDES -#include "ivug-includes.h" -#include "ivug-constraints.h" -#include "ivug-debug.h" -#include "ivug-dali-util.h" -#include "ivug-slideshow-face.h" -#include "ivug-water-ripple-effect.h" - -#define IMAGE_PATH PREFIX"/res/images/"PACKAGE -#define DEFAULT_NOISE_PATH IMAGE_PATH"/T01_Noise.png" - -// LOCAL STUFF -namespace -{ - - static float ReverseEaseIn(float progress) - { - return 1.0f - (progress * progress * progress); - } - - static void AnimateTo( Dali::Animation & dali_animation,ShaderEffect& shaderEffect, const std::string& name, Property::Value propertyValue/*float value*/){ - - Property::Index index = shaderEffect.GetPropertyIndex( name ); - if ( Property::INVALID_INDEX == index ){ - index = shaderEffect.RegisterProperty( name, propertyValue ); - } - Property target = Property(shaderEffect,index); - dali_animation.AnimateTo(target, propertyValue); - } - -} // end LOCAL STUFF - -using namespace Dali; -using namespace Dali::Toolkit; -using namespace std; - -namespace Imageview3D -{ - -/** - * Ripple Slideshow effect - */ -class RippleFadeEffect : public SlideshowEffect -{ -public: // API - - /** - * Constructor - */ - RippleFadeEffect( float amplitude ) - { - mEffect = Dali::Toolkit::RippleEffect::New(); - mAmplitude = amplitude; - } - - /** - * Destructor - */ - virtual ~RippleFadeEffect() - { - IVUG_FUNC_ENTER(); - //mActorAnimation.Pause(); - IVUG_FUNC_LEAVE(); - } - - virtual void Stop() - { - mActorAnimation.Stop(); - } - - virtual void SetImageSize(const char *path) - { - } - -private: // From SlideshowEffect - - virtual std::string Name() - { - return RIPPLE_FADE_EFFECT_NAME; - } - - /** - * @copydoc SlideshowEffect::Initialize - */ - virtual void Initialize( Dali::Vector3 center ) - { - mCenter = Vector2(center.x, center.y); - } - - /** - * @copydoc SlideshowEffect::StartView - */ - virtual void StartView( Dali::ImageActor /*newActor*/, unsigned int /*duration*/ ) - { } - - /** - * @copydoc SlideshowEffect::StartTransition - */ - virtual bool StartTransition( Dali::ImageActor oldActor, - Dali::ImageActor newActor, - unsigned int duration, - int face_count) - { - mActorAnimation = Animation::New( duration / SECONDTIME ); // to seconds - mActorAnimation.SetEndAction(Animation::Discard); - mEffect.SetAmplitude( mAmplitude ); - mEffect.SetCenter( mCenter ); - float uTime = 2.0f * Math::PI * ((float)duration) / 1024.0f; - mEffect.SetTime( uTime ); - if ( oldActor ) { - oldActor.SetShaderEffect( mEffect ); - } - Property::Value propertyValue(0.0f); - AnimateTo(mActorAnimation,mEffect, mEffect.GetTimePropertyName(),propertyValue); - //mActorAnimation.AnimateProperty(mEffect, mEffect.GetTimePropertyName(), 0.0f); - mActorAnimation.Play(); - return true; // x-fade - } - - /** - * @copydoc SlideshowEffect::TransitionCompleted - */ - virtual void TransitionCompleted( Dali::ImageActor oldActor, Dali::ImageActor newActor ) - { - if( oldActor ) - { - oldActor.RemoveShaderEffect(); - } - newActor.RemoveShaderEffect(); - } - -private: // Data - - Dali::Toolkit::RippleEffect mEffect; - Dali::Vector2 mCenter; - float mAmplitude; - Dali::Animation mActorAnimation; - -}; - -/** - * Dissolve slideshow effect - */ -class DissolveEffect : public SlideshowEffect -{ -public: // API - - /** - * Constructor - * @param randomize the pixel dissolve - */ - DissolveEffect( bool randomize ) - : mRandomize( randomize ) - { - mEffect = Dali::Toolkit::DissolveEffect::New(); - } - - /** - * Destructor - */ - virtual ~DissolveEffect() - { - IVUG_FUNC_ENTER(); - //mAnimation.Pause(); - IVUG_FUNC_LEAVE(); - } - virtual void Stop() - { - mAnimation.Stop(); - } - - virtual void SetImageSize(const char *path) - { - } - -private: // From SlideshowEffect - - virtual std::string Name() - { - return DISSOLVE_EFFECT_NAME; - } - - /** - * @copydoc SlideshowEffect::Initialize - */ - virtual void Initialize( Dali::Vector3 size ) - { - if( mRandomize ) - { - // on C110 only power of two bitmap updates are supported - int width = Dali::NextPowerOfTwo( size.width * 0.5f ); - int height = Dali::NextPowerOfTwo( size.height * 0.5f ); - mImage = BitmapImage::New( width, height ); - PixelBuffer* ptr = mImage.GetBuffer(); - for( unsigned int i = 0; i < mImage.GetBufferSize(); ++i ) - { - *ptr++ = rand(); - } - // update the buffer - mImage.BufferUpdated(); - mEffect.SetEffectImage( mImage ); - } - } - - /** - * @copydoc SlideshowEffect::StartView - */ - virtual void StartView( Dali::ImageActor /*newActor*/, unsigned int /*duration*/ ) - { } - -/** -* @copydoc SlideshowEffect::StartTransition -*/ - virtual bool StartTransition( Dali::ImageActor oldActor, - Dali::ImageActor newActor, - unsigned int duration, - int face_count) - { - mEffect.SetDistortion(0.0f); - - if( oldActor ) - { - oldActor.SetShaderEffect( mEffect ); - } - - mAnimation = Animation::New(duration / SECONDTIME); // to seconds - Property::Value propertyValue(1.0f); - AnimateTo(mAnimation,mEffect, mEffect.GetDistortionPropertyName(),propertyValue); - //mAnimation.AnimateProperty(mEffect, mEffect.GetDistortionPropertyName(), 1.0f); - mAnimation.Play(); - - return true; // x-fade - } - - /** - * @copydoc SlideshowEffect::TransitionCompleted - */ - virtual void TransitionCompleted( Dali::ImageActor oldActor, Dali::ImageActor /*newActor*/ ) - { - if( oldActor ) - { - // no recurse - oldActor.RemoveShaderEffect(); - } - } - -private: // Data - - bool mRandomize; - Dali::Toolkit::DissolveEffect mEffect; - Dali::BitmapImage mImage; - Dali::Animation mAnimation; -}; - -/** - * Image Zoom slide show effect - */ -class ZoomEffect : public SlideshowEffect -{ -public: // API - - /** - * Constructor - */ - ZoomEffect() - { } - - /** - * Destructor - */ - virtual ~ZoomEffect() - { - IVUG_FUNC_ENTER(); - //mAnimation.Pause(); - IVUG_FUNC_LEAVE(); - } - - virtual void Stop() - { - mAnimation.Stop(); - } - - virtual void SetImageSize(const char *path) - { - } - -private: // From SlideshowEffect - - virtual std::string Name() - { - return ZOOM_EFFECT_NAME; - } - - /** - * @copydoc SlideshowEffect::Initialize - */ - virtual void Initialize( Dali::Vector3 /*size*/ ) - { } - - /** - * @copydoc SlideshowEffect::StartView - */ - virtual void StartView( Dali::ImageActor /*newActor*/, unsigned int /*duration*/ ) - { } - - /** - * @copydoc SlideshowEffect::StartTransition - */ - - virtual bool StartTransition( Dali::ImageActor oldActor, - Dali::ImageActor newActor, - unsigned int duration, - int face_count) - { - mAnimation = Animation::New(duration/(2*SECONDTIME)); // change to seconds and half the transition - if( oldActor ) - { - // old actor zooms and rotates away - mAnimation.MoveBy( oldActor, 0.0f, 0.0f, 500.0f ); - mAnimation.OpacityTo( oldActor, 0.0f ); - mAnimation.RotateBy( oldActor, Radian(Math::PI*0.5), Vector3::ZAXIS); - mAnimation.SetEndAction( Animation::Bake ); - } - if( newActor ) - { - // new actor zooms in and rotates - mAnimation.MoveBy( newActor, Vector3(0.0f, 0.0f, -500), ReverseEaseIn ); - mAnimation.OpacityTo( newActor, 0.0f, ReverseEaseIn ); - mAnimation.RotateBy( newActor, Radian(-Math::PI*0.5), Vector3::ZAXIS, ReverseEaseIn ); - mAnimation.SetEndAction( Animation::Bake ); - } - mAnimation.Play(); - - return false; // with x fade - } - - /** - * @copydoc SlideshowEffect::TransitionCompleted - */ - virtual void TransitionCompleted( Dali::ImageActor oldActor, Dali::ImageActor newActor ) - { - } - -private: // Data - - Animation mAnimation; -}; - -/** - * Image Split slide show effect - */ -class SplitEffect : public SlideshowEffect -{ -public: // API - - /** - * Constructor - */ - SplitEffect() - { - mPlaceholder = BitmapImage::WHITE(); - } - - /** - * Destructor - */ - virtual ~SplitEffect() - { - //mAnimation.Pause(); - } - - - virtual void Stop() - { - mAnimation.Stop(); - } - - virtual void SetImageSize(const char *path) - { - } - -private: // From SlideshowEffect - - virtual std::string Name() - { - return SPLIT_EFFECT_NAME; - } - - /** - * @copydoc SlideshowEffect::Initialize - */ - virtual void Initialize( Dali::Vector3 /*size*/ ) - { - mLayer = Layer::New(); - mLayer.SetParentOrigin( ParentOrigin::CENTER ); - mLayer.SetAnchorPoint( AnchorPoint::CENTER ); - mOldActorSlices[ 0 ] = ImageActor::New(mPlaceholder); - mOldActorSlices[ 1 ] = ImageActor::New(mPlaceholder); - mOldActorSlices[ 2 ] = ImageActor::New(mPlaceholder); - mOldActorSlices[ 3 ] = ImageActor::New(mPlaceholder); - mOldActorSlices[ 4 ] = ImageActor::New(mPlaceholder); - mOldActorSlices[ 0 ].SetParentOrigin( ParentOrigin::CENTER ); - mOldActorSlices[ 0 ].SetAnchorPoint( AnchorPoint::CENTER ); - mOldActorSlices[ 1 ].SetParentOrigin( ParentOrigin::CENTER ); - mOldActorSlices[ 1 ].SetAnchorPoint( AnchorPoint::CENTER ); - mOldActorSlices[ 2 ].SetParentOrigin( ParentOrigin::CENTER ); - mOldActorSlices[ 2 ].SetAnchorPoint( AnchorPoint::CENTER ); - mOldActorSlices[ 3 ].SetParentOrigin( ParentOrigin::CENTER ); - mOldActorSlices[ 3 ].SetAnchorPoint( AnchorPoint::CENTER ); - mOldActorSlices[ 4 ].SetParentOrigin( ParentOrigin::CENTER ); - mOldActorSlices[ 4 ].SetAnchorPoint( AnchorPoint::CENTER ); - mOldActorSlices[ 0 ].SetColorMode( Dali::USE_OWN_COLOR ); - mOldActorSlices[ 1 ].SetColorMode( Dali::USE_OWN_COLOR ); - mOldActorSlices[ 2 ].SetColorMode( Dali::USE_OWN_COLOR ); - mOldActorSlices[ 3 ].SetColorMode( Dali::USE_OWN_COLOR ); - mOldActorSlices[ 4 ].SetColorMode( Dali::USE_OWN_COLOR ); - mLayer.Add( mOldActorSlices[ 0 ] ); - mLayer.Add( mOldActorSlices[ 1 ] ); - mLayer.Add( mOldActorSlices[ 2 ] ); - mLayer.Add( mOldActorSlices[ 3 ] ); - mLayer.Add( mOldActorSlices[ 4 ] ); - } - - /** - * @copydoc SlideshowEffect::StartView - */ - virtual void StartView( Dali::ImageActor /*newActor*/, unsigned int /*duration*/ ) - { } - - /** - * @copydoc SlideshowEffect::StartTransition - */ - virtual bool StartTransition( Dali::ImageActor oldActor, - Dali::ImageActor newActor, - unsigned int duration, - int face_count) - { - if( oldActor ) - { - // get the image of the old actor - Image oldImage = oldActor.GetImage(); - ImageAttributes attr = oldImage.GetAttributes(); - // image is loaded at this point - float sliceWidth = float( attr.GetSize().width ) * 0.2f; - - Rect pixels1( sliceWidth * 0.0f, 0, sliceWidth, attr.GetSize().height ); - Rect pixels2( sliceWidth * 1.0f, 0, sliceWidth, attr.GetSize().height ); - Rect pixels3( sliceWidth * 2.0f, 0, sliceWidth, attr.GetSize().height ); - Rect pixels4( sliceWidth * 3.0f, 0, sliceWidth, attr.GetSize().height ); - Rect pixels5( sliceWidth * 4.0f, 0, sliceWidth, attr.GetSize().height ); - - mOldActorSlices[ 0 ].SetImage( oldImage ); - mOldActorSlices[ 1 ].SetImage( oldImage ); - mOldActorSlices[ 2 ].SetImage( oldImage ); - mOldActorSlices[ 3 ].SetImage( oldImage ); - mOldActorSlices[ 4 ].SetImage( oldImage ); - - mOldActorSlices[ 0 ].SetPixelArea( pixels1 ); - mOldActorSlices[ 1 ].SetPixelArea( pixels2 ); - mOldActorSlices[ 2 ].SetPixelArea( pixels3 ); - mOldActorSlices[ 3 ].SetPixelArea( pixels4 ); - mOldActorSlices[ 4 ].SetPixelArea( pixels5 ); - - // hide old full screen picture - oldActor.SetImage( mPlaceholder ); - oldActor.SetColor( Vector4( 0, 0, 0, 0 ) ); - - oldActor.Add( mLayer ); - mLayer.MoveAbove( newActor.GetLayer() ); - // constrain to same size as parent actor - mLayer.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); - - - mOldActorSlices[ 0 ].RemoveConstraints(); - mOldActorSlices[ 1 ].RemoveConstraints(); - mOldActorSlices[ 2 ].RemoveConstraints(); - mOldActorSlices[ 3 ].RemoveConstraints(); - mOldActorSlices[ 4 ].RemoveConstraints(); - - mOldActorSlices[ 0 ].ApplyConstraint( Constraint::New( Actor::POSITION,ParentSource( Actor::SIZE ),PercentageOfParentWidth( -2 * 0.2f ))); - mOldActorSlices[ 1 ].ApplyConstraint( Constraint::New( Actor::POSITION,ParentSource( Actor::SIZE ),PercentageOfParentWidth( -1 * 0.2f ))); - mOldActorSlices[ 2 ].ApplyConstraint( Constraint::New( Actor::POSITION,ParentSource( Actor::SIZE ),PercentageOfParentWidth( 0 * 0.2f ))); - mOldActorSlices[ 3 ].ApplyConstraint( Constraint::New( Actor::POSITION,ParentSource( Actor::SIZE ),PercentageOfParentWidth( 1 * 0.2f ))); - mOldActorSlices[ 4 ].ApplyConstraint( Constraint::New( Actor::POSITION,ParentSource( Actor::SIZE ),PercentageOfParentWidth( 2 * 0.2f ))); - - mOldActorSlices[ 0 ].ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), RelativeToConstraint( Vector3( 0.2f, 1.0f, 1.0f ) ) ) ); - mOldActorSlices[ 1 ].ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), RelativeToConstraint( Vector3( 0.2f, 1.0f, 1.0f ) ) ) ); - mOldActorSlices[ 2 ].ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), RelativeToConstraint( Vector3( 0.2f, 1.0f, 1.0f ) ) ) ); - mOldActorSlices[ 3 ].ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), RelativeToConstraint( Vector3( 0.2f, 1.0f, 1.0f ) ) ) ); - mOldActorSlices[ 4 ].ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), RelativeToConstraint( Vector3( 0.2f, 1.0f, 1.0f ) ) ) ); - - mOldActorSlices[ 0 ].SetColor( Vector4( 1, 1, 1, 1 ) ); - mOldActorSlices[ 1 ].SetColor( Vector4( 1, 1, 1, 1 ) ); - mOldActorSlices[ 2 ].SetColor( Vector4( 1, 1, 1, 1 ) ); - mOldActorSlices[ 3 ].SetColor( Vector4( 1, 1, 1, 1 ) ); - mOldActorSlices[ 4 ].SetColor( Vector4( 1, 1, 1, 1 ) ); - - mOldActorSlices[ 0 ].SetRotation( Degree(0.0f), Vector3::YAXIS ); - mOldActorSlices[ 1 ].SetRotation( Degree(0.0f), Vector3::YAXIS ); - mOldActorSlices[ 2 ].SetRotation( Degree(0.0f), Vector3::YAXIS ); - mOldActorSlices[ 3 ].SetRotation( Degree(0.0f), Vector3::YAXIS ); - mOldActorSlices[ 4 ].SetRotation( Degree(0.0f), Vector3::YAXIS ); - - newActor.SetColor( Vector4( 1, 1, 1, 0 ) ); - - mAnimation = Animation::New(duration / 1000.0f); // milliseconds => seconds - - mAnimation.OpacityTo( mOldActorSlices[ 0 ], 0.5f, AlphaFunctions::Linear ); - mAnimation.OpacityTo( mOldActorSlices[ 1 ], 0.5f, AlphaFunctions::Linear ); - mAnimation.OpacityTo( mOldActorSlices[ 2 ], 0.5f, AlphaFunctions::Linear ); - mAnimation.OpacityTo( mOldActorSlices[ 3 ], 0.5f, AlphaFunctions::Linear ); - mAnimation.OpacityTo( mOldActorSlices[ 4 ], 0.5f, AlphaFunctions::Linear ); - - mAnimation.RotateBy( mOldActorSlices[ 0 ], Degree(-90.0f), Vector3::YAXIS, AlphaFunctions::EaseIn ); - mAnimation.RotateBy( mOldActorSlices[ 1 ], Degree(-90.0f), Vector3::YAXIS, AlphaFunctions::EaseIn ); - mAnimation.RotateBy( mOldActorSlices[ 2 ], Degree(-90.0f), Vector3::YAXIS, AlphaFunctions::EaseIn ); - mAnimation.RotateBy( mOldActorSlices[ 3 ], Degree(-90.0f), Vector3::YAXIS, AlphaFunctions::EaseIn ); - mAnimation.RotateBy( mOldActorSlices[ 4 ], Degree(-90.0f), Vector3::YAXIS, AlphaFunctions::EaseIn ); - - mAnimation.OpacityTo( newActor, 1.0f, AlphaFunctions::EaseIn ); - mAnimation.MoveBy( newActor, Vector3(0.0f, 0.0f, -100), ReverseEaseIn ); - - mAnimation.Play(); - } - - return false; // no x fade - } - - /** - * @copydoc SlideshowEffect::TransitionCompleted - */ - virtual void TransitionCompleted( Dali::ImageActor oldActor, Dali::ImageActor newActor ) - { - if( oldActor ) - { - oldActor.Remove( mLayer ); - } - } - - private: // Data - - Dali::Layer mLayer; - Dali::Image mPlaceholder; - Dali::ImageActor mOldActorSlices[ 5 ]; - - Dali::Animation mAnimation; - -}; - -/** -* Swirl effect for slideshow -*/ -class SwirlEffect : public SlideshowEffect -{ -public: // API - - /** - * Constructor - * @param warp a bit more - */ - SwirlEffect( bool warp ) - { - - mShaderEffect = Dali::Toolkit::SwirlEffect::New(warp); - mShaderEffectNew = Dali::Toolkit::SwirlEffect::New(warp); - - // set uniforms - mShaderEffect.SetAngle(0.0f); - mShaderEffectNew.SetAngle(2.0f); - } - - /** - * Destructor - */ - virtual ~SwirlEffect() - { - IVUG_FUNC_ENTER(); - //mAnimation.Pause(); - } - - virtual void Stop() - { - mAnimation.Stop(); - } - - virtual void SetImageSize(const char *path) - { - } - -private: // From SlideshowEffect - - virtual std::string Name() - { - return SWIRL_EFFECT_NAME; - } - - /** - * @copydoc SlideshowEffect::Initialize - */ - virtual void Initialize( Dali::Vector3 size ) - { - } - - /** - * @copydoc SlideshowEffect::StartView - */ - virtual void StartView( Dali::ImageActor /*newActor*/, unsigned int /*duration*/ ) - { } - - /** - * @copydoc SlideshowEffect::StartTransition - */ - virtual bool StartTransition( Dali::ImageActor oldActor, - Dali::ImageActor newActor, - unsigned int duration, - int face_count) - { - IVUG_FUNC_ENTER(); - mAnimation = Animation::New( duration / SECONDTIME ); // to seconds - mAnimation.SetEndAction(Animation::Discard); - if( oldActor ) { - // get the image of the old actor - Image oldImage = oldActor.GetImage(); - ImageAttributes attr = oldImage.GetAttributes(); - // set uniforms, need power of two of the texture for size, center in middle of image - Vector2 imageSize( attr.GetSize() ); - Vector2 imageSizePow2( Dali::NextPowerOfTwo( attr.GetSize().width ), Dali::NextPowerOfTwo( attr.GetSize().height ) ); - Vector2 adjusted( imageSize.x / imageSizePow2.x, imageSize.y / imageSizePow2.y ); - Vector2 center( adjusted.width * 0.5f, adjusted.height * 0.5f ); - - mShaderEffect.SetRadius( std::max( adjusted.width, adjusted.height ) ); - mShaderEffect.SetCenter( center ); - - // apply shader effect - oldActor.SetShaderEffect(mShaderEffect); - // animate swirl - Property::Value propertyValue(2.0f); - AnimateTo(mAnimation,mShaderEffect, mShaderEffect.GetAnglePropertyName(),propertyValue); - //mAnimation.AnimateProperty(mShaderEffect, mShaderEffect.GetAnglePropertyName(), 2.0f); - } - if( newActor ) { - // get the image of the old actor - Image newImage = newActor.GetImage(); - ImageAttributes attr = newImage.GetAttributes(); - // set uniforms, need power of two of the texture for size, center in middle of image - Vector2 imageSize( attr.GetSize() ); - Vector2 imageSizePow2( Dali::NextPowerOfTwo( attr.GetSize().width ), Dali::NextPowerOfTwo( attr.GetSize().height ) ); - Vector2 adjusted( imageSize.x / imageSizePow2.x, imageSize.y / imageSizePow2.y ); - Vector2 center( adjusted.width * 0.5f, adjusted.height * 0.5f ); - - mShaderEffectNew.SetRadius( std::max( adjusted.width, adjusted.height ) ); - mShaderEffectNew.SetCenter( center ); - - // apply shader effect - newActor.SetShaderEffect(mShaderEffectNew); - // animate swirl - Property::Value propertyValue(0.0f); - AnimateTo(mAnimation,mShaderEffectNew, mShaderEffectNew.GetAnglePropertyName(),propertyValue); - //mAnimation.AnimateProperty(mShaderEffectNew, mShaderEffectNew.GetAnglePropertyName(), 0.0f); - } - mAnimation.Play(); - IVUG_FUNC_LEAVE(); - - return true; // with x fade - } - - /** - * @copydoc SlideshowEffect::TransitionCompleted - */ - virtual void TransitionCompleted( Dali::ImageActor oldActor, Dali::ImageActor newActor ) - { - if( oldActor ) - { - // remove shader - oldActor.RemoveShaderEffect(); - // reset angle - mShaderEffect.SetAngle( 0.0f ); - } - if( newActor ) - { - // remove shader - newActor.RemoveShaderEffect(); - // reset angle - mShaderEffectNew.SetAngle( 2.0f ); - } - } - -private: // Data - - Animation mAnimation; - Dali::Toolkit::SwirlEffect mShaderEffect; - Dali::Toolkit::SwirlEffect mShaderEffectNew; - -}; - -#if 0 -/*if need this effect,please open it*/ -/** -* WaterRippleEffectExtension for slideshow -* this is a new effect. -*/ -class WaterRippleEffectExtension: public SlideshowEffect -{ -public: // API - - /** - * Constructor - */ - WaterRippleEffectExtension() - { - mShaderEffect = WaterEffect::New(1); - } - - /** - * Destructor - */ - virtual ~WaterRippleEffectExtension() - { - //mActorAnimation.Pause(); - } - - virtual void Stop() - { - mActorAnimation.Stop(); - } - - virtual void SetImageSize(const char *path) - { - } - - -private: // From SlideshowEffect - - virtual std::string Name() - { - return WATER_RIPPLE_EFFECT_NAME; - } - - /** - * @copydoc SlideshowEffect::Initialize - */ - virtual void Initialize( Dali::Vector3 /*size*/ ) - { } - - /** - * @copydoc SlideshowEffect::StartView - */ - virtual void StartView( Dali::ImageActor /*newActor*/, unsigned int /*duration*/ ) - { } - - /** - * @copydoc SlideshowEffect::StartTransition - */ - virtual bool StartTransition( Dali::ImageActor oldActor, - Dali::ImageActor newActor, - unsigned int duration, - int face_count) - { - mActorAnimation = Animation::New( duration / SECONDTIME ); // to seconds - mActorAnimation.SetEndAction(Animation::Discard); - if (oldActor) { - // get the image of the old actor - Dali::Vector3 size_new = oldActor.GetCurrentSize(); - //mShaderEffect.SetTextureSize(imageSize); - Dali::Vector3 position_new = oldActor.GetCurrentPosition(); - oldActor.SetShaderEffect(mShaderEffect); - Dali::Vector2 center_new(position_new.x, position_new.y); - mShaderEffect.SetCenter(0, center_new); - mShaderEffect.SetPropagation(0, 2.0f); - mShaderEffect.SetAmplitude(0, 3.0f); - - // animate ripple - mActorAnimation.AnimateProperty(mShaderEffect, mShaderEffect.GetPropagationPropertyName(0), - std::max(size_new.width, size_new.height),Dali::AlphaFunctions::Linear); - mActorAnimation.AnimateProperty(mShaderEffect, mShaderEffect.GetAmplitudePropertyName(0), - 0.0f, Dali::AlphaFunctions::EaseOut); - } - mActorAnimation.Play(); - - return true; // with x fade - } - - /** - * @copydoc SlideshowEffect::TransitionCompleted - */ - virtual void TransitionCompleted( Dali::ImageActor oldActor, Dali::ImageActor newActor ) - { - if( oldActor ) - { - // remove shader - oldActor.RemoveShaderEffect(); - } - } - -private: // Data - - Dali::Animation mActorAnimation; - - Dali::Toolkit::WaterEffect mShaderEffect; - -}; -#endif - -/** -* 2D ripple effect for slideshow -*/ -class WaterRippleEffect : public SlideshowEffect -{ -public: // API - - /** - * Constructor - */ - WaterRippleEffect() - { - mShaderEffect = WaterEffectRipple2D::New(); - mShaderEffect.SetTime( 0.0f ); - mShaderEffect.SetAmplitude( 0.0f ); - - mShaderEffectNew = WaterEffectRipple2D::New(); - // reset time and amplitude - mShaderEffectNew.SetTime( 5.0f ); - mShaderEffectNew.SetAmplitude( 0.10f ); - } - - /** - * Destructor - */ - virtual ~WaterRippleEffect() - { - //mActorAnimation.Pause(); - } - - virtual void Stop() - { - mActorAnimation.Stop(); - } - - virtual void SetImageSize(const char *path) - { - } - - -private: // From SlideshowEffect - - virtual std::string Name() - { - return WATER_RIPPLE_EFFECT_NAME; - } - - /** - * @copydoc SlideshowEffect::Initialize - */ - virtual void Initialize( Dali::Vector3 /*size*/ ) - { } - - /** - * @copydoc SlideshowEffect::StartView - */ - virtual void StartView( Dali::ImageActor /*newActor*/, unsigned int /*duration*/ ) - { } - - /** - * @copydoc SlideshowEffect::StartTransition - */ - virtual bool StartTransition( Dali::ImageActor oldActor, - Dali::ImageActor newActor, - unsigned int duration, - int face_count) - { - mActorAnimation = Animation::New( duration / SECONDTIME ); // to seconds - mActorAnimation.SetEndAction(Animation::Discard); - if( oldActor ) - { - // get the image of the old actor - Image oldImage = oldActor.GetImage(); - ImageAttributes attr = oldImage.GetAttributes(); - // apply shader effect - oldActor.SetShaderEffect(mShaderEffect); - Vector2 imageSize(attr.GetSize()); - Vector2 imageSizePow2(Dali::NextPowerOfTwo( attr.GetSize().width ), Dali::NextPowerOfTwo( attr.GetSize().height )); - mShaderEffect.SetTextureSize(Vector2( imageSize.x / imageSizePow2.x, imageSize.y / imageSizePow2.y )); - // set uniforms - //mShaderEffect.SetTextureScale(0.2); - // animate ripple - Property::Value propertyValue(5.0f); - AnimateTo(mActorAnimation,mShaderEffect, mShaderEffect.GetTimePropertyName(),propertyValue); - //mActorAnimation.AnimateProperty(mShaderEffect, mShaderEffect.GetTimePropertyName(), 5.0f); - Property::Value propertyValue1(0.10f); - AnimateTo(mActorAnimation,mShaderEffect, mShaderEffect.GetAmplitudePropertyName(),propertyValue1); - //mActorAnimation.AnimateProperty(mShaderEffect, mShaderEffect.GetAmplitudePropertyName(), 0.10f); - - } - if( newActor ) - { - // apply shader effect - Image newImage = newActor.GetImage(); - ImageAttributes attr = newImage.GetAttributes(); - newActor.SetShaderEffect(mShaderEffectNew); - // set uniforms - Vector2 imageSize(attr.GetSize()); - Vector2 imageSizePow2( Dali::NextPowerOfTwo(attr.GetSize().width), Dali::NextPowerOfTwo(attr.GetSize().height)); - mShaderEffectNew.SetTextureSize( Vector2( imageSize.x / imageSizePow2.x, imageSize.y / imageSizePow2.y ) ); - - //mShaderEffectNew.SetTextureScale(0.2); - // animate ripple, reverse from old images - Property::Value propertyValue(0.0f); - AnimateTo(mActorAnimation,mShaderEffectNew, mShaderEffectNew.GetTimePropertyName(),propertyValue); - //mActorAnimation.AnimateProperty(mShaderEffectNew, mShaderEffectNew.GetTimePropertyName(), 0.0f); - Property::Value propertyValue1(0.0f); - AnimateTo(mActorAnimation,mShaderEffectNew, mShaderEffectNew.GetAmplitudePropertyName(),propertyValue1); - //mActorAnimation.AnimateProperty(mShaderEffectNew, mShaderEffectNew.GetAmplitudePropertyName(), 0.0f); - } - mActorAnimation.Play(); - - return true; // with x fade - } - - /** - * @copydoc SlideshowEffect::TransitionCompleted - */ - virtual void TransitionCompleted( Dali::ImageActor oldActor, Dali::ImageActor newActor ) - { - if( oldActor ) - { - // remove shader - oldActor.RemoveShaderEffect(); - // reset time and amplitude - mShaderEffect.SetTime( 0.0f ); - mShaderEffect.SetAmplitude( 0.0f ); - } - if( newActor ) - { - // remove shader - newActor.RemoveShaderEffect(); - // reset time and amplitude - mShaderEffectNew.SetTime( 5.0f ); - mShaderEffectNew.SetAmplitude( 0.10f ); - } - } - -private: // Data - - Dali::Animation mActorAnimation; - - Dali::Toolkit::WaterEffectRipple2D mShaderEffect; - Dali::Toolkit::WaterEffectRipple2D mShaderEffectNew; - -}; - -/** - * Image Slide slide show effect - */ -class SlideEffect : public SlideshowEffect -{ -public: // API - /** - * Constructor - */ - SlideEffect() - { - } - /** - * Destructor - */ - virtual ~SlideEffect() - { - //mAnimation.Pause(); - } - - virtual void Stop() - { - mAnimation.Stop(); - } - - virtual void SetImageSize(const char *path) - { - } - -private: // From SlideshowEffect - - virtual std::string Name() - { - return SLIDE_EFFECT_NAME; - } - /** - * @copydoc SlideshowEffect::Initialize - */ - virtual void Initialize( Dali::Vector3 /*size*/ ) - { - } - - /** - * @copydoc SlideshowEffect::StartView - */ - virtual void StartView( Dali::ImageActor /*newActor*/, unsigned int /*duration*/ ) - { } - /** - * @copydoc SlideshowEffect::StartTransition - */ - virtual bool StartTransition( Dali::ImageActor oldActor, - Dali::ImageActor newActor, - unsigned int duration, - int face_count) - { - mAnimation = Animation::New(duration /(2*SECONDTIME)); // change to seconds and half the transition - if(oldActor) - { - // old actor slides and rotates away - mAnimation.MoveBy( oldActor, -500.0f, 0.0f, 0.0f ); - mAnimation.OpacityTo( oldActor, 0.0f ); - mAnimation.SetEndAction( Animation::Bake ); - } - if(newActor) - { - // new actor zooms in and rotates - mAnimation.MoveBy( newActor, Vector3(500.0f, 0.0f, 0.0f), ReverseEaseIn ); - mAnimation.OpacityTo( newActor, 0.0f, ReverseEaseIn ); - mAnimation.SetEndAction( Animation::Bake ); - } - mAnimation.Play(); - return false; // no x fade - - } - /** - * @copydoc SlideshowEffect::TransitionCompleted - */ - virtual void TransitionCompleted( Dali::ImageActor oldActor, Dali::ImageActor newActor ) - { - if( oldActor ) - { - } - } - -private: // Data - Dali::Animation mAnimation; -}; - -/** -* Iris effect for slideshow -*/ - -class IrisShowEffect : public SlideshowEffect -{ -public: // API - - /** - * Constructor - * @param warp a bit more - */ - IrisShowEffect() - { - IVUG_FUNC_ENTER(); - - mShaderEffect = IrisEffect::New(); - mShaderEffectNew = IrisEffect::New(); - IVUG_FUNC_LEAVE(); - } - - /** - * Destructor - */ - virtual ~IrisShowEffect() - { - IVUG_FUNC_ENTER(); - //mAnimation.Pause(); - } - - virtual void Stop() - { - mAnimation.Stop(); - } - - virtual void SetImageSize(const char *path) - { - } - -private: // From SlideshowEffect - - virtual std::string Name() - { - return IRIS_EFFECT_NAME; - } - - /** - * @copydoc SlideshowEffect::Initialize - */ - virtual void Initialize( Dali::Vector3 size ) - { - } - - /** - * @copydoc SlideshowEffect::StartView - */ - virtual void StartView( Dali::ImageActor /*newActor*/, unsigned int /*duration*/ ) - { } - - /** - * @copydoc SlideshowEffect::StartTransition - */ - virtual bool StartTransition( Dali::ImageActor oldActor, - Dali::ImageActor newActor, - unsigned int duration, - int face_count) - { - IVUG_FUNC_ENTER(); - mAnimation = Animation::New( duration / SECONDTIME ); // to seconds - mAnimation.SetEndAction(Animation::Discard); - if( oldActor ) { - // get the image of the old actor - Image oldImage = oldActor.GetImage(); - ImageAttributes attr = oldImage.GetAttributes(); - // set uniforms, need power of two of the texture for size - Vector2 imageSize( attr.GetSize() ); - Vector2 imageSizePow2( Dali::NextPowerOfTwo( attr.GetSize().width ), - Dali::NextPowerOfTwo( attr.GetSize().height ) ); - Vector2 adjusted( imageSize.x / imageSizePow2.x, - imageSize.y / imageSizePow2.y ); - mShaderEffect.SetRadius( std::max(adjusted.width, adjusted.height)); - - // apply shader effect - oldActor.SetShaderEffect(mShaderEffect); - // animate swirl - Property::Value propertyValue(0.0f); - AnimateTo(mAnimation,mShaderEffect, mShaderEffect.GetRadiusPropertyName(),propertyValue); - } - if( newActor ) { - - mShaderEffectNew.SetRadius(0.0f); - // apply shader effect - newActor.SetShaderEffect(mShaderEffectNew); - // animate swirl - Property::Value propertyValue(1.0f); - AnimateTo(mAnimation,mShaderEffectNew,mShaderEffectNew.GetRadiusPropertyName(),propertyValue); - //mAnimation.AnimateProperty(mShaderEffectNew, - //mShaderEffectNew.GetRadiusPropertyName(), 1.0f); - } - mAnimation.Play(); - IVUG_FUNC_LEAVE(); - - return true; // with x fade - } - - /** - * @copydoc SlideshowEffect::TransitionCompleted - */ - virtual void TransitionCompleted( Dali::ImageActor oldActor, - Dali::ImageActor newActor ) - { - if( oldActor ) - { - // remove shader - oldActor.RemoveShaderEffect(); - } - if( newActor ) - { - // remove shader - newActor.RemoveShaderEffect(); - } - } - -private: // Data - - Dali::Animation mAnimation; - Dali::Toolkit::IrisEffect mShaderEffect; - Dali::Toolkit::IrisEffect mShaderEffectNew; - -}; - -/** -* Square effect for slideshow -*/ -class SquareEffect : public SlideshowEffect -{ -public: // API - - /** - * Constructor - */ - SquareEffect() - { - IVUG_FUNC_ENTER(); - mShaderEffectNew = SquareDissolveEffect::New(); - //mShaderEffectOld = SquareDissolveEffect::New(); - IVUG_FUNC_LEAVE(); - } - - /** - * Destructor - */ - virtual ~SquareEffect() - { - IVUG_FUNC_ENTER(); - //mAnimation.Pause(); - } - - virtual void Stop() - { - mAnimation.Stop(); - } - - virtual void SetImageSize(const char *path) - { - } - -private: // From SlideshowEffect - - virtual std::string Name() - { - return SQUARE_DISSOLVE_EFFECT_NAME; - } - - /** - * @copydoc SlideshowEffect::Initialize - */ - virtual void Initialize( Dali::Vector3 size ) - { - mImgNoise = Image::New(DEFAULT_NOISE_PATH); - } - - /** - * @copydoc SlideshowEffect::StartView - */ - virtual void StartView( Dali::ImageActor newActor, unsigned int duration) - { } - - /** - * @copydoc SlideshowEffect::StartTransition - */ - virtual bool StartTransition( Dali::ImageActor oldActor, - Dali::ImageActor newActor, - unsigned int duration, - int face_count) - { - IVUG_FUNC_ENTER(); - mAnimation = Animation::New( duration / SECONDTIME); // to seconds - //mAnimation.SetEndAction(Animation::Discard); - if ( newActor ) { - mShaderEffectNew.SetTextureSize(Vector2(1.0f, 1.0f)); - mShaderEffectNew.SetStep(0.8); - mShaderEffectNew.SetColumns(10.0); - mShaderEffectNew.SetRows(10.0); - /*if (oldActor) { - //mShaderEffectNew.SetEffectImage(mImgNoise); - //oldActor.GetImage() - }*/ - if (mImgNoise) { - mShaderEffectNew.SetEffectImage(mImgNoise); - } - // apply shader effect - newActor.SetShaderEffect(mShaderEffectNew); - // animate swirl - //mAnimation.AnimateProperty(mShaderEffectNew, - // mShaderEffectNew.GetStepPropertyName(), 0.5f); - - Property::Value propertyValue(0.5f); - AnimateTo(mAnimation,mShaderEffectNew, mShaderEffectNew.GetStepPropertyName(),propertyValue); - //mActorAnimation.AnimateProperty(mEffect, mEffect.GetTimePropertyName(), 0.0f); - - } - mAnimation.Play(); - IVUG_FUNC_LEAVE(); - - return true; // with x fade - } - - /** - * @copydoc SlideshowEffect::TransitionCompleted - */ - virtual void TransitionCompleted( Dali::ImageActor oldActor, Dali::ImageActor newActor ) - { - if( newActor ) - { - // remove shader - newActor.RemoveShaderEffect(); - } - } - -private: // Data - - Dali::Animation mAnimation; - Image mImgNoise; - Dali::Toolkit::SquareDissolveEffect mShaderEffectNew; - //Dali::Toolkit::SquareDissolveEffect mShaderEffectOld; -}; - - -namespace EffectFactory -{ - - SlideshowEffect* NewRippleFadeEffect( float amplitude ) - { - return new RippleFadeEffect( amplitude ); - } - - SlideshowEffect* NewDissolveFadeEffect( bool randomize ) - { - return new DissolveEffect( randomize ); - } - - SlideshowEffect* NewZoomEffect() - { - return new ZoomEffect; - } - - SlideshowEffect* NewFaceEffect(SlideShow *ss_handle) - { - return new SlideshowFaceEffect(ss_handle); - } - SlideshowEffect* NewSplitEffect() - { - return new SplitEffect; - } - - SlideshowEffect* NewSwirlEffect( bool warp ) - { - return new SwirlEffect( warp ); - } - - SlideshowEffect* NewWaterRippleEffect() - { - return new WaterRippleEffect(); - } - - SlideshowEffect* NewSlideEffect() - { - return new SlideEffect; - } - - SlideshowEffect* NewIrisEffect() - { - return new IrisShowEffect(); - } - - SlideshowEffect* NewSquareEffect() - { - return new SquareEffect(); - } - -} // namespace EffectFactory - -} // namespace Imageview3D diff --git a/slideshow/src/dali_effect/src/ivug-slideshow-face.cpp b/slideshow/src/dali_effect/src/ivug-slideshow-face.cpp deleted file mode 100644 index 75526a4..0000000 --- a/slideshow/src/dali_effect/src/ivug-slideshow-face.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -// CLASS HEADER -#include "ivug-slideshow-effect.h" -#include - -// EXTERNAL INCLUDES - -// INTERNAL INCLUDES -#include "ivug-includes.h" -#include "ivug-constraints.h" -#include "ivug-debug.h" -#include "ivug-dali-util.h" -#include "ivug-slideshow-face.h" - -//using namespace Dali; -//using namespace Dali::Toolkit; -//using namespace std; - -// LOCAL STUFF -namespace -{ - - static float ReverseEaseIn(float progress) - { - return 1.0f - (progress * progress * progress); - } - -} // end LOCAL STUFF - -/** - * Image Face slide show effect - - */ -namespace Imageview3D -{ - -SlideshowFaceEffect::SlideshowFaceEffect(SlideShow *ss_handle) -: mFaceRecordIndex(0), - mFaceRectX(0), - mFaceRectY(0), - mFaceRectW(0), - mFaceRectH(0), - mSSHandle(ss_handle), - mFaceScale(FACE_DEFAULT_SCALE), - mGapTime(FACE_DEFAULT_GAP_TIME), - mImgWith(0), - mImgHeight(0) -{ - -} - -bool SlideshowFaceEffect::GetScaleAttribute(double divi_h, double divi_w) -{ - bool bScale_h = true; - if (divi_h <= 1.0 && divi_w >= 1.0) { - bScale_h = true; - } else if (divi_h >= 1.0 && divi_w >= 1.0) { - if (divi_h > divi_w) { - bScale_h = true; - } else { - bScale_h = false; - } - } else if (divi_h <= 1.0 && divi_w <= 1.0) { - if (divi_h <= divi_w) { - bScale_h = true; - } else { - bScale_h = false; - } - } else { - bScale_h = false; - } - return bScale_h; -} - -void SlideshowFaceEffect::MoveFaceToCenter() -{ - MSG_IVUG_HIGH("MoveFaceToCenter"); - - if (mCurrentActor) { - mAnimation = Animation::New( - (float)(TRANSITIONTIME - mGapTime) / SECONDTIME); - int screen_w = 0; - int screen_h = 0; - Vector3 Position = mCurrentActor.GetCurrentPosition(); - MSG_EFFECT_HIGH("after zoom, pos of image is %f, %f, %f\n", - Position.x, Position.y, Position.z); - - //MSG_IVUG_HIGH("image resolution is %d,%d\n", image_w, image_h); - ivug_get_screen_size(&screen_w, &screen_h); - //MSG_IVUG_HIGH("screen size: %d,%d\n", screen_w, screen_h); - int rotation = ivug_get_win_rotation(); - //MSG_IVUG_HIGH("rotation is %d\n", rotation); - double delta_x = 0.0; - double delta_y = 0.0; - double scale_w = 0.0; - double scale_h = 0.0; - double divi_h = 0.0; - double divi_w = 0.0; - bool bScaleH = true; - if (rotation == 0 || rotation == 180) { - if (mImgHeight <= mImgWith) { - divi_w = (double)screen_w / ((double)mImgWith); - divi_h = divi_w; - } else { - divi_h = (double)screen_h / ((double)mImgHeight); - divi_w = (double)screen_w / ((double)mImgWith); - bScaleH = GetScaleAttribute(divi_h, divi_w); - if(bScaleH) { - divi_w = divi_h; - } else { - divi_h = divi_w; - } - } - } else { - if (mImgHeight >= mImgWith) { - divi_h = (double)screen_h / ((double)mImgHeight); - divi_w = divi_h; - } else { - divi_h = (double)screen_h / ((double)mImgHeight); - divi_w = (double)screen_w / ((double)mImgWith); - bScaleH = GetScaleAttribute(divi_h, divi_w); - if(bScaleH) { - divi_w = divi_h; - } else { - divi_h = divi_w; - } - } - } - scale_w = divi_w; - scale_h = divi_h; - - delta_x = ((double)mImgWith * mFaceScale / 2.0 - ((double)mFaceRectX + - (double)mFaceRectW/2.0)*mFaceScale) * scale_w; - delta_y = ((double)mImgHeight * mFaceScale / 2.0 - ((double)mFaceRectY + - (double)mFaceRectH/2.0)*mFaceScale) * scale_h; - - MSG_EFFECT_HIGH("delta_x is %f, delta_y is %f\n", delta_x, delta_y); - - Vector3 targetPos(delta_x, delta_y, 0.0f); - Dali::Layer layer = mCurrentActor.GetLayer(); - - layer.SetAnchorPoint(AnchorPoint::CENTER); - layer.SetParentOrigin(ParentOrigin::CENTER); - - mAnimation.MoveTo(mCurrentActor, targetPos, AlphaFunctions::Linear); - mAnimation.Play(); - } - MSG_IVUG_HIGH("MoveFaceToCenter leave"); - -} - -/** -* @copydoc SlideshowEffect::TransitionNextFace -*/ -void SlideshowFaceEffect::TransitionNextFace() -{ - if (NULL != mSSHandle) { - bool ret = ivug_get_nth_face_data(mSSHandle, mFaceRecordIndex, &mFaceRectX, - &mFaceRectY, &mFaceRectW, &mFaceRectH); - if(ret) { - /** - * if there is other face in this image, then go on show face effect to move - * other face to center of screen - */ - MoveFaceToCenter(); - } - ++ mFaceRecordIndex; - } -} - -void SlideshowFaceEffect::SetFaceScale(float value) -{ - if (value > 0.0) { - mFaceScale = value; - } else { - mFaceScale = FACE_DEFAULT_SCALE; - } -} - -void SlideshowFaceEffect::SetGapTime(int value) -{ - if ((value >= 0) && (value < TRANSITIONTIME)) { - mGapTime = value; - } else { - mGapTime = FACE_DEFAULT_GAP_TIME; - } -} - -void SlideshowFaceEffect::SetImageSize(const char *path) -{ - if (path) { - ivug_get_image_resolution(path, &mImgWith, &mImgHeight); - } -} - -std::string SlideshowFaceEffect::Name() -{ - return FACE_EFFECT_NAME; -} - -void SlideshowFaceEffect::Initialize( Dali::Vector3 /*size*/ ) -{ -} - -/** -* @copydoc SlideshowEffect::StartView -*/ -void SlideshowFaceEffect::StartView( Dali::ImageActor newActor, - unsigned int duration ) -{ -} - -/** -* @copydoc SlideshowEffect::StartTransition -*/ -bool SlideshowFaceEffect::StartTransition( Dali::ImageActor oldActor, - Dali::ImageActor newActor, - unsigned int duration, - int face_count) -{ - MSG_IVUG_HIGH("face effect, StartTransition, b_with_face is %d\n", face_count); - if (face_count > 0) { - mAnimation = Animation::New((float)FACE_SCALE_DURATION/SECONDTIME); - } else { - mAnimation = Animation::New((float)TRANSITIONTIME/SECONDTIME); - } - mCurrentActor = newActor; - - if( oldActor ) - { - mAnimation.MoveBy( oldActor, -500.0f, 0.0f, 0.0f ); - mAnimation.OpacityTo( oldActor, 0.0f ); - mAnimation.SetEndAction( Animation::Bake ); - } - - if( newActor && face_count > 0) - { - mFaceRecordIndex = 0; - mAnimation.ScaleTo( newActor, mFaceScale, mFaceScale, 0.0f); - mAnimation.SignalFinished().Connect( this, &SlideshowFaceEffect::TransitionNextFace); - } else if(newActor) { - /* without face, then display slide effect */ - mAnimation.MoveBy( newActor, Vector3(500.0f, 0.0f, 0.0f), ReverseEaseIn ); - mAnimation.OpacityTo( newActor, 0.0f, ReverseEaseIn ); - mAnimation.SetEndAction( Animation::Bake ); - } - mAnimation.Play(); - - return false; - -} - -void SlideshowFaceEffect::Stop() -{ - mAnimation.Stop(); -} - -/** -* @copydoc SlideshowEffect::TransitionCompleted -*/ -void SlideshowFaceEffect::TransitionCompleted( Dali::ImageActor oldActor, Dali::ImageActor newActor ) -{ - -} - -} - diff --git a/slideshow/src/dali_effect/src/ivug-view-stack-info.cpp b/slideshow/src/dali_effect/src/ivug-view-stack-info.cpp deleted file mode 100644 index d1128a3..0000000 --- a/slideshow/src/dali_effect/src/ivug-view-stack-info.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * All rights reserved. - * - * This software is a confidential and proprietary information of Samsung - * Electronics, Inc. ("Confidential Information"). You shall not disclose such - * Confidential Information and shall use it only in accordance with the terms - * of the license agreement you entered into with Samsung Electronics. - */ - -// CLASS HEADER -#include "ivug-view-stack-info.h" -#include "ivug-image-view.h" - -using namespace Dali; -using namespace Imageview3D; - -ViewStackInfo::ViewStackInfo(const std::string name, const Media_List* images) -: mName(name), - mAllImagesList(images) -{ - -} - -ViewStackInfo::ViewStackInfo(const ViewStackInfo& viewStackInfo) -{ - mViewStack = viewStackInfo.mViewStack; - mName = viewStackInfo.mName; - mAllImagesList = viewStackInfo.mAllImagesList; -} - -ViewStackInfo& ViewStackInfo::operator=(const ViewStackInfo& rhs) -{ - mViewStack = rhs.mViewStack; - mName = rhs.mName; - mAllImagesList = rhs.mAllImagesList; - return *this; -} - -ViewStackInfo::~ViewStackInfo() -{ - -} - -ImageView *ViewStackInfo::GetTopView() const -{ - DALI_ASSERT_ALWAYS(mViewStack.size() > 0); - - return mViewStack.back(); -} - -ImageView *ViewStackInfo::GetPreviousView() const -{ - DALI_ASSERT_ALWAYS(mViewStack.size() > 1); - - return mViewStack[ mViewStack.size() - 2 ]; -} - -void ViewStackInfo::PushView(ImageView *view) -{ - DALI_ASSERT_ALWAYS(view) - mViewStack.push_back(view); -} - -ImageView *ViewStackInfo::PopView() -{ - ImageView *top = mViewStack.back(); - mViewStack.pop_back(); - return top; -} - -void ViewStackInfo::SetVisible(bool visible) -{ - for(ViewStack::iterator iter = mViewStack.begin(); iter != mViewStack.end(); ++iter) { - ImageView* view = (*iter); - view->SetVisible(visible); - } -} - diff --git a/slideshow/src/dali_effect/src/ivug-water-ripple-effect.cpp b/slideshow/src/dali_effect/src/ivug-water-ripple-effect.cpp deleted file mode 100644 index d67501a..0000000 --- a/slideshow/src/dali_effect/src/ivug-water-ripple-effect.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* -Copyright (c) 2000-2012 Samsung Electronics Co., Ltd All Rights Reserved - -This file is part of Dali Toolkit - -PROPRIETARY/CONFIDENTIAL - -This software is the confidential and proprietary information of -SAMSUNG ELECTRONICS ("Confidential Information"). You shall not -disclose such Confidential Information and shall use it only in -accordance with the terms of the license agreement you entered -into with SAMSUNG ELECTRONICS. - -SAMSUNG make no representations or warranties about the suitability -of the software, either express or implied, including but not limited -to the implied warranties of merchantability, fitness for a particular -purpose, or non-infringement. SAMSUNG shall not be liable for any -damages suffered by licensee as a result of using, modifying or -distributing this software or its derivatives. -*/ - -#include "ivug-water-ripple-effect.h" - - -namespace Dali -{ - -namespace Toolkit -{ - -namespace -{ - -const std::string IVUG_TEXTURE_SIZE__NAME( "uTextureSize" ); -const std::string IVUG_AMPLITUDE_NAME( "uAmplitude" ); -const std::string IVUG_TIME_PROPERTY_NAME( "uTime" ); - -} // namespace - -WaterEffectRipple2D::WaterEffectRipple2D() -{ -} - -//Call the Parent copy constructor to add reference to the implementation for this object -WaterEffectRipple2D::WaterEffectRipple2D(ShaderEffect handle) -:ShaderEffect(handle) -{ -} - -WaterEffectRipple2D::~WaterEffectRipple2D() -{ -} - -WaterEffectRipple2D WaterEffectRipple2D::New() -{ -/*This is the different effects,If needed,Please open it*/ -#if 0 - std::string fragmentShader( - "uniform float uAmplitude;\n" - "uniform float uTime;\n" - "void main()\n" - "{\n" - " float textureSize = distance(sTextureRect.xy, sTextureRect.zw);\n" - " vec2 textureCenter = (sTextureRect.xy + sTextureRect.wz) * 0.5;\n" - " vec2 pos = (vTexCoord.st-textureCenter) / textureSize;\n" - " float len = length(pos) + 0.1;\n" - " vec2 texCoord = vTexCoord.st + (pos/len) * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude;\n" - " gl_FragColor = texture2D(sTexture, texCoord) * uColor;\n" - "}" ); - std::string fragmentShader( - "uniform vec2 uTextureSize;\n" - "uniform float uAmplitude;\n" - "uniform float uTime;\n" - "void main()\n" - "{\n" - " vec2 pos = -1.0 + 2.0 * vTexCoord.st / uTextureSize;\n" - " float len = length(pos);\n" - " vec2 texCoord = vTexCoord.st + (pos/len) * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude;\n" - " gl_FragColor = texture2D(sTexture, texCoord) * uColor;\n" - "}" ); -#endif - std::string fragmentShader( - "uniform vec2 uTextureSize;\n" - "uniform float uAmplitude;\n" - "uniform float uTime;\n" - "void main()\n" - "{\n" - " vec2 textureCenter = (sTextureRect.xy + sTextureRect.wz) * 0.5;\n" - " vec2 pos = (vTexCoord.st-textureCenter) / uTextureSize;\n" - " float len = length(pos) + 0.05;\n" - " vec2 texCoord = vTexCoord.st + (pos/len) * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude;\n" - " gl_FragColor = texture2D(sTexture, texCoord) * uColor;\n" - "}" ); - - - /*Create the implementation, temporarily owned on stack*/ - Dali::ShaderEffect shaderEffect = Dali::ShaderEffect::New( - "", - fragmentShader, - Dali::GeometryType( GEOMETRY_TYPE_IMAGE ), - ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID )); - - /* Pass ownership to WaterEffectRipple2D through overloaded constructor, So that it now has access to the - Dali::ShaderEffect implementation */ - Dali::Toolkit::WaterEffectRipple2D handle( shaderEffect ); - - handle.SetUniform( IVUG_TEXTURE_SIZE__NAME, Vector2(0.0f, 0.0f) ); - handle.SetUniform( IVUG_AMPLITUDE_NAME, 0.0f ); - handle.SetUniform( IVUG_TIME_PROPERTY_NAME, 0.0f ); - - return handle; - -} - -void WaterEffectRipple2D::SetAmplitude(float amplitude) -{ - SetUniform( IVUG_AMPLITUDE_NAME, amplitude ); -} - -void WaterEffectRipple2D::SetTime(float time) -{ - SetUniform( IVUG_TIME_PROPERTY_NAME, time ); -} - -const std::string& WaterEffectRipple2D::GetAmplitudePropertyName() const -{ - return IVUG_AMPLITUDE_NAME; -} - -const std::string& WaterEffectRipple2D::GetTimePropertyName() const -{ - return IVUG_TIME_PROPERTY_NAME; -} - -void WaterEffectRipple2D::SetTextureSize(const Vector2& textureSize) -{ - SetUniform( IVUG_TEXTURE_SIZE__NAME, textureSize ); -} - -const std::string& WaterEffectRipple2D::GetTextureSizePropertyName() const -{ - return IVUG_TEXTURE_SIZE__NAME; -} - - -} // namespace Toolkit - -} // namespace Dali - diff --git a/widget/src/image/ivug-image.cpp b/widget/src/image/ivug-image.cpp old mode 100644 new mode 100755 index b4c7c1f..18f954e --- a/widget/src/image/ivug-image.cpp +++ b/widget/src/image/ivug-image.cpp @@ -16,316 +16,6 @@ #include "ivug-define.h" -#ifdef USE_SCROLLER - -#include "ivug-image.h" -#include "Scroller.h" -#include "errno.h" - -#include "debug.h" - -#include "Image.h" -#include "Photocam.h" - - -#define PHOTO_CLASS(obj) \ - static_cast(evas_object_data_get((obj), "CPhotocam")) - -// APIs -IVAPI Evas_Object *ivug_image_create(Evas_Object *parent) -{ - CPhotocam *photo = new CPhotocam; - - Evas_Object *obj = photo->CreateObject(parent); - MSG_ASSERT(obj != NULL); - - evas_object_data_set(obj, "CPhotocam", photo); - - MSG_HIGH("Create photocam object. class=0x%08x obj=0x%08x", photo, obj); - return obj; -} - -IVAPI Evas_Load_Error ivug_image_file_set(Evas_Object *obj, const char *file, const char *key) -{ - CPhotocam *photo = PHOTO_CLASS(obj); - MSG_ASSERT(photo != NULL); - -#if 0 - unsigned char *buf; - - FILE *fp = NULL; - - fp = fopen(file, "rb"); - - if ( fp == NULL ) - { - MSG_ERROR("Cannot find %s", file); - return EVAS_LOAD_ERROR_GENERIC; - } - - fseek(fp,0L, SEEK_END); - - long size = ftell(fp); - - buf = (unsigned char *)malloc(size); - - int readcnt; - - fseek(fp,0L, SEEK_SET); - - readcnt = fread(buf, 1, size, fp); - - MSG_HIGH("Load file : %s", file); - - Evas_Load_Error err = EVAS_LOAD_ERROR_NONE; - err = photo->SetMem(buf, readcnt, NULL); -#else - Evas_Load_Error err = EVAS_LOAD_ERROR_NONE; - - err = photo->SetFile(file, key); - -#endif - - return err; -} - -IVAPI Evas_Load_Error ivug_image_mem_set(Evas_Object *obj, const unsigned char *buffer, unsigned int size, const char *key) -{ - CPhotocam *photo = PHOTO_CLASS(obj); - MSG_ASSERT(photo != NULL); - - MSG_HIGH("Load buffer : 0x%08x(%d)", buffer, size); - -// Performance problem is here. - Evas_Load_Error err = EVAS_LOAD_ERROR_NONE; - - err = photo->SetMem(buffer, size, key); - - return err; -} - - -IVAPI Evas_Load_Error ivug_image_unset(Evas_Object *obj) -{ - CPhotocam *photo = PHOTO_CLASS(obj); - MSG_ASSERT(photo != NULL); - - photo->UnSet(); - - return EVAS_LOAD_ERROR_NONE; - -} - -IVAPI void ivug_image_zoom_set(Evas_Object *obj, double zoom, Evas_Point *pCenter) -{ - CPhotocam *photo = PHOTO_CLASS(obj); - MSG_ASSERT(photo != NULL); - - photo->SetZoomLevel(CPoint(pCenter->x, pCenter->y), zoom); -} - -IVAPI double ivug_image_zoom_get(const Evas_Object *obj) -{ - CPhotocam *photo = PHOTO_CLASS(obj); - MSG_ASSERT(photo != NULL); - - return photo->GetZoomLevel(); -} - -IVAPI void ivug_image_image_size_get(const Evas_Object *obj, int *w, int *h) -{ - CPhotocam *photo = PHOTO_CLASS(obj); - MSG_ASSERT(photo != NULL); - - const CSize &size = photo->GetImageSize(); - - if(w) *w = size.Width(); - if(h) *h = size.Height(); -} - -IVAPI void ivug_image_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h) -{ - CPhotocam *photo = PHOTO_CLASS(obj); - MSG_ASSERT(photo != NULL); - - const CRect &rect = photo->GetDisplayGeometry(); - - if(x) *x = rect.Left(); - if(y) *y = rect.Top(); - if(w) *w = rect.Width(); - if(h) *h = rect.Height(); - - MSG_HIGH("Region size XYWH(%d,%d,%d,%d)", rect.Left(), rect.Top(), rect.Width(), rect.Height() ); -} - -IVAPI void ivug_image_decoded_size_get(const Evas_Object *obj, int *w, int *h) -{ - CPhotocam *photo = PHOTO_CLASS(obj); - MSG_ASSERT(photo != NULL); - - const CSize &size = photo->GetDecodedSize(); - - if(w) *w = size.Width(); - if(h) *h = size.Height(); - -}; - - -IVAPI unsigned char *ivug_image_decoded_buffer_get(const Evas_Object *obj) -{ - CPhotocam *photo = PHOTO_CLASS(obj); - MSG_ASSERT(photo != NULL); - - return photo->GetBuffer(); - -} - -IVAPI void ivug_image_hold_set(const Evas_Object *obj, Eina_Bool hold) -{ - CPhotocam *photo = PHOTO_CLASS(obj); - MSG_ASSERT(photo != NULL); - - if ( hold == EINA_TRUE) - { - photo->DisableEvent(); - } - else - { - photo->EnableEvent(); - } - -} - -IVAPI void ivug_image_zoom_reset(Evas_Object *obj, Evas_Point *pCenter) -{ - CPhotocam *photo = PHOTO_CLASS(obj); - MSG_ASSERT(photo != NULL); - - photo->DoAutoFit(); - -} - -IVAPI void ivug_image_animated_set(const Evas_Object *obj, Eina_Bool bAnimation) -{ - CPhotocam *photo = PHOTO_CLASS(obj); - MSG_ASSERT(photo != NULL); - - if ( bAnimation ) - { - photo->Play(); - } - else - { - photo->Stop(); - } - -} - -IVAPI Evas_Object *ivug_image_region_image_get(Evas_Object *obj, int x, int y, int w, int h ) -{ - CPhotocam *photo = PHOTO_CLASS(obj); - MSG_ASSERT(photo != NULL); - - return photo->GetCroppedImage(x,y,w,h); -} - - -IVAPI void ivug_image_rotate_set(Evas_Object *obj, int degree) -{ - CPhotocam *photo = PHOTO_CLASS(obj); - MSG_ASSERT(photo != NULL); - - return photo->SetRotate(degree); -} - -IVAPI int ivug_image_rotate_get(Evas_Object *obj) -{ - CPhotocam *photo = PHOTO_CLASS(obj); - MSG_ASSERT(photo != NULL); - - return photo->GetRotate(); -} - - -IVAPI Evas_Object * -ivug_image_internal_image_get(Evas_Object *obj) -{ - CPhotocam *photo = PHOTO_CLASS(obj); - MSG_ASSERT(photo != NULL); - - return photo->GetImageObject(); - -} - - -IVAPI void ivug_image_coordinate_lcd_to_image(Evas_Object *photocam, int lcd_x, int lcd_y, int *img_x, int *img_y) -{ - MSG_ASSERT(photocam != NULL); - - int image_w, image_h; - - ivug_image_image_size_get(photocam, &image_w, &image_h); // Get original image size. - - MSG_UTIL_HIGH("size w=%d, h=%d", image_w, image_h); - - ivug_ret_if(image_w <= 0 || image_h <= 0); - - int gx, gy, gw, gh; - - ivug_image_region_get(photocam, &gx, &gy, &gw, &gh); - - MSG_UTIL_HIGH("region x=%d, y=%d, w=%d, h=%d", gx, gy, gw, gh); - - int image_x, image_y; - - image_x = lcd_x - gx; - image_y = lcd_y - gy; - - image_x = image_x*image_w/gw; - image_y = image_y*image_h/gh; - - MSG_UTIL_HIGH("changed x=%d, y=%d", image_x, image_y); - - *img_x = image_x; - *img_y = image_y; -} - -IVAPI void ivug_image_coordinate_image_to_lcd(Evas_Object *photocam, int img_x, int img_y, int *lcd_x, int *lcd_y) -{ - MSG_ASSERT(photocam != NULL); - - int image_w, image_h; - - ivug_ret_if(photocam == NULL); - - ivug_image_image_size_get(photocam, &image_w, &image_h); // Get original image size. - - MSG_UTIL_HIGH("size w=%d, h=%d", image_w, image_h); - - ivug_ret_if(image_w <= 0 || image_h <= 0); - - int gx, gy, gw, gh; - - ivug_image_region_get(photocam, &gx, &gy, &gw, &gh); - - MSG_UTIL_HIGH("region x=%d, y=%d, w=%d, h=%d", gx, gy, gw, gh); - - int scr_x, scr_y; - - scr_x = img_x*gw/image_w; - scr_y = img_y*gh/image_h; - - scr_x = scr_x+gx; - scr_y = scr_y+gy; - - MSG_UTIL_HIGH("changed x=%d, y=%d", scr_x, scr_y); - - *lcd_x = scr_x; - *lcd_y = scr_y; -} - -#else - #include #include @@ -799,6 +489,3 @@ EAPI void ivug_image_coordinate_image_to_lcd(Evas_Object *photocam, int img_x, i *lcd_y = scr_y; } - -#endif -