CreateInstance() static private method

static private CreateInstance ( MagickSettings instance ) : INativeInstance
instance MagickSettings
return INativeInstance
 public IntPtr ReadBlob(IMagickSettings <QuantumType> settings, byte[] data, int offset, int length)
 {
     using (INativeInstance settingsNative = MagickSettings.CreateInstance(settings))
     {
         IntPtr exception = IntPtr.Zero;
         IntPtr result;
         #if PLATFORM_AnyCPU
         if (OperatingSystem.Is64Bit)
         #endif
         #if PLATFORM_x64 || PLATFORM_AnyCPU
         result = NativeMethods.X64.MagickImageCollection_ReadBlob(settingsNative.Instance, data, (UIntPtr)offset, (UIntPtr)length, out exception);
         #endif
         #if PLATFORM_AnyCPU
         else
         #endif
         #if PLATFORM_x86 || PLATFORM_AnyCPU
         result = NativeMethods.X86.MagickImageCollection_ReadBlob(settingsNative.Instance, data, (UIntPtr)offset, (UIntPtr)length, out exception);
         #endif
         var magickException = MagickExceptionHelper.Create(exception);
         if (magickException == null)
         {
             return(result);
         }
         if (magickException is MagickErrorException)
         {
             if (result != IntPtr.Zero)
             {
                 Dispose(result);
             }
             throw magickException;
         }
         RaiseWarning(magickException);
         return(result);
     }
 }
 public IntPtr ReadStream(IMagickSettings <QuantumType> settings, ReadWriteStreamDelegate reader, SeekStreamDelegate seeker, TellStreamDelegate teller)
 {
     using (INativeInstance settingsNative = MagickSettings.CreateInstance(settings))
     {
         IntPtr exception = IntPtr.Zero;
         IntPtr result;
         #if PLATFORM_AnyCPU
         if (OperatingSystem.Is64Bit)
         #endif
         #if PLATFORM_x64 || PLATFORM_AnyCPU
         result = NativeMethods.X64.MagickImageCollection_ReadStream(settingsNative.Instance, reader, seeker, teller, out exception);
         #endif
         #if PLATFORM_AnyCPU
         else
         #endif
         #if PLATFORM_x86 || PLATFORM_AnyCPU
         result = NativeMethods.X86.MagickImageCollection_ReadStream(settingsNative.Instance, reader, seeker, teller, out exception);
         #endif
         var magickException = MagickExceptionHelper.Create(exception);
         if (magickException == null)
         {
             return(result);
         }
         if (magickException is MagickErrorException)
         {
             if (result != IntPtr.Zero)
             {
                 Dispose(result);
             }
             throw magickException;
         }
         RaiseWarning(magickException);
         return(result);
     }
 }
 public IntPtr WriteStream(IMagickImage image, MagickSettings settings, ReadWriteStreamDelegate reader, ReadWriteStreamDelegate writer, SeekStreamDelegate seeker, TellStreamDelegate teller)
 {
     using (INativeInstance settingsNative = MagickSettings.CreateInstance(settings))
     {
         IntPtr exception = IntPtr.Zero;
         IntPtr result;
         #if PLATFORM_AnyCPU
         if (NativeLibrary.Is64Bit)
         #endif
         #if PLATFORM_x64 || PLATFORM_AnyCPU
         result = NativeMethods.X64.MagickImageCollection_WriteStream(image.GetInstance(), settingsNative.Instance, reader, writer, seeker, teller, out exception);
         #endif
         #if PLATFORM_AnyCPU
         else
         #endif
         #if PLATFORM_x86 || PLATFORM_AnyCPU
         result = NativeMethods.X86.MagickImageCollection_WriteStream(image.GetInstance(), settingsNative.Instance, reader, writer, seeker, teller, out exception);
         #endif
         MagickException magickException = MagickExceptionHelper.Create(exception);
         if (MagickExceptionHelper.IsError(magickException))
         {
             if (result != IntPtr.Zero)
             {
                 Dispose(result);
             }
             throw magickException;
         }
         RaiseWarning(magickException);
         return(result);
     }
 }
