X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Feffects-view%2Feffects-view-impl.h;h=2550f85c2794e81827b8ab818926429491164068;hb=311e5010e011ee0b93a4a7ee48a7ae150cdc0dbd;hp=497cdbe5f771dfa2bde1e43d53dfd557b1a0e47d;hpb=2ddfbb9e23a7c3fc30e604236c41e0ef6d2ed6a2;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/effects-view/effects-view-impl.h b/dali-toolkit/internal/controls/effects-view/effects-view-impl.h index 497cdbe..2550f85 100644 --- a/dali-toolkit/internal/controls/effects-view/effects-view-impl.h +++ b/dali-toolkit/internal/controls/effects-view/effects-view-impl.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_EFFECTS_VIEW_H__ -#define __DALI_TOOLKIT_INTERNAL_EFFECTS_VIEW_H__ +#ifndef DALI_TOOLKIT_INTERNAL_EFFECTS_VIEW_H +#define DALI_TOOLKIT_INTERNAL_EFFECTS_VIEW_H /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,25 +20,21 @@ // EXTERNAL INCLUDES #include -#include #include #include -#include +#include +#include // INTERNAL INCLUDES +#include #include -#include -#include namespace Dali { - namespace Toolkit { - namespace Internal { - class GaussianBlurView; class ImageFilter; @@ -59,90 +55,102 @@ public: EffectsView(); /** - * Constructor. - * @copydoc Toolkit::EffectsView New(const unsigned int,const float,const Pixel::Format,const float,const float) - */ - EffectsView(const unsigned int numSamples, const float blurBellCurveWidth, const int spread, - const Pixel::Format pixelFormat, - const float downsampleWidthScale, const float downsampleHeightScale, - FrameBufferImage image); - - /** * A reference counted object may only be deleted by calling Unreference() */ virtual ~EffectsView(); public: - /// @copydoc Dali::Toolkit::EffectsView::SetType - void SetType( Toolkit::EffectsView::EffectType type ); + void SetType(Toolkit::EffectsView::EffectType type); /// @copydoc Dali::Toolkit::EffectsView::GetType Toolkit::EffectsView::EffectType GetType() const; - /// @copydoc Dali::Toolkit::EffectsView::Enable - void Enable(); - - /// @copydoc Dali::Toolkit::EffectsView::Disable - void Disable(); - /// @copydoc Dali::Toolkit::EffectsView::Refresh void Refresh(); /// @copydoc Dali::Toolkit::EffectsView::SetRefreshOnDemand - void SetRefreshOnDemand( bool onDemand ); + void SetRefreshOnDemand(bool onDemand); /// @copydoc Dali::Toolkit::EffectsView::SetPixelFormat - void SetPixelFormat( Pixel::Format pixelFormat ); + void SetPixelFormat(Pixel::Format pixelFormat); - /// @copydoc Dali::Toolkit::EffectsView::SetOutputImage - void SetOutputImage( FrameBufferImage image ); + /// @copydoc Dali::Toolkit::EffectsView::SetBackgroundColor(const Vector4&) + void SetBackgroundColor(const Vector4& color); - /// @copydoc Dali::Toolkit::EffectsView::GetOutputImage - FrameBufferImage GetOutputImage(); + /// @copydoc Dali::Toolkit::GaussianBlurView::GetBackgroundColor + Vector4 GetBackgroundColor() const; - /// @copydoc Dali::Toolkit::EffectsView::GetEffectSizePropertyIndex - Property::Index GetEffectSizePropertyIndex() const; + /** + * Set the effect size which decides the size of filter kernel. + * @param[in] effectSize The effect size. + */ + void SetEffectSize(int effectSize); - /// @copydoc Dali::Toolkit::EffectsView::GetEffectStrengthPropertyIndex - Property::Index GetEffectStrengthPropertyIndex() const; + /** + * Get the effect size. + * @return The effect size. + */ + int GetEffectSize(); - /// @copydoc Dali::Toolkit::EffectsView::GetEffectOffsetPropertyIndex - Property::Index GetEffectOffsetPropertyIndex() const; + // Properties + /** + * Called when a property of an object of this type is set. + * @param[in] object The object whose property is set. + * @param[in] index The property index. + * @param[in] value The new property value. + */ + static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value); - /// @copydoc Dali::Toolkit::EffectsView::GetEffectColorPropertyIndex - Property::Index GetEffectColorPropertyIndex() const; + /** + * Called to retrieve a property of an object of this type. + * @param[in] object The object whose property is to be retrieved. + * @param[in] index The property index. + * @return The current value of the property. + */ + static Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex); - /// @copydoc Dali::Toolkit::EffectsView::SetBackgroundColor(const Vector4&) - void SetBackgroundColor( const Vector4& color ); +private: // From Control + /** + * @copydoc Toolkit::Internal::Control::OnInitialize() + */ + void OnInitialize() override; - /// @copydoc Dali::Toolkit::GaussianBlurView::GetBackgroundColor - Vector4 GetBackgroundColor() const; + /** + * @copydoc CustomActorImpl::OnSizeSet( const Vector3& targetSize ) + */ + void OnSizeSet(const Vector3& targetSize) override; -private: /** - * Register and setup indices for EffectsView properties + * @copydoc Toolkit::Internal::Control::OnSceneConnection */ - void SetupProperties(); + void OnSceneConnection(int depth) override; -private: // From Control + /** + * @copydoc Toolkit::Internal::Control::OnSceneDisconnection + */ + void OnSceneDisconnection() override; /** - * @copydoc Toolkit::Control::OnInitialize() + * @copydoc Toolkit::Internal::Control::OnChildAdd */ - virtual void OnInitialize(); + void OnChildAdd(Actor& child) override; /** - * @copydoc Toolkit::Control::OnControlSizeSet( const Vector3& targetSize ) + * @copydoc Toolkit::Internal::Control::OnChildRemove */ - virtual void OnControlSizeSet( const Vector3& targetSize ); + void OnChildRemove(Actor& child) override; private: + /** + * Enable the effect when the control is set on stage + */ + void Enable(); /** - * Callback received when the control is disconnected from the stage. + * Disable the effect when the control is set off stage */ - void OnStageDisconnection(); + void Disable(); /** * Setup image filters @@ -180,29 +188,20 @@ private: void RemoveFilters(); private: - // Undefined - EffectsView( const EffectsView& ); + EffectsView(const EffectsView&); // Undefined - EffectsView& operator = ( const EffectsView& ); + EffectsView& operator=(const EffectsView&); private: // attributes/properties - Toolkit::EffectsView::EffectType mEffectType; - ///////////////////////////////////////////////////////////// // for rendering all user added children to offscreen target - FrameBufferImage mImageForChildren; - ImageActor mActorForChildren; - RenderTask mRenderTaskForChildren; + FrameBuffer mFrameBufferForChildren; + Renderer mRendererForChildren; + RenderTask mRenderTaskForChildren; CameraActor mCameraForChildren; - - ///////////////////////////////////////////////////////////// - Pixel::Format mPixelFormat; ///< pixel format used by render targets - - ///////////////////////////////////////////////////////////// - // downsampling is used for the separated blur passes to get increased blur with the same number of samples and also to make rendering quicker - float mSpread; + Actor mChildrenRoot; // for creating a subtree for all user added child actors ///////////////////////////////////////////////////////////// // background fill color @@ -212,68 +211,49 @@ private: // attributes/properties // for checking if we need to reallocate render targets Vector2 mTargetSize; Vector2 mLastSize; - - bool mRefreshOnDemand; - - ///////////////////////////////////////////////////////////// - // horizontal spread objects - FrameBufferImage mImageForHorzSpread; - ImageActor mActorForHorzSpread; - RenderTask mRenderTaskForHorzSpread; - ///////////////////////////////////////////////////////////// - // vertical spread objects - FrameBufferImage mImageForVertSpread; - ImageActor mActorForVertSpread; - RenderTask mRenderTaskForVertSpread; + // post blur image + FrameBuffer mFrameBufferPostFilter; + Renderer mRendererPostFilter; - CameraActor mCameraForSpread; + Vector mFilters; ///////////////////////////////////////////////////////////// - // post blur image - FrameBufferImage mImagePostFilter; - ImageActor mActorPostFilter; + // downsampling is used for the separated blur passes to get increased blur with the same number of samples and also to make rendering quicker + int mEffectSize; ///////////////////////////////////////////////////////////// - // final image - FrameBufferImage mImageForResult; - Actor mActorForResult; - RenderTask mRenderTaskForResult; - - Property::Index mEffectSizePropertyIndex; - Property::Index mEffectStrengthPropertyIndex; - Property::Index mEffectOffsetPropertyIndex; - Property::Index mEffectColorPropertyIndex; + Toolkit::EffectsView::EffectType mEffectType; + Pixel::Format mPixelFormat; ///< pixel format used by render targets - std::vector mFilters; + bool mEnabled : 1; + bool mRefreshOnDemand : 1; }; // class EffectsView } // namespace Internal - // Helpers for public-api forwarding methods -inline Toolkit::Internal::EffectsView& GetImpl( Toolkit::EffectsView& effectsView ) +inline Toolkit::Internal::EffectsView& GetImpl(Toolkit::EffectsView& effectsView) { - DALI_ASSERT_ALWAYS( effectsView ); + DALI_ASSERT_ALWAYS(effectsView); Dali::RefObject& handle = effectsView.GetImplementation(); - return static_cast( handle ); + return static_cast(handle); } -inline const Toolkit::Internal::EffectsView& GetImpl( const Toolkit::EffectsView& effectsView ) +inline const Toolkit::Internal::EffectsView& GetImpl(const Toolkit::EffectsView& effectsView) { - DALI_ASSERT_ALWAYS( effectsView ); + DALI_ASSERT_ALWAYS(effectsView); const Dali::RefObject& handle = effectsView.GetImplementation(); - return static_cast( handle ); + return static_cast(handle); } } // namespace Toolkit } // namespace Dali -#endif // __DALI_TOOLKIT_INTERNAL_EFFECTS_VIEW_H__ - +#endif // DALI_TOOLKIT_INTERNAL_EFFECTS_VIEW_H