1 #ifndef __DALI_TOOLKIT_INTERNAL_IMAGE_FILTER_H__
2 #define __DALI_TOOLKIT_INTERNAL_IMAGE_FILTER_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
24 #include <dali-toolkit/public-api/controls/control-impl.h>
25 #include <dali-toolkit/devel-api/controls/effects-view/effects-view.h>
37 * An interface class that provides a interface for image filters that perform
38 * a simple shader effect on an input image, rendering the output to a FrameBufferImage.
43 typedef std::vector< Vector3 > FilterKernel;
55 virtual ~ImageFilter();
58 * Enable effect, allocates any necessary resources
60 virtual void Enable() = 0;
63 * Disable effect, releases any allocated resources
65 virtual void Disable() = 0;
68 * Refresh the filter output
70 virtual void Refresh() = 0;
73 * @copydoc Dali::Toolkit::EffectsView::SetRefreshOnDemand
75 void SetRefreshOnDemand( bool onDemand );
79 * @param[in] The input/original image.
81 void SetInputImage( Image image );
84 * Set the output image
85 * @return The output image.
87 void SetOutputImage( FrameBufferImage image );
90 * Set size of ImageFilter. Used to create internal offscreen buffers
91 * @param[in] size THe size.
93 virtual void SetSize( const Vector2& size );
96 * Set the pixel format for internal offscreen buffers
97 * @param[in] pixelFormat The pixel format.
99 void SetPixelFormat( Pixel::Format pixelFormat );
102 * Set the filter kernel
103 * @param[in] The filter kernel
105 void SetKernel( const FilterKernel& kernel );
108 * Get a const reference to the internal filter kernel
109 * @Return A a const reference to the internal filter kernel
111 const FilterKernel& GetKernel() const;
114 * Get the number of steps/elements in the kernel
115 * @return The number of steps/elements in the kernel
117 size_t GetKernelSize() const;
120 * Create a kernel from an array of weights
124 void CreateKernel( const float* weights, size_t count);
127 * Set the actor which acts as the root actor for all internal actors for connection to stage
128 * @param[in] rootActor An actor which acts as the root actor for any internal actors that need
131 void SetRootActor( Actor rootActor );
134 * Set the background / clear color
135 * @param[in] color The background / clear color
137 void SetBackgroundColor( const Vector4& color );
140 * Enable optional debug output in the shader
141 * @param[in] flag Set true to enable, dalse to disable.
143 void RenderDebug( bool flag );
147 FrameBufferImage mOutputImage;
148 FilterKernel mKernel;
150 Vector4 mBackgroundColor;
152 Pixel::Format mPixelFormat;
153 bool mRefreshOnDemand;
155 }; // class Imagefilter
157 } // namespace Internal
159 } // namespace Toolkit
163 #endif // __DALI_TOOLKIT_INTERNAL_IMAGE_FILTER_H__