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)
64 NDalicPINVOKE.delete_GaussianBlurView(swigCPtr);
66 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
74 public class FinishedEventArgs : EventArgs
76 private GaussianBlurView _gaussianBlurView;
78 public GaussianBlurView GaussianBlurView
82 return _gaussianBlurView;
86 _gaussianBlurView = value;
91 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
92 private delegate void FinishedEventCallbackDelegate(IntPtr application);
93 private DaliEventHandler<object, FinishedEventArgs> _gaussianFinishedEventHandler;
94 private FinishedEventCallbackDelegate _gaussianFinishedEventCallbackDelegate;
96 public event DaliEventHandler<object, FinishedEventArgs> Finished
102 // Restricted to only one listener
103 if (_gaussianFinishedEventHandler == null)
105 _gaussianFinishedEventHandler += value;
107 _gaussianFinishedEventCallbackDelegate = new FinishedEventCallbackDelegate(OnFinished);
108 this.FinishedSignal().Connect(_gaussianFinishedEventCallbackDelegate);
117 if (_gaussianFinishedEventHandler != null)
119 this.FinishedSignal().Disconnect(_gaussianFinishedEventCallbackDelegate);
122 _gaussianFinishedEventHandler -= value;
127 // Callback for GaussianBlurView FinishedSignal
128 private void OnFinished(IntPtr data)
130 FinishedEventArgs e = new FinishedEventArgs();
132 // Populate all members of "e" (FinishedEventArgs) with real data
133 e.GaussianBlurView = Registry.GetManagedBaseHandleFromNativePtr(data) as GaussianBlurView;
135 if (_gaussianFinishedEventHandler != null)
137 //here we send all data to user event handlers
138 _gaussianFinishedEventHandler(this, e);
142 public GaussianBlurView() : this(NDalicPINVOKE.GaussianBlurView_New__SWIG_0(), true)
144 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
147 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)
149 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
152 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)
154 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
157 public GaussianBlurView(GaussianBlurView handle) : this(NDalicPINVOKE.new_GaussianBlurView__SWIG_1(GaussianBlurView.getCPtr(handle)), true)
159 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
162 public GaussianBlurView Assign(GaussianBlurView ZoomView)
164 GaussianBlurView ret = new GaussianBlurView(NDalicPINVOKE.GaussianBlurView_Assign(swigCPtr, GaussianBlurView.getCPtr(ZoomView)), false);
165 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
169 public new static GaussianBlurView DownCast(BaseHandle handle)
171 GaussianBlurView ret = new GaussianBlurView(NDalicPINVOKE.GaussianBlurView_DownCast(BaseHandle.getCPtr(handle)), true);
172 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
176 public new void Add(View child)
178 NDalicPINVOKE.GaussianBlurView_Add(swigCPtr, View.getCPtr(child));
179 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
182 public new void Remove(View child)
184 NDalicPINVOKE.GaussianBlurView_Remove(swigCPtr, View.getCPtr(child));
185 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
188 public void Activate()
190 NDalicPINVOKE.GaussianBlurView_Activate(swigCPtr);
191 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
194 public void ActivateOnce()
196 NDalicPINVOKE.GaussianBlurView_ActivateOnce(swigCPtr);
197 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200 public void Deactivate()
202 NDalicPINVOKE.GaussianBlurView_Deactivate(swigCPtr);
203 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
206 public void SetUserImageAndOutputRenderTarget(Image inputImage, FrameBufferImage outputRenderTarget)
208 NDalicPINVOKE.GaussianBlurView_SetUserImageAndOutputRenderTarget(swigCPtr, Image.getCPtr(inputImage), FrameBufferImage.getCPtr(outputRenderTarget));
209 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
212 public int GetBlurStrengthPropertyIndex()
214 int ret = NDalicPINVOKE.GaussianBlurView_GetBlurStrengthPropertyIndex(swigCPtr);
215 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219 public FrameBufferImage GetBlurredRenderTarget()
221 FrameBufferImage ret = new FrameBufferImage(NDalicPINVOKE.GaussianBlurView_GetBlurredRenderTarget(swigCPtr), true);
222 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
226 public new void SetBackgroundColor(Vector4 color)
228 NDalicPINVOKE.GaussianBlurView_SetBackgroundColor(swigCPtr, Vector4.getCPtr(color));
229 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
232 public new Vector4 GetBackgroundColor()
234 Vector4 ret = new Vector4(NDalicPINVOKE.GaussianBlurView_GetBackgroundColor(swigCPtr), true);
235 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
239 public GaussianBlurViewSignal FinishedSignal()
241 GaussianBlurViewSignal ret = new GaussianBlurViewSignal(NDalicPINVOKE.GaussianBlurView_FinishedSignal(swigCPtr), false);
242 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();