Пример #1
0
            public IntPtr Polynomial(IMagickImage?image, double[] terms, int length)
            {
                IntPtr exception = IntPtr.Zero;
                IntPtr result;

                #if PLATFORM_AnyCPU
                if (OperatingSystem.Is64Bit)
                #endif
                #if PLATFORM_x64 || PLATFORM_AnyCPU
                result = NativeMethods.X64.MagickImageCollection_Polynomial(image.GetInstance(), terms, (UIntPtr)length, out exception);
                #endif
                #if PLATFORM_AnyCPU
                else
                #endif
                #if PLATFORM_x86 || PLATFORM_AnyCPU
                result = NativeMethods.X86.MagickImageCollection_Polynomial(image.GetInstance(), terms, (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);
            }
Пример #2
0
            public NativePixelCollection(IMagickImage?image)
            {
                IntPtr exception = IntPtr.Zero;

                #if PLATFORM_AnyCPU
                if (OperatingSystem.IsArm64)
                #endif
                #if PLATFORM_arm64 || PLATFORM_AnyCPU
                Instance = NativeMethods.ARM64.PixelCollection_Create(MagickImage.GetInstance(image), out exception);
                #endif
                #if PLATFORM_AnyCPU
                else if (OperatingSystem.Is64Bit)
                #endif
                #if PLATFORM_x64 || PLATFORM_AnyCPU
                Instance = NativeMethods.X64.PixelCollection_Create(MagickImage.GetInstance(image), out exception);
                #endif
                #if PLATFORM_AnyCPU
                else
                #endif
                #if PLATFORM_x86 || PLATFORM_AnyCPU
                Instance = NativeMethods.X86.PixelCollection_Create(MagickImage.GetInstance(image), out exception);
                #endif
                CheckException(exception, Instance);
                if (Instance == IntPtr.Zero)
                {
                    throw new InvalidOperationException();
                }
            }
Пример #3
0
            public IntPtr Smush(IMagickImage?image, int offset, bool stack)
            {
                IntPtr exception = IntPtr.Zero;
                IntPtr result;

                #if PLATFORM_AnyCPU
                if (OperatingSystem.Is64Bit)
                #endif
                #if PLATFORM_x64 || PLATFORM_AnyCPU
                result = NativeMethods.X64.MagickImageCollection_Smush(image.GetInstance(), (IntPtr)offset, stack, out exception);
                #endif
                #if PLATFORM_AnyCPU
                else
                #endif
                #if PLATFORM_x86 || PLATFORM_AnyCPU
                result = NativeMethods.X86.MagickImageCollection_Smush(image.GetInstance(), (IntPtr)offset, stack, 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);
            }
Пример #4
0
 public IntPtr Montage(IMagickImage?image, IMontageSettings <QuantumType>?settings)
 {
     using (var settingsNative = MontageSettings.CreateInstance(settings))
     {
         IntPtr exception = IntPtr.Zero;
         IntPtr result;
         #if PLATFORM_AnyCPU
         if (OperatingSystem.Is64Bit)
         #endif
         #if PLATFORM_x64 || PLATFORM_AnyCPU
         result = NativeMethods.X64.MagickImageCollection_Montage(image.GetInstance(), settingsNative.Instance, out exception);
         #endif
         #if PLATFORM_AnyCPU
         else
         #endif
         #if PLATFORM_x86 || PLATFORM_AnyCPU
         result = NativeMethods.X86.MagickImageCollection_Montage(image.GetInstance(), 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);
     }
 }
Пример #5
0
 internal static void SetNext(this IMagickImage self, IMagickImage?next)
 {
     if (self is MagickImage image)
     {
         image.SetNext(next);
     }
     else
     {
         throw new NotSupportedException();
     }
 }
Пример #6
0
        internal static IMagickErrorInfo?CreateErrorInfo(this IMagickImage?self)
        {
            if (self == null)
            {
                return(null);
            }

            if (self is MagickImage image)
            {
                return(MagickImage.CreateErrorInfo(image));
            }

            throw new NotSupportedException();
        }
Пример #7
0
        internal static IntPtr GetInstance(this IMagickImage?self)
        {
            if (self == null)
            {
                return(IntPtr.Zero);
            }

            if (self is INativeInstance nativeInstance)
            {
                return(nativeInstance.Instance);
            }

            throw new NotSupportedException();
        }
Пример #8
0
 public static IntPtr GetInstance(IMagickImage?image, IntPtr list, PixelChannel channel)
 {
     #if PLATFORM_AnyCPU
     if (OperatingSystem.Is64Bit)
     #endif
     #if PLATFORM_x64 || PLATFORM_AnyCPU
     return(NativeMethods.X64.PerceptualHash_GetInstance(image.GetInstance(), list, (UIntPtr)channel));
     #endif
     #if PLATFORM_AnyCPU
     else
     #endif
     #if PLATFORM_x86 || PLATFORM_AnyCPU
     return(NativeMethods.X86.PerceptualHash_GetInstance(image.GetInstance(), list, (UIntPtr)channel));
     #endif
 }
Пример #9
0
            public void OptimizeTransparency(IMagickImage?image)
            {
                IntPtr exception = IntPtr.Zero;

                #if PLATFORM_AnyCPU
                if (OperatingSystem.Is64Bit)
                #endif
                #if PLATFORM_x64 || PLATFORM_AnyCPU
                NativeMethods.X64.MagickImageCollection_OptimizeTransparency(image.GetInstance(), out exception);
                #endif
                #if PLATFORM_AnyCPU
                else
                #endif
                #if PLATFORM_x86 || PLATFORM_AnyCPU
                NativeMethods.X86.MagickImageCollection_OptimizeTransparency(image.GetInstance(), out exception);
                #endif
                CheckException(exception);
            }
Пример #10
0
 public void WriteStream(IMagickImage?image, IMagickSettings <QuantumType>?settings, ReadWriteStreamDelegate?writer, SeekStreamDelegate?seeker, TellStreamDelegate?teller, ReadWriteStreamDelegate?reader)
 {
     using (var 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);
     }
 }
