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/dali.h>
25 #include <dali-toolkit/public-api/controls/control-impl.h>
26 #include <dali-toolkit/public-api/controls/effects-view/effects-view.h>
38 * An interface class that provides a interface for image filters that perform
39 * a simple shader effect on an input image, rendering the output to a FrameBufferImage.
44 typedef std::vector< Vector3 > FilterKernel;
56 virtual ~ImageFilter();
59 * Enable effect, allocates any necessary resources
61 virtual void Enable() = 0;
64 * Disable effect, releases any allocated resources
66 virtual void Disable() = 0;
69 * Refresh the filter output
71 virtual void Refresh() = 0;
74 * @copydoc Dali::Toolkit::EffectsView::SetRefreshOnDemand
76 void SetRefreshOnDemand( bool onDemand );
80 * @param[in] The input/original image.
82 void SetInputImage( Image image );
85 * Set the output image
86 * @return The output image.
88 void SetOutputImage( FrameBufferImage image );
91 * Set size of ImageFilter. Used to create internal offscreen buffers
92 * @param[in] size THe size.
94 void SetSize( const Vector2& size );
97 * Set the pixel format for internal offscreen buffers
98 * @param[in] pixelFormat The pixel format.
100 void SetPixelFormat( Pixel::Format pixelFormat );
103 * Set the filter kernel
104 * @param[in] The filter kernel
106 void SetKernel( const FilterKernel& kernel );
109 * Get a const reference to the internal filter kernel
110 * @Return A a const reference to the internal filter kernel
112 const FilterKernel& GetKernel() const;
115 * Get the number of steps/elements in the kernel
116 * @return The number of steps/elements in the kernel
118 size_t GetKernelSize() const;
121 * Create a kernel from an array of weights
125 void CreateKernel( const float* weights, size_t count);
128 * Set the actor which acts as the root actor for all internal actors for connection to stage
129 * @param[in] rootActor An actor which acts as the root actor for any internal actors that need
132 void SetRootActor( Actor rootActor );
135 * Set the background / clear color
136 * @param[in] color The background / clear color
138 void SetBackgroundColor( const Vector4& color );
141 * Enable optional debug output in the shader
142 * @param[in] flag Set true to enable, dalse to disable.
144 void RenderDebug( bool flag );
148 FrameBufferImage mOutputImage;
149 FilterKernel mKernel;
151 Vector4 mBackgroundColor;
153 Pixel::Format mPixelFormat;
154 bool mRefreshOnDemand;
156 }; // class Imagefilter
158 } // namespace Internal
160 } // namespace Toolkit
164 #endif // __DALI_TOOLKIT_INTERNAL_IMAGE_FILTER_H__