Example #1
0
 /// <summary> Dispose environment. </summary>
 protected void DisposeEnvironment()
 {
     if (IsInitialized)
     {
         WandInterop.MagickWandTerminus();
         _IsInitialized = false;
     }
 }
Example #2
0
 /// <summary> Initializes the environment. </summary>
 protected void InitializeEnvironment()
 {
     if (!_IsInitialized)
     {
         WandInterop.MagickWandGenesis();
         _IsInitialized = WandInterop.IsMagickWandInstantiated();
         if (!_IsInitialized)
         {
             throw new Exception("Cannot Instantiate Wand");
         }
     }
 }
Example #3
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)));
        }
Example #4
0
        /// <summary> Gets the handle. </summary>
        /// <returns> The handle. </returns>
        internal static IntPtr GetHandle()
        {
            IntPtr version;

            return(WandInterop.MagickGetVersion(out version));
        }