Exemplo n.º 1
0
        /// <summary> Adds the images to 'wands'. </summary>
        /// <param name="prepent"> true to prepent. </param>
        /// <param name="wands"> A variable-length parameters list containing wands. </param>
        /// <returns> true if it succeeds, false if it fails. </returns>

        /*private bool AddImages(bool prepent, params MagickWand[] wands)
         * {
         *  if (prepent)
         *      this.SetFirstIterator();
         *  else
         *      this.SetLastIterator();
         *
         *  bool result = true;
         *  foreach (MagickWand wand in wands)
         *  {
         *      result = result & this.CheckError(MagickWandInterop.MagickAddImage(this, wand));
         *  }
         *
         *  this.ReloadImageList();
         *  return result;
         * }*/

        /// <summary> Creates a new image. </summary>
        /// <param name="width"> The width. </param>
        /// <param name="height"> The height. </param>
        /// <param name="backgroundColor"> The background color. </param>
        internal void NewImage(int width, int height, string backgroundColor)
        {
            using (var pixelWand = new PixelWand(backgroundColor))
            {
                this.NewImage(width, height, pixelWand);
            }
        }
Exemplo n.º 2
0
 /// <summary> Initializes a new instance of the ImageMagickSharp.DrawingWand class. </summary>
 /// <exception cref="Exception"> Thrown when an exception error condition occurs. </exception>
 /// <param name="fillColor"> The fill color. </param>
 internal DrawingWand(PixelWand fillColor)
 {
     this.Handle = DrawingWandInterop.NewDrawingWand();
     if (this.Handle == IntPtr.Zero)
     {
         throw new Exception("Error acquiring wand.");
     }
     this.FillColor = fillColor;
 }
Exemplo n.º 3
0
        /// <summary> Initializes a new instance of the ImageMagickSharp.MagickWand class. </summary>
        /// <exception cref="Exception"> Thrown when an exception error condition occurs. </exception>
        /// <param name="width"> The width. </param>
        /// <param name="height"> The height. </param>
        /// <param name="pixelWand"> The pixel wand. </param>
        public MagickWand(int width, int height, PixelWand pixelWand)
        {
            Wand.EnsureInitialized();
            this.Handle = MagickWandInterop.NewMagickWand();
            if (this.Handle == IntPtr.Zero)
            {
                throw new Exception("Error acquiring wand.");
            }

            this.NewImage(width, height, pixelWand);
        }
