Crops an image to the given directions.
Наследование: IGraphicsProcessor
        public void TestCropRegex()
        {
            const string Querystring = "crop=0,0,150,300";
            CropLayer expected = new CropLayer(0, 0, 150, 300, CropMode.Pixels);

            Crop crop = new Crop();
            crop.MatchRegexIndex(Querystring);

            CropLayer actual = crop.DynamicParameter;
            Assert.AreEqual(expected, actual);
        }
        public void TestCropRegex()
        {
            const string Querystring = "crop=0-0-150-300";
            Rectangle expected = new Rectangle(0, 0, 150, 300);

            Crop crop = new Crop();
            crop.MatchRegexIndex(Querystring);

            Rectangle actual = crop.DynamicParameter;

            Assert.AreEqual(expected, actual);
        }
Пример #3
0
        /// <summary>
        /// Crops the current image to the given location and size.
        /// </summary>
        /// <param name="cropLayer">
        /// The <see cref="Imaging.CropLayer"/> containing the coordinates and mode to crop the image with.
        /// </param>
        /// <returns>
        /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class.
        /// </returns>
        public ImageFactory Crop(CropLayer cropLayer)
        {
            if (this.ShouldProcess)
            {
                Crop crop = new Crop { DynamicParameter = cropLayer };
                this.CurrentImageFormat.ApplyProcessor(crop.ProcessImage, this);
            }

            return this;
        }
Пример #4
0
        /// <summary>
        /// Crops the current image to the given location and size.
        /// </summary>
        /// <param name="rectangle">
        /// The <see cref="T:System.Drawing.Rectangle"/> containing the coordinates to crop the image to.
        /// </param>
        /// <returns>
        /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class.
        /// </returns>
        public ImageFactory Crop(Rectangle rectangle)
        {
            if (this.ShouldProcess)
            {
                Crop crop = new Crop { DynamicParameter = rectangle };

                this.Image = crop.ProcessImage(this);
            }

            return this;
        }
Пример #5
0
        /// <summary>
        /// Crops the current image to the given location and size.
        /// </summary>
        /// <param name="cropLayer">
        /// The <see cref="T:CropLayer"/> containing the coordinates and mode to crop the image with.
        /// </param>
        /// <returns>
        /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class.
        /// </returns>
        public ImageFactory Crop(CropLayer cropLayer)
        {
            if (this.ShouldProcess)
            {
                Crop crop = new Crop { DynamicParameter = cropLayer };

                this.Image = crop.ProcessImage(this);
            }

            return this;
        }
Пример #6
0
        /// <summary>
        /// Crops the current image to the given location and size.
        /// </summary>
        /// <param name="rectangle">
        /// The <see cref="T:System.Drawing.Rectangle"/> containing the coordinates to crop the image to.
        /// </param>
        /// <returns>
        /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class.
        /// </returns>
        public ImageFactory Crop(Rectangle rectangle)
        {
            if (this.ShouldProcess)
            {
                CropLayer cropLayer = new CropLayer(rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Bottom, CropMode.Pixels);

                Crop crop = new Crop { DynamicParameter = cropLayer };

                this.Image = crop.ProcessImage(this);
            }

            return this;
        }