Example #4
0
 public IntPtr ReadFile(MagickSettings settings)
 {
     using (INativeInstance settingsNative = MagickSettings.CreateInstance(settings))
     {
         IntPtr exception = IntPtr.Zero;
         IntPtr result;
         #if PLATFORM_AnyCPU
         if (NativeLibrary.Is64Bit)
         #endif
         #if PLATFORM_x64 || PLATFORM_AnyCPU
         result = NativeMethods.X64.MagickImageCollection_ReadFile(settingsNative.Instance, out exception);
         #endif
         #if PLATFORM_AnyCPU
         else
         #endif
         #if PLATFORM_x86 || PLATFORM_AnyCPU
         result = NativeMethods.X86.MagickImageCollection_ReadFile(settingsNative.Instance, out exception);
         #endif
         var magickException = MagickExceptionHelper.Create(exception);
         if (magickException == null)
         {
             return(result);
         }
         if (magickException is MagickErrorException)
         {
             if (result != IntPtr.Zero)
             {
                 Dispose(result);
             }
             throw magickException;
         }
         RaiseWarning(magickException);
         return(result);
     }
 }
 public IntPtr ReadBlob(MagickSettings settings, byte[] data, int length)
 {
     using (INativeInstance settingsNative = MagickSettings.CreateInstance(settings))
     {
         IntPtr exception = IntPtr.Zero;
         IntPtr result;
         #if PLATFORM_AnyCPU
         if (NativeLibrary.Is64Bit)
         #endif
         #if PLATFORM_x64 || PLATFORM_AnyCPU
         result = NativeMethods.X64.MagickImageCollection_ReadBlob(settingsNative.Instance, data, (UIntPtr)length, out exception);
         #endif
         #if PLATFORM_AnyCPU
         else
         #endif
         #if PLATFORM_x86 || PLATFORM_AnyCPU
         result = NativeMethods.X86.MagickImageCollection_ReadBlob(settingsNative.Instance, data, (UIntPtr)length, out exception);
         #endif
         MagickException magickException = MagickExceptionHelper.Create(exception);
         if (MagickExceptionHelper.IsError(magickException))
         {
             if (result != IntPtr.Zero)
             {
                 Dispose(result);
             }
             throw magickException;
         }
         RaiseWarning(magickException);
         return(result);
     }
 }
Example #6
0
 public IntPtr WriteBlob(MagickImage image, MagickSettings settings, out UIntPtr length)
 {
     using (INativeInstance settingsNative = MagickSettings.CreateInstance(settings))
     {
         IntPtr exception = IntPtr.Zero;
         IntPtr result;
         if (NativeLibrary.Is64Bit)
         {
             result = NativeMethods.X64.MagickImageCollection_WriteBlob(MagickImage.GetInstance(image), settingsNative.Instance, out length, out exception);
         }
         else
         {
             result = NativeMethods.X86.MagickImageCollection_WriteBlob(MagickImage.GetInstance(image), settingsNative.Instance, out length, out exception);
         }
         MagickException magickException = MagickExceptionHelper.Create(exception);
         if (MagickExceptionHelper.IsError(magickException))
         {
             if (result != IntPtr.Zero)
             {
                 MagickMemory.Relinquish(result);
             }
             throw magickException;
         }
         RaiseWarning(magickException);
         return(result);
     }
 }