Exemplo n.º 4
0
        /// <summary> Gaussian blur image. </summary>
        /// <param name="radius"> The radius. </param>
        /// <param name="sigma"> The sigma. </param>

        /*private void GaussianBlurImage(double radius, double sigma)
         * {
         *      bool checkErrorBool = false;
         *      checkErrorBool = this.MagickWand.CheckErrorBool(ImageWandInterop.MagickGaussianBlurImage(this.MagickWand, radius, sigma));
         *
         * }
         *
         * /// <summary> Adaptive blur image. </summary>
         * /// <param name="radius"> The radius. </param>
         * /// <param name="sigma"> The sigma. </param>
         * private void AdaptiveBlurImage(double radius, double sigma)
         * {
         *      bool checkErrorBool = false;
         *      checkErrorBool = this.MagickWand.CheckErrorBool(ImageWandInterop.MagickAdaptiveBlurImage(this.MagickWand, radius, sigma));
         *
         * }
         *
         * /// <summary> Threshold image. </summary>
         * /// <param name="threshold"> The threshold. </param>
         * private void ThresholdImage(double threshold)
         * {
         *      bool checkErrorBool = false;
         *      checkErrorBool = this.MagickWand.CheckErrorBool(ImageWandInterop.MagickThresholdImage(this.MagickWand, threshold));
         *
         * }
         *
         * /// <summary> Adaptive threshold image. </summary>
         * /// <param name="width"> The width. </param>
         * /// <param name="height"> The height. </param>
         * /// <param name="bias"> The bias. </param>
         * private void AdaptiveThresholdImage(int width, int height, double bias)
         * {
         *      bool checkErrorBool = false;
         *      checkErrorBool = this.MagickWand.CheckErrorBool(ImageWandInterop.MagickAdaptiveThresholdImage(this.MagickWand, width,height, bias));
         *
         * }
         *
         * /// <summary> Brightness contrast image. </summary>
         * /// <param name="brightness"> The brightness. </param>
         * /// <param name="contrast"> The contrast. </param>
         * private void BrightnessContrastImage(double brightness, double contrast)
         * {
         *      bool checkErrorBool = false;
         *      checkErrorBool = this.MagickWand.CheckErrorBool(ImageWandInterop.MagickBrightnessContrastImage(this.MagickWand, brightness, contrast));
         *
         * }*/

        /// <summary> Colorize image. </summary>
        /// <param name="colorize"> The colorize. </param>
        /// <param name="blend"> The blend. </param>
        public void ColorizeImage(PixelWand colorize, PixelWand blend)
        {
            bool checkErrorBool = false;

            checkErrorBool = this.MagickWand.CheckErrorBool(ImageWandInterop.MagickColorizeImage(this.MagickWand, colorize, blend));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Shade image. shines a distant light on an image to create a three-dimensional effect. You
        /// control the positioning of the light with azimuth and elevation; azimuth is measured in
        /// degrees off the x axis and elevation is measured in pixels above the Z axis. </summary>
        /// <param name="gray"> true to gray. </param>
        /// <param name="azimuth"> The azimuth. </param>
        /// <param name="elevation"> The elevation. </param>
        /// <returns> true if it succeeds, false if it fails. </returns>

        /*private bool ShadeImage(bool gray, double azimuth, double elevation)
         * {
         *      return this.ActivateImageWand(() => this.MagickWand.CheckErrorBool(ImageWandInterop.MagickShadeImage(this.MagickWand, gray, azimuth, elevation)));
         * }*/

        /// <summary> Shear image. </summary>
        /// <param name="background"> The background. </param>
        /// <param name="x_shear"> The shear. </param>
        /// <param name="y_shear"> The shear. </param>
        /// <returns> true if it succeeds, false if it fails. </returns>
        internal bool ShearImage(PixelWand background, double x_shear, double y_shear)
        {
            return(this.ActivateImageWand(() => this.MagickWand.CheckErrorBool(ImageWandInterop.MagickShearImage(this.MagickWand, background, x_shear, y_shear))));
        }
Exemplo n.º 6
0
        /// <summary> Label image. </summary>
        /// <param name="label"> The label. </param>
        /// <returns> true if it succeeds, false if it fails. </returns>

        /*private bool LabelImage(string label)
         * {
         *      return this.ActivateImageWand(() => this.MagickWand.CheckErrorBool(ImageWandInterop.MagickLabelImage(this.MagickWand, label)));
         * }
         *
         * /// <summary> Raises the image event. </summary>
         * /// <param name="width"> The width. </param>
         * /// <param name="height"> The height. </param>
         * /// <param name="x"> The x coordinate. </param>
         * /// <param name="y"> The y coordinate. </param>
         * /// <param name="raise"> true to raise. </param>
         * /// <returns> true if it succeeds, false if it fails. </returns>
         * private bool RaiseImage(int width, int height, int x, int y, bool raise)
         * {
         *      return this.ActivateImageWand(() => this.MagickWand.CheckErrorBool(ImageWandInterop.MagickRaiseImage(this.MagickWand, width, height, x, y, raise)));
         * }*/

        /// <summary> Border image. </summary>
        /// <param name="bordercolor"> The bordercolor. </param>
        /// <param name="width"> The width. </param>
        /// <param name="height"> The height. </param>
        /// <returns> true if it succeeds, false if it fails. </returns>
        internal bool BorderImage(PixelWand bordercolor, int width, int height)
        {
            return(this.ActivateImageWand(() => this.MagickWand.CheckErrorBool(ImageWandInterop.MagickBorderImage(this.MagickWand, bordercolor, width, height))));
        }
Exemplo n.º 7
0
 /// <summary> Rotate image. </summary>
 /// <param name="background"> The background. </param>
 /// <param name="degrees"> The degrees. </param>
 public void RotateImage(PixelWand background, double degrees)
 {
     this.ActivateImageWand(() => this.MagickWand.CheckError(ImageWandInterop.MagickRotateImage(this.MagickWand, background, degrees)));
 }
Exemplo n.º 8
0
        /// <summary>
        /// ClearMagickWand() clears resources associated with the wand, leaving the wand blank, and
        /// ready to be used for a new set of images. </summary>

        /*private void ClearMagickWand()
         * {
         *      MagickWandInterop.ClearMagickWand(this);
         *      this._ImageList.Clear();
         * }*/

        #endregion

        #region [Magick Wand Methods - Image]

        /// <summary> Creates a new image. </summary>
        /// <param name="width"> The width. </param>
        /// <param name="height"> The height. </param>
        /// <param name="pixelWand"> The pixel wand. </param>
        private void NewImage(int width, int height, PixelWand pixelWand)
        {
            this.CheckError(MagickWandInterop.MagickNewImage(this, width, height, pixelWand));
            this._ImageList.Add(new ImageWand(this, this.IteratorIndex));
        }