Пример #11
0
 public void WriteFile(IMagickImage?image, IMagickSettings <QuantumType>?settings)
 {
     using (var 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);
     }
 }
Пример #12
0
 public void Map(IMagickImage?image, IQuantizeSettings?settings, IMagickImage?remapImage)
 {
     using (var settingsNative = QuantizeSettings.CreateInstance(settings))
     {
         IntPtr exception = IntPtr.Zero;
         #if PLATFORM_AnyCPU
         if (OperatingSystem.Is64Bit)
         #endif
         #if PLATFORM_x64 || PLATFORM_AnyCPU
         NativeMethods.X64.MagickImageCollection_Map(image.GetInstance(), settingsNative.Instance, remapImage.GetInstance(), out exception);
         #endif
         #if PLATFORM_AnyCPU
         else
         #endif
         #if PLATFORM_x86 || PLATFORM_AnyCPU
         NativeMethods.X86.MagickImageCollection_Map(image.GetInstance(), settingsNative.Instance, remapImage.GetInstance(), out exception);
         #endif
         CheckException(exception);
     }
 }
Пример #13
0
            public static IntPtr GetInstance(IMagickImage?image, IntPtr list, PixelChannel channel)
            {
                IntPtr result;

                #if PLATFORM_AnyCPU
                if (OperatingSystem.IsArm64)
                #endif
                #if PLATFORM_arm64 || PLATFORM_AnyCPU
                result = NativeMethods.ARM64.PerceptualHash_GetInstance(MagickImage.GetInstance(image), list, (UIntPtr)channel);
                #endif
                #if PLATFORM_AnyCPU
                else if (OperatingSystem.Is64Bit)
                #endif
                #if PLATFORM_x64 || PLATFORM_AnyCPU
                result = NativeMethods.X64.PerceptualHash_GetInstance(MagickImage.GetInstance(image), list, (UIntPtr)channel);
                #endif
                #if PLATFORM_AnyCPU
                else
                #endif
                #if PLATFORM_x86 || PLATFORM_AnyCPU
                result = NativeMethods.X86.PerceptualHash_GetInstance(MagickImage.GetInstance(image), list, (UIntPtr)channel);
                #endif
                return(result);
            }