1 #pragma warning disable CS1591
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
6 using System.Threading;
7 using System.ComponentModel;
12 /// <summary>A simple API to apply blur effects.
13 /// Those API's might use <see cref="Efl.Gfx.IFilter"/> internally. It might be necessary to also specify the color of the blur with <see cref="Efl.Gfx.IColor.GetColor"/>.</summary>
14 [Efl.Gfx.IBlurConcrete.NativeMethods]
15 public interface IBlur :
16 Efl.Eo.IWrapper, IDisposable
18 /// <summary>The blur radius in pixels.</summary>
19 /// <param name="rx">The horizontal blur radius.</param>
20 /// <param name="ry">The vertical blur radius.</param>
21 void GetRadius(out double rx, out double ry);
22 /// <summary>The blur radius in pixels.</summary>
23 /// <param name="rx">The horizontal blur radius.</param>
24 /// <param name="ry">The vertical blur radius.</param>
25 void SetRadius(double rx, double ry);
26 /// <summary>An offset relative to the original pixels.
27 /// This property allows for drop shadow effects.</summary>
28 /// <param name="ox">Horizontal offset in pixels.</param>
29 /// <param name="oy">Vertical offset in pixels.</param>
30 void GetOffset(out double ox, out double oy);
31 /// <summary>An offset relative to the original pixels.
32 /// This property allows for drop shadow effects.</summary>
33 /// <param name="ox">Horizontal offset in pixels.</param>
34 /// <param name="oy">Vertical offset in pixels.</param>
35 void SetOffset(double ox, double oy);
36 /// <summary>How much the original image should be "grown" before blurring.
37 /// Growing is a combination of blur & color levels adjustment. If the value of grow is positive, the pixels will appear more "fat" or "bold" than the original. If the value is negative, a shrink effect happens instead.
39 /// This is can be used efficiently to create glow effects.</summary>
40 /// <returns>How much to grow the original pixel data.</returns>
42 /// <summary>How much the original image should be "grown" before blurring.
43 /// Growing is a combination of blur & color levels adjustment. If the value of grow is positive, the pixels will appear more "fat" or "bold" than the original. If the value is negative, a shrink effect happens instead.
45 /// This is can be used efficiently to create glow effects.</summary>
46 /// <param name="radius">How much to grow the original pixel data.</param>
47 void SetGrow(double radius);
48 /// <summary>How much the original image should be "grown" before blurring.
49 /// Growing is a combination of blur & color levels adjustment. If the value of grow is positive, the pixels will appear more "fat" or "bold" than the original. If the value is negative, a shrink effect happens instead.
51 /// This is can be used efficiently to create glow effects.</summary>
52 /// <value>How much to grow the original pixel data.</value>
58 /// <summary>A simple API to apply blur effects.
59 /// Those API's might use <see cref="Efl.Gfx.IFilter"/> internally. It might be necessary to also specify the color of the blur with <see cref="Efl.Gfx.IColor.GetColor"/>.</summary>
60 sealed public class IBlurConcrete :
65 ///<summary>Pointer to the native class description.</summary>
66 public System.IntPtr NativeClass
70 if (((object)this).GetType() == typeof(IBlurConcrete))
72 return GetEflClassStatic();
76 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
81 private System.IntPtr handle;
82 ///<summary>Pointer to the native instance.</summary>
83 public System.IntPtr NativeHandle
85 get { return handle; }
88 [System.Runtime.InteropServices.DllImport(efl.Libs.Efl)] internal static extern System.IntPtr
89 efl_gfx_blur_interface_get();
90 /// <summary>Initializes a new instance of the <see cref="IBlur"/> class.
91 /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
92 private IBlurConcrete(System.IntPtr raw)
96 ///<summary>Destructor.</summary>
102 ///<summary>Releases the underlying native instance.</summary>
103 private void Dispose(bool disposing)
105 if (handle != System.IntPtr.Zero)
108 handle = IntPtr.Zero;
110 IntPtr gcHandlePtr = IntPtr.Zero;
113 Efl.Eo.Globals.efl_mono_native_dispose(h, gcHandlePtr);
117 Monitor.Enter(Efl.All.InitLock);
118 if (Efl.All.MainLoopInitialized)
120 Efl.Eo.Globals.efl_mono_thread_safe_native_dispose(h, gcHandlePtr);
123 Monitor.Exit(Efl.All.InitLock);
129 ///<summary>Releases the underlying native instance.</summary>
130 public void Dispose()
133 GC.SuppressFinalize(this);
136 /// <summary>Verifies if the given object is equal to this one.</summary>
137 /// <param name="instance">The object to compare to.</param>
138 /// <returns>True if both objects point to the same native object.</returns>
139 public override bool Equals(object instance)
141 var other = instance as Efl.Object;
146 return this.NativeHandle == other.NativeHandle;
149 /// <summary>Gets the hash code for this object based on the native pointer it points to.</summary>
150 /// <returns>The value of the pointer, to be used as the hash code of this object.</returns>
151 public override int GetHashCode()
153 return this.NativeHandle.ToInt32();
156 /// <summary>Turns the native pointer into a string representation.</summary>
157 /// <returns>A string with the type and the native pointer for this object.</returns>
158 public override String ToString()
160 return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
163 /// <summary>The blur radius in pixels.</summary>
164 /// <param name="rx">The horizontal blur radius.</param>
165 /// <param name="ry">The vertical blur radius.</param>
166 public void GetRadius(out double rx, out double ry) {
167 Efl.Gfx.IBlurConcrete.NativeMethods.efl_gfx_blur_radius_get_ptr.Value.Delegate(this.NativeHandle,out rx, out ry);
168 Eina.Error.RaiseIfUnhandledException();
170 /// <summary>The blur radius in pixels.</summary>
171 /// <param name="rx">The horizontal blur radius.</param>
172 /// <param name="ry">The vertical blur radius.</param>
173 public void SetRadius(double rx, double ry) {
174 Efl.Gfx.IBlurConcrete.NativeMethods.efl_gfx_blur_radius_set_ptr.Value.Delegate(this.NativeHandle,rx, ry);
175 Eina.Error.RaiseIfUnhandledException();
177 /// <summary>An offset relative to the original pixels.
178 /// This property allows for drop shadow effects.</summary>
179 /// <param name="ox">Horizontal offset in pixels.</param>
180 /// <param name="oy">Vertical offset in pixels.</param>
181 public void GetOffset(out double ox, out double oy) {
182 Efl.Gfx.IBlurConcrete.NativeMethods.efl_gfx_blur_offset_get_ptr.Value.Delegate(this.NativeHandle,out ox, out oy);
183 Eina.Error.RaiseIfUnhandledException();
185 /// <summary>An offset relative to the original pixels.
186 /// This property allows for drop shadow effects.</summary>
187 /// <param name="ox">Horizontal offset in pixels.</param>
188 /// <param name="oy">Vertical offset in pixels.</param>
189 public void SetOffset(double ox, double oy) {
190 Efl.Gfx.IBlurConcrete.NativeMethods.efl_gfx_blur_offset_set_ptr.Value.Delegate(this.NativeHandle,ox, oy);
191 Eina.Error.RaiseIfUnhandledException();
193 /// <summary>How much the original image should be "grown" before blurring.
194 /// Growing is a combination of blur & color levels adjustment. If the value of grow is positive, the pixels will appear more "fat" or "bold" than the original. If the value is negative, a shrink effect happens instead.
196 /// This is can be used efficiently to create glow effects.</summary>
197 /// <returns>How much to grow the original pixel data.</returns>
198 public double GetGrow() {
199 var _ret_var = Efl.Gfx.IBlurConcrete.NativeMethods.efl_gfx_blur_grow_get_ptr.Value.Delegate(this.NativeHandle);
200 Eina.Error.RaiseIfUnhandledException();
203 /// <summary>How much the original image should be "grown" before blurring.
204 /// Growing is a combination of blur & color levels adjustment. If the value of grow is positive, the pixels will appear more "fat" or "bold" than the original. If the value is negative, a shrink effect happens instead.
206 /// This is can be used efficiently to create glow effects.</summary>
207 /// <param name="radius">How much to grow the original pixel data.</param>
208 public void SetGrow(double radius) {
209 Efl.Gfx.IBlurConcrete.NativeMethods.efl_gfx_blur_grow_set_ptr.Value.Delegate(this.NativeHandle,radius);
210 Eina.Error.RaiseIfUnhandledException();
212 /// <summary>How much the original image should be "grown" before blurring.
213 /// Growing is a combination of blur & color levels adjustment. If the value of grow is positive, the pixels will appear more "fat" or "bold" than the original. If the value is negative, a shrink effect happens instead.
215 /// This is can be used efficiently to create glow effects.</summary>
216 /// <value>How much to grow the original pixel data.</value>
218 get { return GetGrow(); }
219 set { SetGrow(value); }
221 private static IntPtr GetEflClassStatic()
223 return Efl.Gfx.IBlurConcrete.efl_gfx_blur_interface_get();
225 /// <summary>Wrapper for native methods and virtual method delegates.
226 /// For internal use by generated code only.</summary>
227 public class NativeMethods : Efl.Eo.NativeClass
229 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Efl);
230 /// <summary>Gets the list of Eo operations to override.</summary>
231 /// <returns>The list of Eo operations to be overload.</returns>
232 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
234 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
235 var methods = Efl.Eo.Globals.GetUserMethods(type);
237 if (efl_gfx_blur_radius_get_static_delegate == null)
239 efl_gfx_blur_radius_get_static_delegate = new efl_gfx_blur_radius_get_delegate(radius_get);
242 if (methods.FirstOrDefault(m => m.Name == "GetRadius") != null)
244 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_gfx_blur_radius_get"), func = Marshal.GetFunctionPointerForDelegate(efl_gfx_blur_radius_get_static_delegate) });
247 if (efl_gfx_blur_radius_set_static_delegate == null)
249 efl_gfx_blur_radius_set_static_delegate = new efl_gfx_blur_radius_set_delegate(radius_set);
252 if (methods.FirstOrDefault(m => m.Name == "SetRadius") != null)
254 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_gfx_blur_radius_set"), func = Marshal.GetFunctionPointerForDelegate(efl_gfx_blur_radius_set_static_delegate) });
257 if (efl_gfx_blur_offset_get_static_delegate == null)
259 efl_gfx_blur_offset_get_static_delegate = new efl_gfx_blur_offset_get_delegate(offset_get);
262 if (methods.FirstOrDefault(m => m.Name == "GetOffset") != null)
264 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_gfx_blur_offset_get"), func = Marshal.GetFunctionPointerForDelegate(efl_gfx_blur_offset_get_static_delegate) });
267 if (efl_gfx_blur_offset_set_static_delegate == null)
269 efl_gfx_blur_offset_set_static_delegate = new efl_gfx_blur_offset_set_delegate(offset_set);
272 if (methods.FirstOrDefault(m => m.Name == "SetOffset") != null)
274 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_gfx_blur_offset_set"), func = Marshal.GetFunctionPointerForDelegate(efl_gfx_blur_offset_set_static_delegate) });
277 if (efl_gfx_blur_grow_get_static_delegate == null)
279 efl_gfx_blur_grow_get_static_delegate = new efl_gfx_blur_grow_get_delegate(grow_get);
282 if (methods.FirstOrDefault(m => m.Name == "GetGrow") != null)
284 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_gfx_blur_grow_get"), func = Marshal.GetFunctionPointerForDelegate(efl_gfx_blur_grow_get_static_delegate) });
287 if (efl_gfx_blur_grow_set_static_delegate == null)
289 efl_gfx_blur_grow_set_static_delegate = new efl_gfx_blur_grow_set_delegate(grow_set);
292 if (methods.FirstOrDefault(m => m.Name == "SetGrow") != null)
294 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_gfx_blur_grow_set"), func = Marshal.GetFunctionPointerForDelegate(efl_gfx_blur_grow_set_static_delegate) });
299 /// <summary>Returns the Eo class for the native methods of this class.</summary>
300 /// <returns>The native class pointer.</returns>
301 public override IntPtr GetEflClass()
303 return Efl.Gfx.IBlurConcrete.efl_gfx_blur_interface_get();
306 #pragma warning disable CA1707, SA1300, SA1600
309 private delegate void efl_gfx_blur_radius_get_delegate(System.IntPtr obj, System.IntPtr pd, out double rx, out double ry);
312 public delegate void efl_gfx_blur_radius_get_api_delegate(System.IntPtr obj, out double rx, out double ry);
314 public static Efl.Eo.FunctionWrapper<efl_gfx_blur_radius_get_api_delegate> efl_gfx_blur_radius_get_ptr = new Efl.Eo.FunctionWrapper<efl_gfx_blur_radius_get_api_delegate>(Module, "efl_gfx_blur_radius_get");
316 private static void radius_get(System.IntPtr obj, System.IntPtr pd, out double rx, out double ry)
318 Eina.Log.Debug("function efl_gfx_blur_radius_get was called");
319 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
322 rx = default(double); ry = default(double);
325 ((IBlur)wrapper).GetRadius(out rx, out ry);
329 Eina.Log.Warning($"Callback error: {e.ToString()}");
330 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
337 efl_gfx_blur_radius_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), out rx, out ry);
341 private static efl_gfx_blur_radius_get_delegate efl_gfx_blur_radius_get_static_delegate;
344 private delegate void efl_gfx_blur_radius_set_delegate(System.IntPtr obj, System.IntPtr pd, double rx, double ry);
347 public delegate void efl_gfx_blur_radius_set_api_delegate(System.IntPtr obj, double rx, double ry);
349 public static Efl.Eo.FunctionWrapper<efl_gfx_blur_radius_set_api_delegate> efl_gfx_blur_radius_set_ptr = new Efl.Eo.FunctionWrapper<efl_gfx_blur_radius_set_api_delegate>(Module, "efl_gfx_blur_radius_set");
351 private static void radius_set(System.IntPtr obj, System.IntPtr pd, double rx, double ry)
353 Eina.Log.Debug("function efl_gfx_blur_radius_set was called");
354 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
360 ((IBlur)wrapper).SetRadius(rx, ry);
364 Eina.Log.Warning($"Callback error: {e.ToString()}");
365 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
372 efl_gfx_blur_radius_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), rx, ry);
376 private static efl_gfx_blur_radius_set_delegate efl_gfx_blur_radius_set_static_delegate;
379 private delegate void efl_gfx_blur_offset_get_delegate(System.IntPtr obj, System.IntPtr pd, out double ox, out double oy);
382 public delegate void efl_gfx_blur_offset_get_api_delegate(System.IntPtr obj, out double ox, out double oy);
384 public static Efl.Eo.FunctionWrapper<efl_gfx_blur_offset_get_api_delegate> efl_gfx_blur_offset_get_ptr = new Efl.Eo.FunctionWrapper<efl_gfx_blur_offset_get_api_delegate>(Module, "efl_gfx_blur_offset_get");
386 private static void offset_get(System.IntPtr obj, System.IntPtr pd, out double ox, out double oy)
388 Eina.Log.Debug("function efl_gfx_blur_offset_get was called");
389 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
392 ox = default(double); oy = default(double);
395 ((IBlur)wrapper).GetOffset(out ox, out oy);
399 Eina.Log.Warning($"Callback error: {e.ToString()}");
400 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
407 efl_gfx_blur_offset_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), out ox, out oy);
411 private static efl_gfx_blur_offset_get_delegate efl_gfx_blur_offset_get_static_delegate;
414 private delegate void efl_gfx_blur_offset_set_delegate(System.IntPtr obj, System.IntPtr pd, double ox, double oy);
417 public delegate void efl_gfx_blur_offset_set_api_delegate(System.IntPtr obj, double ox, double oy);
419 public static Efl.Eo.FunctionWrapper<efl_gfx_blur_offset_set_api_delegate> efl_gfx_blur_offset_set_ptr = new Efl.Eo.FunctionWrapper<efl_gfx_blur_offset_set_api_delegate>(Module, "efl_gfx_blur_offset_set");
421 private static void offset_set(System.IntPtr obj, System.IntPtr pd, double ox, double oy)
423 Eina.Log.Debug("function efl_gfx_blur_offset_set was called");
424 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
430 ((IBlur)wrapper).SetOffset(ox, oy);
434 Eina.Log.Warning($"Callback error: {e.ToString()}");
435 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
442 efl_gfx_blur_offset_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), ox, oy);
446 private static efl_gfx_blur_offset_set_delegate efl_gfx_blur_offset_set_static_delegate;
449 private delegate double efl_gfx_blur_grow_get_delegate(System.IntPtr obj, System.IntPtr pd);
452 public delegate double efl_gfx_blur_grow_get_api_delegate(System.IntPtr obj);
454 public static Efl.Eo.FunctionWrapper<efl_gfx_blur_grow_get_api_delegate> efl_gfx_blur_grow_get_ptr = new Efl.Eo.FunctionWrapper<efl_gfx_blur_grow_get_api_delegate>(Module, "efl_gfx_blur_grow_get");
456 private static double grow_get(System.IntPtr obj, System.IntPtr pd)
458 Eina.Log.Debug("function efl_gfx_blur_grow_get was called");
459 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
462 double _ret_var = default(double);
465 _ret_var = ((IBlur)wrapper).GetGrow();
469 Eina.Log.Warning($"Callback error: {e.ToString()}");
470 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
478 return efl_gfx_blur_grow_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
482 private static efl_gfx_blur_grow_get_delegate efl_gfx_blur_grow_get_static_delegate;
485 private delegate void efl_gfx_blur_grow_set_delegate(System.IntPtr obj, System.IntPtr pd, double radius);
488 public delegate void efl_gfx_blur_grow_set_api_delegate(System.IntPtr obj, double radius);
490 public static Efl.Eo.FunctionWrapper<efl_gfx_blur_grow_set_api_delegate> efl_gfx_blur_grow_set_ptr = new Efl.Eo.FunctionWrapper<efl_gfx_blur_grow_set_api_delegate>(Module, "efl_gfx_blur_grow_set");
492 private static void grow_set(System.IntPtr obj, System.IntPtr pd, double radius)
494 Eina.Log.Debug("function efl_gfx_blur_grow_set was called");
495 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
501 ((IBlur)wrapper).SetGrow(radius);
505 Eina.Log.Warning($"Callback error: {e.ToString()}");
506 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
513 efl_gfx_blur_grow_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), radius);
517 private static efl_gfx_blur_grow_set_delegate efl_gfx_blur_grow_set_static_delegate;
519 #pragma warning restore CA1707, SA1300, SA1600