#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/public-api/object/type-registry-helper.h>
+#include <dali/devel-api/object/type-registry-helper.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/integration-api/debug.h>
GaussianBlurView::GaussianBlurView()
- : Control( CONTROL_BEHAVIOUR_NONE )
+ : Control( ControlBehaviour( DISABLE_SIZE_NEGOTIATION ) )
, mNumSamples(GAUSSIAN_BLUR_VIEW_DEFAULT_NUM_SAMPLES)
, mBlurBellCurveWidth( 0.001f )
, mPixelFormat(GAUSSIAN_BLUR_VIEW_DEFAULT_RENDER_TARGET_PIXEL_FORMAT)
GaussianBlurView::GaussianBlurView( const unsigned int numSamples, const float blurBellCurveWidth, const Pixel::Format renderTargetPixelFormat,
const float downsampleWidthScale, const float downsampleHeightScale,
bool blurUserImage)
- : Control( NO_SIZE_NEGOTIATION )
+ : Control( ControlBehaviour( DISABLE_SIZE_NEGOTIATION ) )
, mNumSamples(numSamples)
, mBlurBellCurveWidth( 0.001f )
, mPixelFormat(renderTargetPixelFormat)
// Create an ImageActor for performing a horizontal blur on the texture
mImageActorHorizBlur = ImageActor::New();
- mImageActorHorizBlur.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
mImageActorHorizBlur.SetParentOrigin(ParentOrigin::CENTER);
mImageActorHorizBlur.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
mImageActorHorizBlur.SetShaderEffect( mHorizBlurShader );
// Create an ImageActor for performing a vertical blur on the texture
mImageActorVertBlur = ImageActor::New();
- mImageActorVertBlur.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
mImageActorVertBlur.SetParentOrigin(ParentOrigin::CENTER);
mImageActorVertBlur.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
mImageActorVertBlur.SetShaderEffect( mVertBlurShader );
if(!mBlurUserImage)
{
mImageActorComposite = ImageActor::New();
- mImageActorComposite.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
mImageActorComposite.SetParentOrigin(ParentOrigin::CENTER);
mImageActorComposite.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
mImageActorComposite.SetOpacity(GAUSSIAN_BLUR_VIEW_DEFAULT_BLUR_STRENGTH); // ensure alpha is enabled for this object and set default value
// Create an ImageActor for holding final result, i.e. the blurred image. This will get rendered to screen later, via default / user render task
mTargetActor = ImageActor::New();
- mTargetActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
mTargetActor.SetParentOrigin(ParentOrigin::CENTER);
mTargetActor.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
}
-/**
- * ZrelativeToYconstraint
- *
- * f(current, property, scale) = Vector3(current.x, current.y, property.y * scale)
- */
-struct ZrelativeToYconstraint
-{
- ZrelativeToYconstraint( float scale )
- : mScale( scale )
- {}
-
- Vector3 operator()(const Vector3& current,
- const PropertyInput& property)
- {
- Vector3 v;
-
- v.x = current.x;
- v.y = current.y;
- v.z = property.GetVector3().y * mScale;
-
- return v;
- }
-
- float mScale;
-};
-
-void GaussianBlurView::OnControlSizeSet(const Vector3& targetSize)
+void GaussianBlurView::OnSizeSet(const Vector3& targetSize)
{
mTargetSize = Vector2(targetSize);
taskList.RemoveTask(mCompositeTask);
}
-void GaussianBlurView::OnStageDisconnection()
-{
- // TODO: can't call this here, since SetImage() calls fails similarly to above
- // Need to fix the stage connection so this callback can be used arbitrarily. At that point we can simplify the API by removing the need for Activate() / Deactivate()
- //Deactivate();
-}
-
-void GaussianBlurView::OnControlStageConnection()
-{
- // TODO: can't call this here, since SetImage() calls fail to connect images to stage, since parent chain not fully on stage yet
- // Need to fix the stage connection so this callback can be used arbitrarily. At that point we can simplify the API by removing the need for Activate() / Deactivate()
- //Activate();
-}
-
void GaussianBlurView::Activate()
{
// make sure resources are allocated and start the render tasks processing