/// <summary> A MagickWand extension method that draw round rectangle. </summary>
 /// <param name="wand"> The wand to act on. </param>
 /// <param name="x1"> The first x value. </param>
 /// <param name="y1"> The first y value. </param>
 /// <param name="x2"> The second x value. </param>
 /// <param name="y2"> The second y value. </param>
 /// <param name="rx"> The receive. </param>
 /// <param name="ry"> The ry. </param>
 /// <param name="strokeColor"> The stroke color. </param>
 /// <param name="fillcolor"> The fillcolor. </param>
 internal static void DrawRoundRectangle(this ImageWand wand, double x1, double y1, double x2, double y2, double rx, double ry, PixelWand strokeColor, PixelWand fillcolor)
 {
     using (var draw = new DrawingWand())
     {
         draw.StrokeColor = strokeColor;
         draw.FillColor   = fillcolor;
         draw.DrawRoundRectangle(x1, y1, x2, y2, rx, ry);
         wand.DrawImage(draw);
     }
 }
        /// <summary> Round corners. </summary>
        /// <param name="wand"> The wand to act on. </param>
        /// <param name="cofactor"> The cofactor. </param>
        /// <returns> A MagickWand. </returns>
        public static MagickWand RoundCorners(this MagickWand wand, Double cofactor)
        {
            var currentWidth = wand.CurrentImage.Width;
            var currentHeight = wand.CurrentImage.Height;

            var newWand = new MagickWand(currentWidth, currentHeight, new PixelWand(ColorName.None, 1));

            using (var whitePixelWand = new PixelWand(ColorName.White))
            using (var draw = new DrawingWand(whitePixelWand))
            {
                draw.DrawRoundRectangle(0, 0, currentWidth, currentHeight, cofactor, cofactor);
                newWand.CurrentImage.DrawImage(draw);
                newWand.CurrentImage.CompositeImage(wand, CompositeOperator.SrcInCompositeOp, 0, 0);
                return newWand;
            }
        }
        /// <summary> Round corners. </summary>
        /// <param name="wand"> The wand to act on. </param>
        /// <param name="cofactor"> The cofactor. </param>
        /// <returns> A MagickWand. </returns>
        public static MagickWand RoundCorners(this MagickWand wand, Double cofactor)
        {
            var currentWidth  = wand.CurrentImage.Width;
            var currentHeight = wand.CurrentImage.Height;

            var newWand = new MagickWand(currentWidth, currentHeight, new PixelWand(ColorName.None, 1));

            using (var whitePixelWand = new PixelWand(ColorName.White))
                using (var draw = new DrawingWand(whitePixelWand))
                {
                    draw.DrawRoundRectangle(0, 0, currentWidth, currentHeight, cofactor, cofactor);
                    newWand.CurrentImage.DrawImage(draw);
                    newWand.CurrentImage.CompositeImage(wand, CompositeOperator.SrcInCompositeOp, 0, 0);
                    return(newWand);
                }
        }
 /// <summary> A MagickWand extension method that draw round rectangle. </summary>
 /// <param name="wand"> The wand to act on. </param>
 /// <param name="x1"> The first x value. </param>
 /// <param name="y1"> The first y value. </param>
 /// <param name="x2"> The second x value. </param>
 /// <param name="y2"> The second y value. </param>
 /// <param name="rx"> The receive. </param>
 /// <param name="ry"> The ry. </param>
 /// <param name="strokeColor"> The stroke color. </param>
 /// <param name="fillcolor"> The fillcolor. </param>
 internal static void DrawRoundRectangle(this ImageWand wand, double x1, double y1, double x2, double y2, double rx, double ry, PixelWand strokeColor, PixelWand fillcolor)
 {
     using (var draw = new DrawingWand())
     {
         draw.StrokeColor = strokeColor;
         draw.FillColor = fillcolor;
         draw.DrawRoundRectangle(x1, y1, x2, y2, rx, ry);
         wand.DrawImage(draw);
     }
 }