82 private readonly Handle _handle;
83 private bool _disposed;
95 _handle =
new Handle();
112 DllHelper.ExecuteAndMapReturnCodes(() =>
113 CInterface.peak_icv_ToneMapping_GetAlgorithm(_handle, out algorithm));
124 GC.SuppressFinalize(
this);
127 SafeHandle IHasSafeHandle.Handle => _handle;
171 DllHelper.ExecuteAndMapReturnCodes(() => CInterface.peak_icv_ToneMapping_Process_GetOutputPixelFormat(
174 out outputPixelFormat));
176 Image outputImage =
new(
180 DllHelper.ExecuteAndMapReturnCodes(() => CInterface.peak_icv_ToneMapping_Process(
183 outputImage._handle));
191 protected virtual void Dispose(
bool disposing)
206 private void ThrowIfDisposed()
214 internal sealed class Handle : SafeHandleZeroOrMinusOneIsInvalid
216 internal Handle() : base(true)
218 DllHelper.ExecuteAndMapReturnCodes(() => CInterface.peak_icv_ToneMapping_Create(out handle));
221 protected override bool ReleaseHandle()
223 return CInterface.peak_icv_ToneMapping_Destroy(handle) == 0;
227 private static class CInterface
229 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
230 public static extern Backend.Types.peak_icv_status peak_icv_ToneMapping_Create(
233 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
234 public static extern Backend.Types.peak_icv_status peak_icv_ToneMapping_Destroy(
237 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
238 public static extern Backend.Types.peak_icv_status peak_icv_ToneMapping_GetAlgorithm(
242 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
243 public static extern Backend.Types.peak_icv_status peak_icv_ToneMapping_SetAlgorithm(
247 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
248 public static extern Backend.Types.peak_icv_status peak_icv_ToneMapping_Process_GetOutputPixelFormat(
253 [DllImport(Global.LibraryName, CallingConvention = Global.CallingConvention)]
254 public static extern Backend.Types.peak_icv_status peak_icv_ToneMapping_Process(
256 Image.Handle input_image_handle,
257 Image.Handle output_image_handle);