X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Feffects-view%2Feffects-view-impl.h;h=5c49da3ec4239e3fc500af55262a045a8af3aa8e;hb=abca32188329599dcf40c33af47d2a650bba9ffd;hp=560a71b65a2a3eb2147cb947d7832402887ca6fb;hpb=e2eda444afbe82e9591fe198eef339227f90a616;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 560a71b..5c49da3 100644 --- a/dali-toolkit/internal/controls/effects-view/effects-view-impl.h +++ b/dali-toolkit/internal/controls/effects-view/effects-view-impl.h @@ -1,30 +1,33 @@ #ifndef __DALI_TOOLKIT_INTERNAL_EFFECTS_VIEW_H__ #define __DALI_TOOLKIT_INTERNAL_EFFECTS_VIEW_H__ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +/* + * Copyright (c) 2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ // EXTERNAL INCLUDES +#include +#include +#include // INTERNAL INCLUDES -#include -#include +#include #include -#include #include +#include namespace Dali { @@ -42,7 +45,7 @@ class ImageFilter; * EffectsView implementation class * @copydoc Dali::Toolkit::EffectsView */ -class EffectsView : public ControlImpl +class EffectsView : public Control { public: /// @copydoc Dali::Toolkit::EffectsView New() @@ -76,12 +79,6 @@ public: /// @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(); @@ -91,54 +88,85 @@ public: /// @copydoc Dali::Toolkit::EffectsView::SetPixelFormat 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; - /// @copydoc Dali::Toolkit::EffectsView::SetBackgroundColor(const Vector4&) - void SetBackgroundColor( const Vector4& color ); + /** + * 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::GaussianBlurView::GetBackgroundColor - Vector4 GetBackgroundColor() const; +private: // From Control -private: /** - * Register and setup indices for EffectsView properties + * @copydoc Toolkit::Internal::Control::OnInitialize() */ - void SetupProperties(); + virtual void OnInitialize(); -private: // From ControlImpl + /** + * @copydoc CustomActorImpl::OnSizeSet( const Vector3& targetSize ) + */ + virtual void OnSizeSet( const Vector3& targetSize ); /** - * @copydoc Toolkit::Control::OnInitialize() + * @copydoc Toolkit::Internal::Control::OnStageConnection */ - virtual void OnInitialize(); + virtual void OnStageConnection( int depth ); /** - * @copydoc Toolkit::Control::OnControlSizeSet( const Vector3& targetSize ) + * @copydoc Toolkit::Internal::Control::OnStageDisconnection */ - virtual void OnControlSizeSet( const Vector3& targetSize ); + virtual void OnStageDisconnection(); + + /** + * @copydoc Toolkit::Internal::Control::OnChildAdd + */ + virtual void OnChildAdd( Actor& child ); + + /** + * @copydoc Toolkit::Internal::Control::OnChildRemove + */ + virtual void OnChildRemove( Actor& child ); private: /** - * Callback received when the control is disconnected from the stage. + * Enable the effect when the control is set on stage + */ + void Enable(); + + /** + * Disable the effect when the control is set off stage */ - void OnStageDisconnection(); + void Disable(); /** * Setup image filters @@ -184,21 +212,14 @@ private: 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; - 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; + FrameBufferImage mImageForChildren; + Toolkit::Visual::Base mVisualForChildren; + RenderTask mRenderTaskForChildren; + CameraActor mCameraForChildren; + Actor mChildrenRoot; // for creating a subtree for all user added child actors ///////////////////////////////////////////////////////////// // background fill color @@ -208,40 +229,23 @@ 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 + FrameBufferImage mImagePostFilter; + Toolkit::Visual::Base mVisualPostFilter; - 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