Encapsulates methods to add rounded corners to an image.
Inheritance: IGraphicsProcessor
Esempio n. 1
0
        /// <summary>
        /// Adds rounded corners to the current image.
        /// </summary>
        /// <param name="roundedCornerLayer">
        /// The <see cref="T:ImageProcessor.Imaging.RoundedCornerLayer"/> containing the properties to round corners on the image.
        /// </param>
        /// <returns>
        /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class.
        /// </returns>
        public ImageFactory RoundedCorners(RoundedCornerLayer roundedCornerLayer)
        {
            if (this.ShouldProcess)
            {
                if (roundedCornerLayer.Radius < 0)
                {
                    roundedCornerLayer.Radius = 0;
                }

                RoundedCorners roundedCorners = new RoundedCorners { DynamicParameter = roundedCornerLayer };
                this.CurrentImageFormat.ApplyProcessor(roundedCorners.ProcessImage, this);
            }

            return this;
        }
Esempio n. 2
0
        /// <summary>
        /// Adds rounded corners to the current image.
        /// </summary>
        /// <param name="roundedCornerLayer">
        /// The <see cref="T:ImageProcessor.Imaging.RoundedCornerLayer"/> containing the properties to round corners on the image.
        /// </param>
        /// <returns>
        /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class.
        /// </returns>
        public ImageFactory RoundedCorners(RoundedCornerLayer roundedCornerLayer)
        {
            if (this.ShouldProcess)
            {
                if (roundedCornerLayer.Radius < 0)
                {
                    roundedCornerLayer.Radius = 0;
                }

                RoundedCorners roundedCorners = new RoundedCorners { DynamicParameter = roundedCornerLayer };

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

            return this;
        }
        public void TestRoundedCornersRegex()
        {
            const string Querystring = "roundedcorners=30";
            RoundedCornerLayer expected = new RoundedCornerLayer(30, true, true, true, true);

            RoundedCorners roundedCorners = new RoundedCorners();
            roundedCorners.MatchRegexIndex(Querystring);

            RoundedCornerLayer actual = roundedCorners.DynamicParameter;

            Assert.AreEqual(expected, actual);
        }
        /// <summary>
        /// Adds rounded corners to the current image.
        /// </summary>
        /// <param name="radius">
        /// The radius at which the corner will be rounded.
        /// </param>
        /// <returns>
        /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class.
        /// </returns>
        public ImageFactory RoundedCorners(int radius)
        {
            if (this.ShouldProcess)
            {
                if (radius < 0)
                {
                    radius = 0;
                }

                RoundedCornerLayer roundedCornerLayer = new RoundedCornerLayer(radius);

                RoundedCorners roundedCorners = new RoundedCorners { DynamicParameter = roundedCornerLayer };
                this.backupFormat.ApplyProcessor(roundedCorners.ProcessImage, this);
            }

            return this;
        }