1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
17 using Tizen.NUI.BaseComponents;
23 using System.Runtime.InteropServices;
26 internal class GaussianBlurView : View
28 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
30 internal GaussianBlurView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.GaussianBlurView_SWIGUpcast(cPtr), cMemoryOwn)
32 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
35 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(GaussianBlurView obj)
37 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
40 protected override void Dispose(DisposeTypes type)
47 if (type == DisposeTypes.Explicit)
50 //Release your own managed resources here.
51 //You should release all of your own disposable objects here.
55 //Release your own unmanaged resources here.
56 //You should not access any managed member here except static instance.
57 //because the execution order of Finalizes is non-deterministic.
59 if (swigCPtr.Handle != global::System.IntPtr.Zero)
65 //Unreference this instance from Registry.
66 Registry.Unregister(this);
68 NDalicPINVOKE.delete_GaussianBlurView(swigCPtr);
70 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
78 public class FinishedEventArgs : EventArgs
80 private GaussianBlurView _gaussianBlurView;
82 public GaussianBlurView GaussianBlurView
86 return _gaussianBlurView;
90 _gaussianBlurView = value;
95 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
96 private delegate void FinishedEventCallbackDelegate(IntPtr application);
97 private DaliEventHandler<object, FinishedEventArgs> _gaussianFinishedEventHandler;
98 private FinishedEventCallbackDelegate _gaussianFinishedEventCallbackDelegate;
100 public event DaliEventHandler<object, FinishedEventArgs> Finished
106 // Restricted to only one listener
107 if (_gaussianFinishedEventHandler == null)
109 _gaussianFinishedEventHandler += value;
111 _gaussianFinishedEventCallbackDelegate = new FinishedEventCallbackDelegate(OnFinished);
112 this.FinishedSignal().Connect(_gaussianFinishedEventCallbackDelegate);
121 if (_gaussianFinishedEventHandler != null)
123 this.FinishedSignal().Disconnect(_gaussianFinishedEventCallbackDelegate);
126 _gaussianFinishedEventHandler -= value;
131 // Callback for GaussianBlurView FinishedSignal
132 private void OnFinished(IntPtr data)
134 FinishedEventArgs e = new FinishedEventArgs();
136 // Populate all members of "e" (FinishedEventArgs) with real data
137 e.GaussianBlurView = Registry.GetManagedBaseHandleFromNativePtr(data) as GaussianBlurView;
139 if (_gaussianFinishedEventHandler != null)
141 //here we send all data to user event handlers
142 _gaussianFinishedEventHandler(this, e);
146 public GaussianBlurView() : this(NDalicPINVOKE.GaussianBlurView_New__SWIG_0(), true)
148 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
151 public GaussianBlurView(uint numSamples, float blurBellCurveWidth, PixelFormat renderTargetPixelFormat, float downsampleWidthScale, float downsampleHeightScale, bool blurUserImage) : this(NDalicPINVOKE.GaussianBlurView_New__SWIG_1(numSamples, blurBellCurveWidth, (int)renderTargetPixelFormat, downsampleWidthScale, downsampleHeightScale, blurUserImage), true)
153 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
156 public GaussianBlurView(uint numSamples, float blurBellCurveWidth, PixelFormat renderTargetPixelFormat, float downsampleWidthScale, float downsampleHeightScale) : this(NDalicPINVOKE.GaussianBlurView_New__SWIG_2(numSamples, blurBellCurveWidth, (int)renderTargetPixelFormat, downsampleWidthScale, downsampleHeightScale), true)
158 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161 public GaussianBlurView(GaussianBlurView handle) : this(NDalicPINVOKE.new_GaussianBlurView__SWIG_1(GaussianBlurView.getCPtr(handle)), true)
163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
166 public GaussianBlurView Assign(GaussianBlurView ZoomView)
168 GaussianBlurView ret = new GaussianBlurView(NDalicPINVOKE.GaussianBlurView_Assign(swigCPtr, GaussianBlurView.getCPtr(ZoomView)), false);
169 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
173 public new static GaussianBlurView DownCast(BaseHandle handle)
175 GaussianBlurView ret = new GaussianBlurView(NDalicPINVOKE.GaussianBlurView_DownCast(BaseHandle.getCPtr(handle)), true);
176 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180 public new void Add(View child)
182 NDalicPINVOKE.GaussianBlurView_Add(swigCPtr, View.getCPtr(child));
183 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
186 public new void Remove(View child)
188 NDalicPINVOKE.GaussianBlurView_Remove(swigCPtr, View.getCPtr(child));
189 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192 public void Activate()
194 NDalicPINVOKE.GaussianBlurView_Activate(swigCPtr);
195 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
198 public void ActivateOnce()
200 NDalicPINVOKE.GaussianBlurView_ActivateOnce(swigCPtr);
201 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
204 public void Deactivate()
206 NDalicPINVOKE.GaussianBlurView_Deactivate(swigCPtr);
207 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
210 public void SetUserImageAndOutputRenderTarget(Image inputImage, FrameBufferImage outputRenderTarget)
212 NDalicPINVOKE.GaussianBlurView_SetUserImageAndOutputRenderTarget(swigCPtr, Image.getCPtr(inputImage), FrameBufferImage.getCPtr(outputRenderTarget));
213 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
216 public int GetBlurStrengthPropertyIndex()
218 int ret = NDalicPINVOKE.GaussianBlurView_GetBlurStrengthPropertyIndex(swigCPtr);
219 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
223 public FrameBufferImage GetBlurredRenderTarget()
225 FrameBufferImage ret = new FrameBufferImage(NDalicPINVOKE.GaussianBlurView_GetBlurredRenderTarget(swigCPtr), true);
226 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
230 public new void SetBackgroundColor(Vector4 color)
232 NDalicPINVOKE.GaussianBlurView_SetBackgroundColor(swigCPtr, Vector4.getCPtr(color));
233 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
236 public new Vector4 GetBackgroundColor()
238 Vector4 ret = new Vector4(NDalicPINVOKE.GaussianBlurView_GetBackgroundColor(swigCPtr), true);
239 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
243 public GaussianBlurViewSignal FinishedSignal()
245 GaussianBlurViewSignal ret = new GaussianBlurViewSignal(NDalicPINVOKE.GaussianBlurView_FinishedSignal(swigCPtr), false);
246 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();