tet_infoline(" UtcDaliSuperBlurViewSetImage ");
SuperBlurView blurView = SuperBlurView::New( BLUR_LEVELS );
- // create image actors for the original image and each blurred image
- DALI_TEST_CHECK( blurView.GetChildCount() == BLUR_LEVELS+1 );
+ blurView.SetSize( 100.f, 100.f );
Image inputImage = CreateSolidColorImage( application, Color::GREEN, 50, 50 );
blurView.SetImage( inputImage );
// start multiple guassian blur call, each guassian blur creates two render tasks
- DALI_TEST_CHECK( Stage::GetCurrent().GetRenderTaskList().GetTaskCount() == BLUR_LEVELS*2 + 1);
+ DALI_TEST_CHECK( Stage::GetCurrent().GetRenderTaskList().GetTaskCount() == 1+BLUR_LEVELS*2);
+
+ // create image actors for the original image and each blurred image
+ Stage::GetCurrent().Add( blurView );
+ Wait(application);
+ DALI_TEST_EQUALS(blurView.GetRendererCount(), BLUR_LEVELS+1, TEST_LOCATION );
END_TEST;
}
DALI_TEST_EQUALS( image2.GetHeight(), 25u, TEST_LOCATION );
Image image3 = blurView.GetBlurredImage( 3 );
- DALI_TEST_CHECK( FrameBufferImage::DownCast( image2 ) );
+ DALI_TEST_CHECK( FrameBufferImage::DownCast( image3 ) );
END_TEST;
}
* Stage::GetCurrent().Add(blurView);\n
*
* // Set the input image
- * Image image = Image::New(...);\n
+ * ResourceImage image = ResourceImage::New(...);\n
* blurView.SetImage(image);\n
*
* // animate the strength of the blur - this can fade between no blur and full blur. .\n
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/common/stage.h>
+#include <dali/public-api/object/property-map.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/devel-api/object/type-registry-helper.h>
#include <dali/public-api/render-tasks/render-task-list.h>
+#include <dali/devel-api/rendering/renderer.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
const char* const IMAGE_INTENSITY_PROPERTY_NAME = "uImageIntensity";
const char* const IMAGE_SATURATION_PROPERTY_NAME = "uImageSaturation";
+const char* const EFFECT_IMAGE_NAME( "sEffect" );
+
///////////////////////////////////////////////////////
//
// Bloom shaders
//
const char* const BLOOM_EXTRACT_FRAGMENT_SOURCE =
- "uniform float uBloomThreshold;\n"
- "uniform float uRecipOneMinusBloomThreshold;\n"
+ "varying mediump vec2 vTexCoord;\n"
+ "uniform sampler2D sTexture;\n"
+ "uniform lowp vec4 uColor;\n"
+ "uniform mediump float uBloomThreshold;\n"
+ "uniform mediump float uRecipOneMinusBloomThreshold;\n"
"void main()\n"
"{\n"
" mediump vec4 col;\n"
- " col = texture2D(sTexture, vec2(vTexCoord.x, vTexCoord.y));\n"
+ " col = texture2D(sTexture, vTexCoord);\n"
" col = (col - uBloomThreshold) * uRecipOneMinusBloomThreshold;\n" // remove intensities lower than the thresold and remap intensities above the threshold to [0..1]
" gl_FragColor = clamp(col, 0.0, 1.0);\n"
"}\n";
const char* const COMPOSITE_FRAGMENT_SOURCE =
+ "precision mediump float;\n"
+ "varying mediump vec2 vTexCoord;\n"
+ "uniform sampler2D sTexture;\n"
+ "uniform sampler2D sEffect;\n"
+ "uniform lowp vec4 uColor;\n"
"uniform float uBloomIntensity;\n"
"uniform float uImageIntensity;\n"
"uniform float uBloomSaturation;\n"
"{\n"
" mediump vec4 image;\n"
" mediump vec4 bloom;\n"
- " image = texture2D(sTexture, vec2(vTexCoord.x, vTexCoord.y));\n"
- " bloom = texture2D(sEffect, vec2(vTexCoord.x, vTexCoord.y));\n"
+ " image = texture2D(sTexture, vTexCoord);\n"
+ " bloom = texture2D(sEffect, vTexCoord);\n"
" image = ChangeSaturation(image, uImageSaturation) * uImageIntensity;\n"
" bloom = ChangeSaturation(bloom, uBloomSaturation) * uBloomIntensity;\n"
" image *= 1.0 - clamp(bloom, 0.0, 1.0);\n" // darken base where bloom is strong, to prevent excessive burn-out of result
, mBloomSaturationPropertyIndex(Property::INVALID_INDEX)
, mImageIntensityPropertyIndex(Property::INVALID_INDEX)
, mImageSaturationPropertyIndex(Property::INVALID_INDEX)
+ , mActivated( false )
{
}
, mBloomSaturationPropertyIndex(Property::INVALID_INDEX)
, mImageIntensityPropertyIndex(Property::INVALID_INDEX)
, mImageSaturationPropertyIndex(Property::INVALID_INDEX)
+ , mActivated( false )
{
}
// root actor to parent all user added actors, needed to allow us to set that subtree as exclusive for our child render task
mChildrenRoot.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
- //////////////////////////////////////////////////////
- // Create shaders
-
- // Create shader used for extracting the bright parts of an image
- mBloomExtractShader = ShaderEffect::New( "", BLOOM_EXTRACT_FRAGMENT_SOURCE );
-
- // Create shader used to composite bloom and original image to output render target
- mCompositeShader = ShaderEffect::New( "", COMPOSITE_FRAGMENT_SOURCE );
-
-
//////////////////////////////////////////////////////
// Create actors
// Create an ImageActor for rendering from the scene texture to the bloom texture
- mBloomExtractImageActor = ImageActor::New();
+ mBloomExtractImageActor = Toolkit::ImageView::New();
mBloomExtractImageActor.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
- mBloomExtractImageActor.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
- mBloomExtractImageActor.SetShaderEffect( mBloomExtractShader );
+
+ // Create shader used for extracting the bright parts of an image
+ Property::Map customShader;
+ customShader[ "fragmentShader" ] = BLOOM_EXTRACT_FRAGMENT_SOURCE;
+ Property::Map rendererMap;
+ rendererMap.Insert( "rendererType", "imageRenderer" );
+ rendererMap.Insert( "shader", customShader );
+ mBloomExtractImageActor.SetProperty( Toolkit::ImageView::Property::IMAGE, rendererMap );
// Create an ImageActor for compositing the result (scene and bloom textures) to output
- mCompositeImageActor = ImageActor::New();
+ mCompositeImageActor = Toolkit::ImageView::New();
mCompositeImageActor.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
- mCompositeImageActor.SetShaderEffect( mCompositeShader );
- mCompositeImageActor.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
+
+ // Create shader used to composite bloom and original image to output render target
+ customShader[ "fragmentShader" ] = COMPOSITE_FRAGMENT_SOURCE;
+ rendererMap[ "shader" ] = customShader;
+ mCompositeImageActor.SetProperty( Toolkit::ImageView::Property::IMAGE, rendererMap );;
// Create an ImageActor for holding final result, i.e. the blurred image. This will get rendered to screen later, via default / user render task
- mTargetImageActor = ImageActor::New();
+ mTargetImageActor = Toolkit::ImageView::New();
mTargetImageActor.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
- mTargetImageActor.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
// Create the Gaussian Blur object + render tasks
// Create cameras for the renders corresponding to the (potentially downsampled) render targets' size
mRenderDownsampledCamera = CameraActor::New();
mRenderDownsampledCamera.SetParentOrigin(ParentOrigin::CENTER);
+ mRenderDownsampledCamera.SetInvertYAxis( true );
mRenderFullSizeCamera = CameraActor::New();
mRenderFullSizeCamera.SetParentOrigin(ParentOrigin::CENTER);
+ mRenderFullSizeCamera.SetInvertYAxis( true );
////////////////////////////////
float cameraPosConstraintScale = 0.5f / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f);
mRenderFullSizeCamera.SetZ( mTargetSize.height * cameraPosConstraintScale);
- // if we are already on stage, need to update render target sizes now to reflect the new size of this actor
- if(Self().OnStage())
+ // if we have already activated the blur, need to update render target sizes now to reflect the new size of this actor
+ if(mActivated)
{
- AllocateResources();
+ Deactivate();
+ Activate();
}
}
// create off screen buffer of new size to render our child actors to
mRenderTargetForRenderingChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::UNUSED );
mBloomExtractTarget = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat, Dali::Image::UNUSED );
+ FrameBufferImage mBlurExtractTarget = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat, Dali::Image::UNUSED );
mOutputRenderTarget = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::UNUSED);
mBloomExtractImageActor.SetSize(mDownsampledWidth, mDownsampledHeight); // size needs to match render target
// set GaussianBlurView to blur our extracted bloom
- mGaussianBlurView.SetUserImageAndOutputRenderTarget(mBloomExtractTarget, mBloomExtractTarget);
+ mGaussianBlurView.SetUserImageAndOutputRenderTarget(mBloomExtractTarget, mBlurExtractTarget);
// use the completed blur in the first buffer and composite with the original child actors render
mCompositeImageActor.SetImage( mRenderTargetForRenderingChildren );
- mCompositeShader.SetEffectImage( mBloomExtractTarget );
+ Material material = mCompositeImageActor.GetRendererAt(0).GetMaterial();
+ int textureIndex = material.GetTextureIndex( EFFECT_IMAGE_NAME );
+ if( textureIndex == -1 )
+ {
+ material.AddTexture( mBlurExtractTarget, EFFECT_IMAGE_NAME );
+ }
+ else
+ {
+ material.SetTextureImage( textureIndex, mBlurExtractTarget );
+ }
// set up target actor for rendering result, i.e. the blurred image
mTargetImageActor.SetImage(mOutputRenderTarget);
mRenderChildrenTask.SetExclusive(true);
mRenderChildrenTask.SetInputEnabled( false );
mRenderChildrenTask.SetClearEnabled( true );
+ mRenderChildrenTask.SetCameraActor(mRenderFullSizeCamera); // use camera that covers render target exactly
+ mRenderChildrenTask.SetTargetFrameBuffer( mRenderTargetForRenderingChildren );
// Extract the bright part of the image and render to a new buffer. Downsampling also occurs at this stage to save pixel fill, if it is set up.
mBloomExtractTask = taskList.CreateTask();
mBloomExtractTask.SetExclusive(true);
mBloomExtractTask.SetInputEnabled( false );
mBloomExtractTask.SetClearEnabled( true );
+ mBloomExtractTask.SetCameraActor(mRenderDownsampledCamera);
+ mBloomExtractTask.SetTargetFrameBuffer( mBloomExtractTarget );
// GaussianBlurView tasks must be created here, so they are executed in the correct order with respect to BloomView tasks
GetImpl(mGaussianBlurView).CreateRenderTasks();
mCompositeTask.SetExclusive(true);
mCompositeTask.SetInputEnabled( false );
mCompositeTask.SetClearEnabled( true );
-
- mRenderChildrenTask.SetCameraActor(mRenderFullSizeCamera); // use camera that covers render target exactly
- mBloomExtractTask.SetCameraActor(mRenderDownsampledCamera);
mCompositeTask.SetCameraActor(mRenderFullSizeCamera);
-
- mRenderChildrenTask.SetTargetFrameBuffer( mRenderTargetForRenderingChildren );
- mBloomExtractTask.SetTargetFrameBuffer( mBloomExtractTarget );
mCompositeTask.SetTargetFrameBuffer( mOutputRenderTarget );
}
// make sure resources are allocated and start the render tasks processing
AllocateResources();
CreateRenderTasks();
+ mActivated = true;
}
void BloomView::Deactivate()
// stop render tasks processing
// Note: render target resources are automatically freed since we set the Image::Unused flag
RemoveRenderTasks();
+ mActivated = false;
}
/**
// bloom threshold
// set defaults, makes sure properties are registered with shader
- mBloomExtractShader.SetUniform( BLOOM_THRESHOLD_PROPERTY_NAME, BLOOM_THRESHOLD_DEFAULT );
- mBloomExtractShader.SetUniform( RECIP_ONE_MINUS_BLOOM_THRESHOLD_PROPERTY_NAME, 1.0f / (1.0f - BLOOM_THRESHOLD_DEFAULT) );
+ mBloomExtractImageActor.RegisterProperty( BLOOM_THRESHOLD_PROPERTY_NAME, BLOOM_THRESHOLD_DEFAULT );
+ mBloomExtractImageActor.RegisterProperty( RECIP_ONE_MINUS_BLOOM_THRESHOLD_PROPERTY_NAME, 1.0f / (1.0f - BLOOM_THRESHOLD_DEFAULT) );
// Register a property that the user can control to change the bloom threshold
mBloomThresholdPropertyIndex = self.RegisterProperty(BLOOM_THRESHOLD_PROPERTY_NAME, BLOOM_THRESHOLD_DEFAULT);
- Property::Index shaderBloomThresholdPropertyIndex = mBloomExtractShader.GetPropertyIndex(BLOOM_THRESHOLD_PROPERTY_NAME);
- Constraint bloomThresholdConstraint = Constraint::New<float>( mBloomExtractShader, shaderBloomThresholdPropertyIndex, EqualToConstraint());
+ Property::Index shaderBloomThresholdPropertyIndex = mBloomExtractImageActor.GetPropertyIndex(BLOOM_THRESHOLD_PROPERTY_NAME);
+ Constraint bloomThresholdConstraint = Constraint::New<float>( mBloomExtractImageActor, shaderBloomThresholdPropertyIndex, EqualToConstraint());
bloomThresholdConstraint.AddSource( Source(self, mBloomThresholdPropertyIndex) );
bloomThresholdConstraint.Apply();
// precalc 1.0 / (1.0 - threshold) on CPU to save shader insns, using constraint to tie to the normal threshold property
- Property::Index shaderRecipOneMinusBloomThresholdPropertyIndex = mBloomExtractShader.GetPropertyIndex(RECIP_ONE_MINUS_BLOOM_THRESHOLD_PROPERTY_NAME);
- Constraint thresholdConstraint = Constraint::New<float>( mBloomExtractShader, shaderRecipOneMinusBloomThresholdPropertyIndex, RecipOneMinusConstraint());
+ Property::Index shaderRecipOneMinusBloomThresholdPropertyIndex = mBloomExtractImageActor.GetPropertyIndex(RECIP_ONE_MINUS_BLOOM_THRESHOLD_PROPERTY_NAME);
+ Constraint thresholdConstraint = Constraint::New<float>( mBloomExtractImageActor, shaderRecipOneMinusBloomThresholdPropertyIndex, RecipOneMinusConstraint());
thresholdConstraint.AddSource( LocalSource(shaderBloomThresholdPropertyIndex) );
thresholdConstraint.Apply();
// Register a property that the user can control to fade the bloom intensity via internally hidden shader
mBloomIntensityPropertyIndex = self.RegisterProperty(BLOOM_INTENSITY_PROPERTY_NAME, BLOOM_INTENSITY_DEFAULT);
- mCompositeShader.SetUniform( BLOOM_INTENSITY_PROPERTY_NAME, BLOOM_INTENSITY_DEFAULT );
- Property::Index shaderBloomIntensityPropertyIndex = mCompositeShader.GetPropertyIndex(BLOOM_INTENSITY_PROPERTY_NAME);
- Constraint bloomIntensityConstraint = Constraint::New<float>( mCompositeShader, shaderBloomIntensityPropertyIndex, EqualToConstraint());
+ mCompositeImageActor.RegisterProperty( BLOOM_INTENSITY_PROPERTY_NAME, BLOOM_INTENSITY_DEFAULT );
+ Property::Index shaderBloomIntensityPropertyIndex = mCompositeImageActor.GetPropertyIndex(BLOOM_INTENSITY_PROPERTY_NAME);
+ Constraint bloomIntensityConstraint = Constraint::New<float>( mCompositeImageActor, shaderBloomIntensityPropertyIndex, EqualToConstraint());
bloomIntensityConstraint.AddSource( Source(self, mBloomIntensityPropertyIndex) );
bloomIntensityConstraint.Apply();
// Register a property that the user can control to fade the bloom saturation via internally hidden shader
mBloomSaturationPropertyIndex = self.RegisterProperty(BLOOM_SATURATION_PROPERTY_NAME, BLOOM_SATURATION_DEFAULT);
- mCompositeShader.SetUniform( BLOOM_SATURATION_PROPERTY_NAME, BLOOM_SATURATION_DEFAULT );
- Property::Index shaderBloomSaturationPropertyIndex = mCompositeShader.GetPropertyIndex(BLOOM_SATURATION_PROPERTY_NAME);
- Constraint bloomSaturationConstraint = Constraint::New<float>( mCompositeShader, shaderBloomSaturationPropertyIndex, EqualToConstraint());
+ mCompositeImageActor.RegisterProperty( BLOOM_SATURATION_PROPERTY_NAME, BLOOM_SATURATION_DEFAULT );
+ Property::Index shaderBloomSaturationPropertyIndex = mCompositeImageActor.GetPropertyIndex(BLOOM_SATURATION_PROPERTY_NAME);
+ Constraint bloomSaturationConstraint = Constraint::New<float>( mCompositeImageActor, shaderBloomSaturationPropertyIndex, EqualToConstraint());
bloomSaturationConstraint.AddSource( Source(self, mBloomSaturationPropertyIndex) );
bloomSaturationConstraint.Apply();
// Register a property that the user can control to fade the image intensity via internally hidden shader
mImageIntensityPropertyIndex = self.RegisterProperty(IMAGE_INTENSITY_PROPERTY_NAME, IMAGE_INTENSITY_DEFAULT);
- mCompositeShader.SetUniform( IMAGE_INTENSITY_PROPERTY_NAME, IMAGE_INTENSITY_DEFAULT );
- Property::Index shaderImageIntensityPropertyIndex = mCompositeShader.GetPropertyIndex(IMAGE_INTENSITY_PROPERTY_NAME);
- Constraint imageIntensityConstraint = Constraint::New<float>( mCompositeShader, shaderImageIntensityPropertyIndex, EqualToConstraint());
+ mCompositeImageActor.RegisterProperty( IMAGE_INTENSITY_PROPERTY_NAME, IMAGE_INTENSITY_DEFAULT );
+ Property::Index shaderImageIntensityPropertyIndex = mCompositeImageActor.GetPropertyIndex(IMAGE_INTENSITY_PROPERTY_NAME);
+ Constraint imageIntensityConstraint = Constraint::New<float>( mCompositeImageActor, shaderImageIntensityPropertyIndex, EqualToConstraint());
imageIntensityConstraint.AddSource( Source(self, mImageIntensityPropertyIndex) );
imageIntensityConstraint.Apply();
// Register a property that the user can control to fade the image saturation via internally hidden shader
mImageSaturationPropertyIndex = self.RegisterProperty(IMAGE_SATURATION_PROPERTY_NAME, IMAGE_SATURATION_DEFAULT);
- mCompositeShader.SetUniform( IMAGE_SATURATION_PROPERTY_NAME, IMAGE_SATURATION_DEFAULT );
- Property::Index shaderImageSaturationPropertyIndex = mCompositeShader.GetPropertyIndex(IMAGE_SATURATION_PROPERTY_NAME);
- Constraint imageSaturationConstraint = Constraint::New<float>( mCompositeShader, shaderImageSaturationPropertyIndex, EqualToConstraint());
+ mCompositeImageActor.RegisterProperty( IMAGE_SATURATION_PROPERTY_NAME, IMAGE_SATURATION_DEFAULT );
+ Property::Index shaderImageSaturationPropertyIndex = mCompositeImageActor.GetPropertyIndex(IMAGE_SATURATION_PROPERTY_NAME);
+ Constraint imageSaturationConstraint = Constraint::New<float>( mCompositeImageActor, shaderImageSaturationPropertyIndex, EqualToConstraint());
imageSaturationConstraint.AddSource( Source(self, mImageSaturationPropertyIndex) );
imageSaturationConstraint.Apply();
}
#include <dali/public-api/actors/camera-actor.h>
#include <dali/public-api/actors/image-actor.h>
#include <dali/public-api/render-tasks/render-task.h>
-#include <dali/public-api/shader-effects/shader-effect.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/devel-api/controls/bloom-view/bloom-view.h>
namespace Dali
// for extracting bright parts of image to an offscreen target
FrameBufferImage mBloomExtractTarget; // for rendering bright parts of image into separate texture, also used as target for gaussian blur
RenderTask mBloomExtractTask;
- ShaderEffect mBloomExtractShader;
- ImageActor mBloomExtractImageActor;
+ Toolkit::ImageView mBloomExtractImageActor;
/////////////////////////////////////////////////////////////
// for blurring extracted bloom
/////////////////////////////////////////////////////////////
// for compositing bloom and children renders to offscreen target
RenderTask mCompositeTask;
- ShaderEffect mCompositeShader;
- ImageActor mCompositeImageActor;
+
+ Toolkit::ImageView mCompositeImageActor;
/////////////////////////////////////////////////////////////
// for holding blurred result
FrameBufferImage mOutputRenderTarget;
- ImageActor mTargetImageActor;
+ Toolkit::ImageView mTargetImageActor;
/////////////////////////////////////////////////////////////
// Properties for setting by user, e.g. by animations
Property::Index mImageIntensityPropertyIndex;
Property::Index mImageSaturationPropertyIndex;
+ bool mActivated:1;
+
private:
// Undefined copy constructor.
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/common/stage.h>
+#include <dali/public-api/object/property-map.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/devel-api/object/type-registry-helper.h>
#include <dali/public-api/render-tasks/render-task-list.h>
const float ARBITRARY_FIELD_OF_VIEW = Math::PI / 4.0f;
const char* const GAUSSIAN_BLUR_FRAGMENT_SOURCE =
+ "varying mediump vec2 vTexCoord;\n"
+ "uniform sampler2D sTexture;\n"
+ "uniform lowp vec4 uColor;\n"
"uniform mediump vec2 uSampleOffsets[NUM_SAMPLES];\n"
"uniform mediump float uSampleWeights[NUM_SAMPLES];\n"
"void main()\n"
"{\n"
- " mediump vec4 col;\n"
- " col = texture2D(sTexture, vec2(vTexCoord.x, vTexCoord.y) + uSampleOffsets[0]) * uSampleWeights[0]; \n"
- " for (int i=1; i<NUM_SAMPLES; ++i) \n"
- " { \n"
- " col += texture2D(sTexture, vec2(vTexCoord.x, vTexCoord.y) + uSampleOffsets[i]) * uSampleWeights[i]; \n"
- " } \n"
+ " mediump vec4 col = texture2D(sTexture, vTexCoord + uSampleOffsets[0]) * uSampleWeights[0];\n"
+ " for (int i=1; i<NUM_SAMPLES; ++i)\n"
+ " {\n"
+ " col += texture2D(sTexture, vTexCoord + uSampleOffsets[i]) * uSampleWeights[i];\n"
+ " }\n"
" gl_FragColor = col;\n"
"}\n";
, mLastSize(Vector2::ZERO)
, mChildrenRoot(Actor::New())
, mBlurStrengthPropertyIndex(Property::INVALID_INDEX)
+ , mActivated( false )
{
SetBlurBellCurveWidth(GAUSSIAN_BLUR_VIEW_DEFAULT_BLUR_BELL_CURVE_WIDTH);
}
, mLastSize(Vector2::ZERO)
, mChildrenRoot(Actor::New())
, mBlurStrengthPropertyIndex(Property::INVALID_INDEX)
+ , mActivated( false )
{
SetBlurBellCurveWidth(blurBellCurveWidth);
}
//////////////////////////////////////////////////////
// Create shaders
- // horiz
std::ostringstream horizFragmentShaderStringStream;
horizFragmentShaderStringStream << "#define NUM_SAMPLES " << mNumSamples << "\n";
horizFragmentShaderStringStream << GAUSSIAN_BLUR_FRAGMENT_SOURCE;
- mHorizBlurShader = ShaderEffect::New( "", horizFragmentShaderStringStream.str() );
- // vert
- std::ostringstream vertFragmentShaderStringStream;
- vertFragmentShaderStringStream << "#define NUM_SAMPLES " << mNumSamples << "\n";
- vertFragmentShaderStringStream << GAUSSIAN_BLUR_FRAGMENT_SOURCE;
- mVertBlurShader = ShaderEffect::New( "", vertFragmentShaderStringStream.str() );
-
+ Property::Map customShader;
+ customShader[ "fragmentShader" ] = horizFragmentShaderStringStream.str();
+ Property::Map rendererMap;
+ rendererMap.Insert( "rendererType", "imageRenderer" );
+ rendererMap.Insert( "shader", customShader );
//////////////////////////////////////////////////////
// Create actors
// Create an ImageActor for performing a horizontal blur on the texture
- mImageActorHorizBlur = ImageActor::New();
+ mImageActorHorizBlur = Toolkit::ImageView::New();
mImageActorHorizBlur.SetParentOrigin(ParentOrigin::CENTER);
- mImageActorHorizBlur.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
- mImageActorHorizBlur.SetShaderEffect( mHorizBlurShader );
+ mImageActorHorizBlur.SetProperty( Toolkit::ImageView::Property::IMAGE, rendererMap );
// Create an ImageActor for performing a vertical blur on the texture
- mImageActorVertBlur = ImageActor::New();
+ mImageActorVertBlur = Toolkit::ImageView::New();
mImageActorVertBlur.SetParentOrigin(ParentOrigin::CENTER);
- mImageActorVertBlur.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
- mImageActorVertBlur.SetShaderEffect( mVertBlurShader );
+ mImageActorVertBlur.SetProperty( Toolkit::ImageView::Property::IMAGE, rendererMap );
// Register a property that the user can control to fade the blur in / out via the GaussianBlurView object
mBlurStrengthPropertyIndex = Self().RegisterProperty(GAUSSIAN_BLUR_VIEW_STRENGTH_PROPERTY_NAME, GAUSSIAN_BLUR_VIEW_DEFAULT_BLUR_STRENGTH);
// Create an ImageActor for compositing the blur and the original child actors render
if(!mBlurUserImage)
{
- mImageActorComposite = ImageActor::New();
+ mImageActorComposite = Toolkit::ImageView::New();
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
Constraint blurStrengthConstraint = Constraint::New<float>( mImageActorComposite, Actor::Property::COLOR_ALPHA, EqualToConstraint());
blurStrengthConstraint.Apply();
// 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 = Toolkit::ImageView::New();
mTargetActor.SetParentOrigin(ParentOrigin::CENTER);
- mTargetActor.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
-
//////////////////////////////////////////////////////
// Create cameras for the renders corresponding to the view size
mRenderFullSizeCamera = CameraActor::New();
+ mRenderFullSizeCamera.SetInvertYAxis( true );
mRenderFullSizeCamera.SetParentOrigin(ParentOrigin::CENTER);
//////////////////////////////////////////////////////
// Create camera for the renders corresponding to the (potentially downsampled) render targets' size
mRenderDownsampledCamera = CameraActor::New();
+ mRenderDownsampledCamera.SetInvertYAxis( true );
mRenderDownsampledCamera.SetParentOrigin(ParentOrigin::CENTER);
}
- // if we are already on stage, need to update render target sizes now to reflect the new size of this actor
- if(Self().OnStage())
+ // if we have already activated the blur, need to update render target sizes now to reflect the new size of this actor
+ if(mActivated)
{
- AllocateResources();
+ Deactivate();
+ Activate();
}
}
mRenderFullSizeCamera.SetPosition(0.0f, 0.0f, mTargetSize.height * cameraPosConstraintScale);
// create offscreen buffer of new size to render our child actors to
- mRenderTargetForRenderingChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::UNUSED );
+ mRenderTargetForRenderingChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
// Set ImageActor for performing a horizontal blur on the texture
mImageActorHorizBlur.SetImage( mRenderTargetForRenderingChildren );
// Create offscreen buffer for vert blur pass
- mRenderTarget1 = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat, Dali::Image::UNUSED );
+ mRenderTarget1 = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat );
// use the completed blur in the first buffer and composite with the original child actors render
mImageActorComposite.SetImage( mRenderTarget1 );
}
// Create offscreen buffer for horiz blur pass
- mRenderTarget2 = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat, Dali::Image::UNUSED );
+ mRenderTarget2 = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat );
// size needs to match render target
mImageActorHorizBlur.SetSize(mDownsampledWidth, mDownsampledHeight);
mHorizBlurTask.SetInputEnabled( false );
mHorizBlurTask.SetClearEnabled( true );
mHorizBlurTask.SetClearColor( mBackgroundColor );
+ mHorizBlurTask.SetCameraActor(mRenderDownsampledCamera);
+ mHorizBlurTask.SetTargetFrameBuffer( mRenderTarget2 );
if( mRenderOnce && mBlurUserImage )
{
mHorizBlurTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
mVertBlurTask.SetInputEnabled( false );
mVertBlurTask.SetClearEnabled( true );
mVertBlurTask.SetClearColor( mBackgroundColor );
+ mVertBlurTask.SetCameraActor(mRenderDownsampledCamera);
+ if(mUserOutputRenderTarget)
+ {
+ mVertBlurTask.SetTargetFrameBuffer( mUserOutputRenderTarget );
+ }
+ else
+ {
+ mVertBlurTask.SetTargetFrameBuffer( mRenderTarget1 );
+ }
if( mRenderOnce && mBlurUserImage )
{
mVertBlurTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
mCompositeTask.SetCameraActor(mRenderFullSizeCamera);
mCompositeTask.SetTargetFrameBuffer( mRenderTargetForRenderingChildren );
}
-
- mHorizBlurTask.SetCameraActor(mRenderDownsampledCamera);
- mVertBlurTask.SetCameraActor(mRenderDownsampledCamera);
-
- mHorizBlurTask.SetTargetFrameBuffer( mRenderTarget2 );
- if(mUserOutputRenderTarget)
- {
- mVertBlurTask.SetTargetFrameBuffer( mUserOutputRenderTarget );
- }
- else
- {
- mVertBlurTask.SetTargetFrameBuffer( mRenderTarget1 );
- }
}
void GaussianBlurView::RemoveRenderTasks()
// make sure resources are allocated and start the render tasks processing
AllocateResources();
CreateRenderTasks();
+ mActivated = true;
}
void GaussianBlurView::ActivateOnce()
// stop render tasks processing
// Note: render target resources are automatically freed since we set the Image::Unused flag
RemoveRenderTasks();
+ mRenderTargetForRenderingChildren.Reset();
+ mRenderTarget1.Reset();
+ mRenderTarget2.Reset();
mRenderOnce = false;
+ mActivated = false;
}
void GaussianBlurView::SetBlurBellCurveWidth(float blurBellCurveWidth)
Vector2 yAxis(0.0f, 1.0f);
for (i = 0; i < mNumSamples; ++i )
{
- mHorizBlurShader.SetUniform( GetSampleOffsetsPropertyName( i ), uvOffsets[ i ] * xAxis );
- mHorizBlurShader.SetUniform( GetSampleWeightsPropertyName( i ), weights[ i ] );
+ mImageActorHorizBlur.RegisterProperty( GetSampleOffsetsPropertyName( i ), uvOffsets[ i ] * xAxis );
+ mImageActorHorizBlur.RegisterProperty( GetSampleWeightsPropertyName( i ), weights[ i ] );
- mVertBlurShader.SetUniform( GetSampleOffsetsPropertyName( i ), uvOffsets[ i ] * yAxis );
- mVertBlurShader.SetUniform( GetSampleWeightsPropertyName( i ), weights[ i ] );
+ mImageActorVertBlur.RegisterProperty( GetSampleOffsetsPropertyName( i ), uvOffsets[ i ] * yAxis );
+ mImageActorVertBlur.RegisterProperty( GetSampleWeightsPropertyName( i ), weights[ i ] );
}
delete[] uvOffsets;
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
namespace Dali
{
FrameBufferImage mRenderTarget1;
FrameBufferImage mRenderTarget2;
- ShaderEffect mHorizBlurShader;
- ShaderEffect mVertBlurShader;
-
- ImageActor mImageActorHorizBlur;
- ImageActor mImageActorVertBlur;
+ Toolkit::ImageView mImageActorHorizBlur;
+ Toolkit::ImageView mImageActorVertBlur;
RenderTask mHorizBlurTask;
RenderTask mVertBlurTask;
/////////////////////////////////////////////////////////////
// for compositing blur and children renders to offscreen target
- ImageActor mImageActorComposite;
+ Toolkit::ImageView mImageActorComposite;
RenderTask mCompositeTask;
/////////////////////////////////////////////////////////////
// for holding blurred result
- ImageActor mTargetActor;
+ Toolkit::ImageView mTargetActor;
/////////////////////////////////////////////////////////////
// for animating fade in / out of blur, hiding internal implementation but allowing user to set via GaussianBlurView interface
FrameBufferImage mUserOutputRenderTarget;
Dali::Toolkit::GaussianBlurView::GaussianBlurViewSignal mFinishedSignal; ///< Signal emitted when blur has completed.
+
+ bool mActivated:1;
private:
// Undefined copy constructor.
{
mImpl->mFlags &= ~Impl::IS_FROM_CACHE;
- if( !image )
+ mImpl->mRenderer = CreateRenderer();
+
+ if( image )
{
- return;
+ ApplyImageToSampler( image );
}
- mImpl->mRenderer = CreateRenderer();
- ApplyImageToSampler( image );
-
// default shader or custom shader with the default image vertex shader
if( !mImpl->mCustomShader || mImpl->mCustomShader->mVertexShader.empty() )
{
{
InitializeRenderer( mImageUrl );
}
- else if( mImage )
+ else
{
InitializeRenderer( mImage );
}
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/object/property-map.h>
#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/devel-api/rendering/renderer.h>
#include <dali/devel-api/scripting/scripting.h>
#include <dali/integration-api/debug.h>
const unsigned int GAUSSIAN_BLUR_NUM_SAMPLES_INCREMENTATION = 10;
const float GAUSSIAN_BLUR_BELL_CURVE_WIDTH = 4.5f;
const float GAUSSIAN_BLUR_BELL_CURVE_WIDTH_INCREMENTATION = 5.f;
-const Pixel::Format GAUSSIAN_BLUR_RENDER_TARGET_PIXEL_FORMAT = Pixel::RGB888;
+const Pixel::Format GAUSSIAN_BLUR_RENDER_TARGET_PIXEL_FORMAT = Pixel::RGBA8888;
const float GAUSSIAN_BLUR_DOWNSAMPLE_WIDTH_SCALE = 0.5f;
const float GAUSSIAN_BLUR_DOWNSAMPLE_HEIGHT_SCALE = 0.5f;
+const char* ALPHA_UNIFORM_NAME( "uAlpha" );
+const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
+ varying mediump vec2 vTexCoord;\n
+ uniform sampler2D sTexture;\n
+ uniform lowp vec4 uColor;\n
+ uniform lowp float uAlpha;\n
+ \n
+ void main()\n
+ {\n
+ gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
+ gl_FragColor.a *= uAlpha;
+ }\n
+);
+
/**
* The constraint is used to blend the group of blurred images continuously with a unified blur strength property value which ranges from zero to one.
*/
void operator()( float& current, const PropertyInputContainer& inputs )
{
float blurStrength = inputs[0]->GetFloat();
- if(blurStrength <= mRange.x)
+ if(blurStrength < mRange.x)
{
- current = 1.f;
+ current = 0.f;
}
else if(blurStrength > mRange.y)
{
- current = 0.f;
+ current = 1.f;
}
else
{
- current = ( mRange.y - blurStrength) / ( mRange.y - mRange.x );
+ current = ( blurStrength - mRange.x) / ( mRange.y - mRange.x );
}
}
SuperBlurView::SuperBlurView( unsigned int blurLevels )
: Control( ControlBehaviour( DISABLE_SIZE_NEGOTIATION ) ),
- mBlurLevels( blurLevels ),
+ mTargetSize( Vector2::ZERO ),
mBlurStrengthPropertyIndex(Property::INVALID_INDEX),
- mResourcesCleared( true ),
- mTargetSize( Vector2::ZERO )
+ mBlurLevels( blurLevels ),
+ mResourcesCleared( true )
{
DALI_ASSERT_ALWAYS( mBlurLevels > 0 && " Minimal blur level is one, otherwise no blur is needed" );
- mGaussianBlurView.assign( blurLevels, NULL );
+ mGaussianBlurView.assign( blurLevels, Toolkit::GaussianBlurView() );
mBlurredImage.assign( blurLevels, FrameBufferImage() );
- mImageActors.assign( blurLevels + 1, ImageActor() );
+ mRenderers.assign( blurLevels+1, Toolkit::ControlRenderer() );
}
SuperBlurView::~SuperBlurView()
{
mBlurStrengthPropertyIndex = Self().RegisterProperty( "blurStrength", 0.f );
- DALI_ASSERT_ALWAYS( mImageActors.size() == mBlurLevels+1 && "must synchronize the ImageActor group if blur levels got changed " );
- for(unsigned int i=0; i<=mBlurLevels;i++)
- {
- mImageActors[i] = ImageActor::New( );
- mImageActors[i].SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
- mImageActors[i].SetParentOrigin( ParentOrigin::CENTER );
- mImageActors[i].SetZ(-static_cast<float>(i)*0.01f);
- mImageActors[i].SetColorMode( USE_OWN_MULTIPLY_PARENT_ALPHA );
- Self().Add( mImageActors[i] );
- }
+ Property::Map rendererMap;
+ rendererMap.Insert( "rendererType", "imageRenderer");
+
+ Property::Map shaderMap;
+ std::stringstream verterShaderString;
+ shaderMap[ "fragmentShader" ] = FRAGMENT_SHADER;
+ rendererMap.Insert( "shader", shaderMap );
- for(unsigned int i=0; i < mBlurLevels; i++)
+ Toolkit::RendererFactory rendererFactory = Toolkit::RendererFactory::Get();
+ for(unsigned int i=0; i<=mBlurLevels; i++)
{
- Constraint constraint = Constraint::New<float>( mImageActors[i], Actor::Property::COLOR_ALPHA, ActorOpacityConstraint(mBlurLevels, i) );
- constraint.AddSource( ParentSource( mBlurStrengthPropertyIndex ) );
- constraint.Apply();
+ mRenderers[i] = rendererFactory.GetControlRenderer( rendererMap );
+ mRenderers[i].SetDepthIndex(i);
}
-
- Self().SetSize(Stage::GetCurrent().GetSize());
}
void SuperBlurView::SetImage(Image inputImage)
{
- DALI_ASSERT_ALWAYS( mImageActors.size() == mBlurLevels+1 && "must synchronize the ImageActor group if blur levels got changed " );
- DALI_ASSERT_ALWAYS( mBlurredImage.size() == mBlurLevels && "must synchronize the blurred image group if blur levels got changed " );
+ if( mTargetSize == Vector2::ZERO || mInputImage == inputImage)
+ {
+ return;
+ }
ClearBlurResource();
- mImageActors[0].SetImage( inputImage );
-
- for(unsigned int i=1; i<=mBlurLevels;i++)
- {
- mImageActors[i].SetImage( mBlurredImage[i-1] );
- }
+ mInputImage = inputImage;
+ Actor self = Self();
+ Toolkit::RendererFactory::Get().ResetRenderer( mRenderers[0], self, mInputImage );
BlurImage( 0, inputImage);
for(unsigned int i=1; i<mBlurLevels;i++)
{
- BlurImage( i, mBlurredImage[i-1]);
+ BlurImage( i, mBlurredImage[i-1]);
}
mResourcesCleared = false;
}
+Image SuperBlurView::GetImage()
+{
+ return mInputImage;
+}
+
Property::Index SuperBlurView::GetBlurStrengthPropertyIndex() const
{
return mBlurStrengthPropertyIndex;
GAUSSIAN_BLUR_DOWNSAMPLE_WIDTH_SCALE, GAUSSIAN_BLUR_DOWNSAMPLE_HEIGHT_SCALE, true );
mGaussianBlurView[idx].SetParentOrigin(ParentOrigin::CENTER);
mGaussianBlurView[idx].SetSize(mTargetSize);
+ Stage::GetCurrent().Add( mGaussianBlurView[idx] );
mGaussianBlurView[idx].SetUserImageAndOutputRenderTarget( image, mBlurredImage[idx] );
+ mGaussianBlurView[idx].ActivateOnce();
if( idx == mBlurLevels-1 )
{
mGaussianBlurView[idx].FinishedSignal().Connect( this, &SuperBlurView::OnBlurViewFinished );
}
- Stage::GetCurrent().Add( mGaussianBlurView[idx] );
- mGaussianBlurView[idx].ActivateOnce();
}
void SuperBlurView::OnBlurViewFinished( Toolkit::GaussianBlurView blurView )
{
Stage::GetCurrent().Remove( mGaussianBlurView[i] );
mGaussianBlurView[i].Deactivate();
- mGaussianBlurView[i].Reset();
}
mResourcesCleared = true;
}
{
mTargetSize = Vector2(targetSize);
- for(unsigned int i=0; i<mBlurLevels;i++)
+ Toolkit::RendererFactory rendererFactory = Toolkit::RendererFactory::Get();
+ Actor self = Self();
+ for(unsigned int i=1; i<=mBlurLevels;i++)
{
- float exponent = static_cast<float>(i+1);
- mBlurredImage[i] = FrameBufferImage::New( mTargetSize.width/std::pow(2.f,exponent) , mTargetSize.height/std::pow(2.f,exponent),
+ float exponent = static_cast<float>(i);
+ mBlurredImage[i-1] = FrameBufferImage::New( mTargetSize.width/std::pow(2.f,exponent) , mTargetSize.height/std::pow(2.f,exponent),
GAUSSIAN_BLUR_RENDER_TARGET_PIXEL_FORMAT, Dali::Image::NEVER );
+ rendererFactory.ResetRenderer( mRenderers[i], self, mBlurredImage[i-1] );
+ }
+
+ if( mInputImage )
+ {
+ SetImage( mInputImage );
+ }
+
+ if( self.OnStage() )
+ {
+ for(unsigned int i=0; i<=mBlurLevels;i++)
+ {
+ mRenderers[i].SetOnStage( self );
+ }
}
}
}
+void SuperBlurView::OnStageConnection( int depth )
+{
+ Control::OnStageConnection( depth );
+
+ if( mTargetSize == Vector2::ZERO )
+ {
+ return;
+ }
+
+ Actor self = Self();
+ mRenderers[0].SetOnStage( self );
+ for(unsigned int i=1; i<=mBlurLevels;i++)
+ {
+ mRenderers[i].SetOnStage( self );
+
+ Renderer renderer = self.GetRendererAt( i );
+ Property::Index index = renderer.RegisterProperty( ALPHA_UNIFORM_NAME, 0.f );
+ Constraint constraint = Constraint::New<float>( renderer, index, ActorOpacityConstraint(mBlurLevels, i-1) );
+ constraint.AddSource( Source( self, mBlurStrengthPropertyIndex ) );
+ constraint.Apply();
+ }
+}
+
+void SuperBlurView::OnStageDisconnection( )
+{
+ if( mTargetSize == Vector2::ZERO )
+ {
+ return;
+ }
+
+ Actor self = Self();
+ for(unsigned int i=0; i<mBlurLevels+1;i++)
+ {
+ mRenderers[i].SetOffStage( self );
+ }
+
+ Control::OnStageDisconnection();
+}
+
+Vector3 SuperBlurView::GetNaturalSize()
+{
+ if( mInputImage )
+ {
+ return Vector3( mInputImage.GetWidth(), mInputImage.GetHeight(), 0.f );
+ }
+ return Vector3::ZERO;
+}
+
void SuperBlurView::SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value )
{
Toolkit::SuperBlurView superBlurView = Toolkit::SuperBlurView::DownCast( Dali::BaseHandle( object ) );
{
Property::Value value;
- Toolkit::SuperBlurView pushButton = Toolkit::SuperBlurView::DownCast( Dali::BaseHandle( object ) );
+ Toolkit::SuperBlurView blurView = Toolkit::SuperBlurView::DownCast( Dali::BaseHandle( object ) );
- if( pushButton )
+ if( blurView )
{
- SuperBlurView& superBlurViewImpl( GetImpl( pushButton ) );
+ SuperBlurView& superBlurViewImpl( GetImpl( blurView ) );
if( propertyIndex == Toolkit::SuperBlurView::Property::IMAGE )
{
Property::Map map;
- if( !superBlurViewImpl.mImageActors.empty() && superBlurViewImpl.mImageActors[0] )
+ Image inputImage = superBlurViewImpl.GetImage();
+ if( !inputImage )
{
- Scripting::CreatePropertyMap( superBlurViewImpl.mImageActors[0], map );
+ Scripting::CreatePropertyMap( inputImage, map );
}
value = Property::Value( map );
}
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/devel-api/controls/super-blur-view/super-blur-view.h>
#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
+#include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
namespace Dali
{
*/
void SetImage(Image inputImage);
+ /**
+ * Get the image for blurring.
+ * @return The image for blurring.
+ */
+ Image GetImage();
+
/**
* @copydoc Dali::Toolkit::SuperBlurView::GetBlurStrengthPropertyIndex
*/
*/
virtual void OnSizeSet(const Vector3& targetSize);
+ /**
+ * @copydoc CustomActorImpl::OnStageConnection()
+ */
+ virtual void OnStageConnection( int depth );
+
+ /**
+ * @copydoc CustomActorImpl::OnStageDisconnection()
+ */
+ virtual void OnStageDisconnection();
+
+ /**
+ * @copydoc CustomActorImpl::GetNaturalSize()
+ */
+ virtual Vector3 GetNaturalSize();
+
private:
/**
void ClearBlurResource();
private:
-
- unsigned int mBlurLevels;
-
- Property::Index mBlurStrengthPropertyIndex;
-
std::vector<Toolkit::GaussianBlurView> mGaussianBlurView;
std::vector<FrameBufferImage> mBlurredImage;
- std::vector<ImageActor> mImageActors;
- bool mResourcesCleared;
-
+ std::vector<Toolkit::ControlRenderer> mRenderers;
+ Image mInputImage;
Vector2 mTargetSize;
+
Toolkit::SuperBlurView::SuperBlurViewSignal mBlurFinishedSignal; ///< Signal emitted when blur has completed.
+
+ Property::Index mBlurStrengthPropertyIndex;
+ unsigned int mBlurLevels;
+ bool mResourcesCleared;
};
}
// EXTERNAL INCLUDES
#include <dali/public-api/actors/camera-actor.h>
-#include <dali/public-api/actors/image-actor.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/images/frame-buffer-image.h>
#include <dali/public-api/render-tasks/render-task.h>
-#include <dali/public-api/shader-effects/shader-effect.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control.h>
{
ImageView imageView = Internal::ImageView::New();
imageView.SetImage( image );
- return ImageView( imageView );
+ return imageView;
}
ImageView ImageView::New( const std::string& url )