Exemple #1
0
        /// <summary> Decode exception. </summary>
        /// <param name="wand"> Handle of the wand. </param>
        /// <returns> A string. </returns>
        private static string DecodeException(IWandCore wand)
        {
            int exceptionSeverity;

            IntPtr exceptionPtr = wand.GetException(out exceptionSeverity);

            wand.ClearException();
            return(WandNativeString.Load(exceptionPtr));
        }
Exemple #2
0
        /// <summary> Query if 'wand' is magick wand. </summary>
        /// <param name="wand"> The wand. </param>
        /// <returns> true if magick wand, false if not. </returns>

        /*private static bool IsMagickWand(IntPtr wand)
         * {
         *  return WandInterop.IsMagickWand(wand);
         * }*/

        /// <summary> Command genesis. </summary>
        /// <param name="image_info"> Information describing the image. </param>
        /// <param name="command"> The command. </param>
        /// <param name="argc"> The argc. </param>
        /// <param name="argv"> The argv. </param>
        /// <param name="metadata"> The metadata. </param>
        /// <param name="exception"> The exception. </param>
        /// <returns> true if it succeeds, false if it fails. </returns>

        /*private static bool CommandGenesis(IntPtr image_info, MagickCommandType command, int argc, string[] argv, byte[] metadata, IntPtr exception)
         * {
         * return WandInterop.MagickCommandGenesis(image_info, command, argc, argv, metadata, ref exception);
         *      //return WandInterop.MagickCommandGenesis(image_info, command, argc, argv);
         * }*/

        /// <summary> Queries the formats. </summary>
        /// <param name="pattern"> Specifies the pattern. </param>
        /// <returns> An array of string. </returns>
        internal static List <string> QueryFormats(string pattern)
        {
            EnsureInitialized();
            IntPtr number_formats = IntPtr.Zero;
            IntPtr format         = WandInterop.MagickQueryFormats("*", ref number_formats);

            IntPtr[] rowArray = new IntPtr[(int)number_formats];
            Marshal.Copy(format, rowArray, 0, (int)number_formats);
            List <string> val = rowArray.Select(x => WandNativeString.Load(x)).ToList();

            if (pattern == "*")
            {
                return(val);
            }
            return(val.FindAll(x => x.Equals(pattern, StringComparison.OrdinalIgnoreCase)));
        }