Example #7
0
 public IntPtr ReadFile(MagickSettings settings)
 {
     using (INativeInstance settingsNative = MagickSettings.CreateInstance(settings))
     {
         IntPtr exception = IntPtr.Zero;
         IntPtr result;
         if (NativeLibrary.Is64Bit)
         {
             result = NativeMethods.X64.MagickImageCollection_ReadFile(settingsNative.Instance, out exception);
         }
         else
         {
             result = NativeMethods.X86.MagickImageCollection_ReadFile(settingsNative.Instance, out exception);
         }
         MagickException magickException = MagickExceptionHelper.Create(exception);
         if (MagickExceptionHelper.IsError(magickException))
         {
             if (result != IntPtr.Zero)
             {
                 Dispose(result);
             }
             throw magickException;
         }
         RaiseWarning(magickException);
         return(result);
     }
 }
Example #8
0
 public void WriteFile(MagickImage image, MagickSettings settings)
 {
     using (INativeInstance settingsNative = MagickSettings.CreateInstance(settings))
     {
         IntPtr exception = IntPtr.Zero;
         if (NativeLibrary.Is64Bit)
         {
             NativeMethods.X64.MagickImageCollection_WriteFile(MagickImage.GetInstance(image), settingsNative.Instance, out exception);
         }
         else
         {
             NativeMethods.X86.MagickImageCollection_WriteFile(MagickImage.GetInstance(image), settingsNative.Instance, out exception);
         }
         CheckException(exception);
     }
 }
 public void WriteStream(IMagickImage image, IMagickSettings <QuantumType> settings, ReadWriteStreamDelegate writer, SeekStreamDelegate seeker, TellStreamDelegate teller, ReadWriteStreamDelegate reader)
 {
     using (INativeInstance settingsNative = MagickSettings.CreateInstance(settings))
     {
         IntPtr exception = IntPtr.Zero;
         #if PLATFORM_AnyCPU
         if (OperatingSystem.Is64Bit)
         #endif
         #if PLATFORM_x64 || PLATFORM_AnyCPU
         NativeMethods.X64.MagickImageCollection_WriteStream(image.GetInstance(), settingsNative.Instance, writer, seeker, teller, reader, out exception);
         #endif
         #if PLATFORM_AnyCPU
         else
         #endif
         #if PLATFORM_x86 || PLATFORM_AnyCPU
         NativeMethods.X86.MagickImageCollection_WriteStream(image.GetInstance(), settingsNative.Instance, writer, seeker, teller, reader, out exception);
         #endif
         CheckException(exception);
     }
 }
 public void WriteFile(IMagickImage image, IMagickSettings <QuantumType> settings)
 {
     using (INativeInstance settingsNative = MagickSettings.CreateInstance(settings))
     {
         IntPtr exception = IntPtr.Zero;
         #if PLATFORM_AnyCPU
         if (OperatingSystem.Is64Bit)
         #endif
         #if PLATFORM_x64 || PLATFORM_AnyCPU
         NativeMethods.X64.MagickImageCollection_WriteFile(image.GetInstance(), settingsNative.Instance, out exception);
         #endif
         #if PLATFORM_AnyCPU
         else
         #endif
         #if PLATFORM_x86 || PLATFORM_AnyCPU
         NativeMethods.X86.MagickImageCollection_WriteFile(image.GetInstance(), settingsNative.Instance, out exception);
         #endif
         CheckException(exception);
     }
 }
Example #11
0
   public void WriteFile(MagickImage image, MagickSettings settings)
   {
       using (INativeInstance settingsNative = MagickSettings.CreateInstance(settings))
       {
           IntPtr exception = IntPtr.Zero;
 #if ANYCPU
           if (NativeLibrary.Is64Bit)
 #endif
 #if WIN64 || ANYCPU
           NativeMethods.X64.MagickImageCollection_WriteFile(MagickImage.GetInstance(image), settingsNative.Instance, out exception);
 #endif
 #if ANYCPU
           else
 #endif
 #if !WIN64 || ANYCPU
           NativeMethods.X86.MagickImageCollection_WriteFile(MagickImage.GetInstance(image), settingsNative.Instance, out exception);
 #endif
           CheckException(exception);
       }
   }