IsError() public static method

public static IsError ( MagickException exception ) : bool
exception MagickException
return bool
Beispiel #1
0
            public IntPtr Smush(IMagickImage image, int offset, bool stack)
            {
                IntPtr exception = IntPtr.Zero;
                IntPtr result;

                #if PLATFORM_AnyCPU
                if (NativeLibrary.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
                MagickException magickException = MagickExceptionHelper.Create(exception);
                if (MagickExceptionHelper.IsError(magickException))
                {
                    if (result != IntPtr.Zero)
                    {
                        Dispose(result);
                    }
                    throw magickException;
                }
                RaiseWarning(magickException);
                return(result);
            }
Beispiel #2
0
 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);
     }
 }
Beispiel #3
0
            public IntPtr Polynomial(IMagickImage image, double[] terms, int length)
            {
                IntPtr exception = IntPtr.Zero;
                IntPtr result;

                #if PLATFORM_AnyCPU
                if (NativeLibrary.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
                MagickException magickException = MagickExceptionHelper.Create(exception);
                if (MagickExceptionHelper.IsError(magickException))
                {
                    if (result != IntPtr.Zero)
                    {
                        Dispose(result);
                    }
                    throw magickException;
                }
                RaiseWarning(magickException);
                return(result);
            }
Beispiel #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
         MagickException magickException = MagickExceptionHelper.Create(exception);
         if (MagickExceptionHelper.IsError(magickException))
         {
             if (result != IntPtr.Zero)
             {
                 Dispose(result);
             }
             throw magickException;
         }
         RaiseWarning(magickException);
         return(result);
     }
 }
Beispiel #5
0
            public static IntPtr GetFontFamilies(out UIntPtr length)
            {
                IntPtr exception = IntPtr.Zero;
                IntPtr result;

                #if PLATFORM_AnyCPU
                if (NativeLibrary.Is64Bit)
                #endif
                #if PLATFORM_x64 || PLATFORM_AnyCPU
                result = NativeMethods.X64.MagickNET_GetFontFamilies(out length, out exception);
                #endif
                #if PLATFORM_AnyCPU
                else
                #endif
                #if PLATFORM_x86 || PLATFORM_AnyCPU
                result = NativeMethods.X86.MagickNET_GetFontFamilies(out length, out exception);
                #endif
                MagickException magickException = MagickExceptionHelper.Create(exception);
                if (MagickExceptionHelper.IsError(magickException))
                {
                    if (result != IntPtr.Zero)
                    {
                        DisposeFontFamilies(result);
                    }
                    throw magickException;
                }
                return(result);
            }
Beispiel #6
0
            public IntPtr Evaluate(IMagickImage image, EvaluateOperator evaluateOperator)
            {
                IntPtr exception = IntPtr.Zero;
                IntPtr result;

                #if PLATFORM_AnyCPU
                if (NativeLibrary.Is64Bit)
                #endif
                #if PLATFORM_x64 || PLATFORM_AnyCPU
                result = NativeMethods.X64.MagickImageCollection_Evaluate(image.GetInstance(), (UIntPtr)evaluateOperator, out exception);
                #endif
                #if PLATFORM_AnyCPU
                else
                #endif
                #if PLATFORM_x86 || PLATFORM_AnyCPU
                result = NativeMethods.X86.MagickImageCollection_Evaluate(image.GetInstance(), (UIntPtr)evaluateOperator, out exception);
                #endif
                MagickException magickException = MagickExceptionHelper.Create(exception);
                if (MagickExceptionHelper.IsError(magickException))
                {
                    if (result != IntPtr.Zero)
                    {
                        Dispose(result);
                    }
                    throw magickException;
                }
                RaiseWarning(magickException);
                return(result);
            }
Beispiel #7
0
            public IntPtr CreateList(out UIntPtr length)
            {
                IntPtr exception = IntPtr.Zero;
                IntPtr result;

                if (NativeLibrary.Is64Bit)
                {
                    result = NativeMethods.X64.MagickFormatInfo_CreateList(out length, out exception);
                }
                else
                {
                    result = NativeMethods.X86.MagickFormatInfo_CreateList(out length, out exception);
                }
                MagickException magickException = MagickExceptionHelper.Create(exception);

                if (MagickExceptionHelper.IsError(magickException))
                {
                    if (result != IntPtr.Zero)
                    {
                        DisposeList(result, (int)length);
                    }
                    throw magickException;
                }
                RaiseWarning(magickException);
                return(result);
            }
Beispiel #8
0
            public IntPtr OptimizePlus(MagickImage image)
            {
                IntPtr exception = IntPtr.Zero;
                IntPtr result;

        #if ANYCPU
                if (NativeLibrary.Is64Bit)
        #endif
        #if WIN64 || ANYCPU
                result = NativeMethods.X64.MagickImageCollection_OptimizePlus(MagickImage.GetInstance(image), out exception);
        #endif
        #if ANYCPU
                else
        #endif
        #if !WIN64 || ANYCPU
                result = NativeMethods.X86.MagickImageCollection_OptimizePlus(MagickImage.GetInstance(image), out exception);
        #endif
                MagickException magickException = MagickExceptionHelper.Create(exception);
                if (MagickExceptionHelper.IsError(magickException))
                {
                    if (result != IntPtr.Zero)
                    {
                        Dispose(result);
                    }
                    throw magickException;
                }
                RaiseWarning(magickException);
                return(result);
            }
            public IntPtr Smush(MagickImage image, int offset, bool stack)
            {
                IntPtr exception = IntPtr.Zero;
                IntPtr result;

                if (NativeLibrary.Is64Bit)
                {
                    result = NativeMethods.X64.MagickImageCollection_Smush(MagickImage.GetInstance(image), (IntPtr)offset, stack, out exception);
                }
                else
                {
                    result = NativeMethods.X86.MagickImageCollection_Smush(MagickImage.GetInstance(image), (IntPtr)offset, stack, out exception);
                }
                MagickException magickException = MagickExceptionHelper.Create(exception);

                if (MagickExceptionHelper.IsError(magickException))
                {
                    if (result != IntPtr.Zero)
                    {
                        Dispose(result);
                    }
                    throw magickException;
                }
                RaiseWarning(magickException);
                return(result);
            }
 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);
     }
 }
 public IntPtr ReadBlob(MagickSettings settings, byte[] data, int length)
 {
     using (INativeInstance settingsNative = MagickSettings.CreateInstance(settings))
     {
         IntPtr exception = IntPtr.Zero;
         IntPtr result;
         if (NativeLibrary.Is64Bit)
         {
             result = NativeMethods.X64.MagickImageCollection_ReadBlob(settingsNative.Instance, data, (UIntPtr)length, out exception);
         }
         else
         {
             result = NativeMethods.X86.MagickImageCollection_ReadBlob(settingsNative.Instance, data, (UIntPtr)length, out exception);
         }
         MagickException magickException = MagickExceptionHelper.Create(exception);
         if (MagickExceptionHelper.IsError(magickException))
         {
             if (result != IntPtr.Zero)
             {
                 Dispose(result);
             }
             throw magickException;
         }
         RaiseWarning(magickException);
         return(result);
     }
 }
 public IntPtr Montage(MagickImage image, MontageSettings settings)
 {
     using (INativeInstance settingsNative = MontageSettings.CreateInstance(settings))
     {
         IntPtr exception = IntPtr.Zero;
         IntPtr result;
         if (NativeLibrary.Is64Bit)
         {
             result = NativeMethods.X64.MagickImageCollection_Montage(MagickImage.GetInstance(image), settingsNative.Instance, out exception);
         }
         else
         {
             result = NativeMethods.X86.MagickImageCollection_Montage(MagickImage.GetInstance(image), 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);
     }
 }
Beispiel #13
0
            public IntPtr CreateList(out UIntPtr length)
            {
                IntPtr exception = IntPtr.Zero;
                IntPtr result;

                #if PLATFORM_AnyCPU
                if (NativeLibrary.Is64Bit)
                #endif
                #if PLATFORM_x64 || PLATFORM_AnyCPU
                result = NativeMethods.X64.MagickFormatInfo_CreateList(out length, out exception);
                #endif
                #if PLATFORM_AnyCPU
                else
                #endif
                #if PLATFORM_x86 || PLATFORM_AnyCPU
                result = NativeMethods.X86.MagickFormatInfo_CreateList(out length, out exception);
                #endif
                MagickException magickException = MagickExceptionHelper.Create(exception);
                if (MagickExceptionHelper.IsError(magickException))
                {
                    if (result != IntPtr.Zero)
                    {
                        DisposeList(result, (int)length);
                    }
                    throw magickException;
                }
                RaiseWarning(magickException);
                return(result);
            }
Beispiel #14
0
            public IntPtr Combine(MagickImage image, Channels channels)
            {
                IntPtr exception = IntPtr.Zero;
                IntPtr result;

                if (NativeLibrary.Is64Bit)
                {
                    result = NativeMethods.X64.MagickImageCollection_Combine(MagickImage.GetInstance(image), (UIntPtr)channels, out exception);
                }
                else
                {
                    result = NativeMethods.X86.MagickImageCollection_Combine(MagickImage.GetInstance(image), (UIntPtr)channels, out exception);
                }
                MagickException magickException = MagickExceptionHelper.Create(exception);

                if (MagickExceptionHelper.IsError(magickException))
                {
                    if (result != IntPtr.Zero)
                    {
                        Dispose(result);
                    }
                    throw magickException;
                }
                RaiseWarning(magickException);
                return(result);
            }
Beispiel #15
0
 public IntPtr ToShortArray(int x, int y, int width, int height, string mapping)
 {
     using (INativeInstance mappingNative = UTF8Marshaler.CreateInstance(mapping))
     {
         IntPtr exception = IntPtr.Zero;
         IntPtr result;
         #if PLATFORM_AnyCPU
         if (NativeLibrary.Is64Bit)
         #endif
         #if PLATFORM_x64 || PLATFORM_AnyCPU
         result = NativeMethods.X64.PixelCollection_ToShortArray(Instance, (UIntPtr)x, (UIntPtr)y, (UIntPtr)width, (UIntPtr)height, mappingNative.Instance, out exception);
         #endif
         #if PLATFORM_AnyCPU
         else
         #endif
         #if PLATFORM_x86 || PLATFORM_AnyCPU
         result = NativeMethods.X86.PixelCollection_ToShortArray(Instance, (UIntPtr)x, (UIntPtr)y, (UIntPtr)width, (UIntPtr)height, mappingNative.Instance, out exception);
         #endif
         MagickException magickException = MagickExceptionHelper.Create(exception);
         if (MagickExceptionHelper.IsError(magickException))
         {
             if (result != IntPtr.Zero)
             {
                 MagickMemory.Relinquish(result);
             }
             throw magickException;
         }
         RaiseWarning(magickException);
         return(result);
     }
 }
            public IntPtr ReadFile(MagickSettings settings)
            {
                IntPtr exception = IntPtr.Zero;
                IntPtr result;

                if (NativeLibrary.Is64Bit)
                {
                    result = NativeMethods.X64.MagickImageCollection_ReadFile(MagickSettings.GetInstance(settings), out exception);
                }
                else
                {
                    result = NativeMethods.X86.MagickImageCollection_ReadFile(MagickSettings.GetInstance(settings), out exception);
                }
                MagickException magickException = MagickExceptionHelper.Create(exception);

                if (MagickExceptionHelper.IsError(magickException))
                {
                    if (result != IntPtr.Zero)
                    {
                        Dispose(result);
                    }
                    throw magickException;
                }
                RaiseWarning(magickException);
                return(result);
            }
        protected void CheckException(IntPtr exception, IntPtr result)
        {
            MagickException magickException = MagickExceptionHelper.Create(exception);

            if (MagickExceptionHelper.IsError(magickException))
            {
                if (result != IntPtr.Zero)
                {
                    Dispose(result);
                }
                throw magickException;
            }

            RaiseWarning(magickException);
        }