/// <summary>
        /// Draws a bordered string on a bitmap.
        /// </summary>
        /// <param name="str"></param>
        /// <param name="bitmap"></param>
        /// <param name="drawSettings"></param>
        /// <returns></returns>
        public static Image DrawBorderedString(string str, Image bitmap, DrawSettings drawSettings)
        {
            Graphics     g            = Graphics.FromImage(bitmap);
            StringFormat stringFormat = drawSettings.StringFormat;

            Color  StringColor  = drawSettings.Color;
            string adjustedText = WordWrap(str, drawSettings.WrapWidth);
            Point  point        = new Point(bitmap.Width / 2, bitmap.Height / 2 - 40);
            Font   font         = drawSettings.Font;

            font = GetAdjustedFont(g, adjustedText, font, bitmap.Width, drawSettings.MaxTextSize, drawSettings.MinTextSize, true);

            GraphicsPath p     = new GraphicsPath();
            float        moveX = bitmap.Width / 2f + 20;
            float        moveY = bitmap.Height / 2f - 40 + 20;

            g.TranslateTransform(moveX, moveY);
            g.RotateTransform(-35f);
            g.TranslateTransform(-moveX, -moveY);
            p.AddString(adjustedText, FontFamily.GenericSansSerif, (int)FontStyle.Regular, g.DpiY * font.Size / 72, point, stringFormat);
            g.InterpolationMode  = InterpolationMode.HighQualityBicubic;
            g.SmoothingMode      = SmoothingMode.HighQuality;
            g.TextRenderingHint  = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
            g.CompositingQuality = CompositingQuality.HighQuality;
            Pen pen = new Pen(Color.Black, 10f);

            g.DrawPath(pen, p);
            p.FillMode = FillMode.Winding;
            //g.FillPath(new TextureBrush(fillMap, new Rectangle(0, 0, bitmap.Width, bitmap.Height)), p);
            RectangleF pathRect  = p.GetBounds();
            Rectangle  gradRect  = new Rectangle(0, 0, 20, 20);
            var        gradBrush = new LinearGradientBrush(gradRect, Color.BlueViolet, Color.ForestGreen, LinearGradientMode.ForwardDiagonal);

            //gradBrush.CenterColor = Color.Aqua;
            //gradBrush.SurroundColors = new[] { Color.Coral, Color.Crimson, Color.ForestGreen, Color.Pink, Color.White };
            g.FillPath(gradBrush, p);

            //graphicsImage.DrawString(adjustedText, font, new SolidBrush(StringColor), point,
            //    centerFormat);
            g.ResetTransform();
            return(bitmap);
        }
        /// <summary>
        /// Draw a string on the given <see cref="Image"/>.
        /// </summary>
        /// <param name="str"></param>
        /// <param name="bitmap"></param>
        /// <param name="drawSettings"></param>
        /// <returns></returns>
        public static Image DrawString(string str, Image bitmap, DrawSettings drawSettings)
        {
            if (drawSettings.DrawStyle == DrawStyle.Bordered)
            {
                return(DrawBorderedString(str, bitmap, drawSettings));
            }
            Graphics graphicsImage = Graphics.FromImage(bitmap);

            //strFormat.FormatFlags |= StringFormatFlags.FitBlackBox;
            Color StringColor = drawSettings.Color;
            Point point       = new Point(bitmap.Width / 2, bitmap.Height / 2);

            if (drawSettings.WrapWidth > 0)
            {
                str = WordWrap(str, drawSettings.WrapWidth);
            }
            Font font = GetAdjustedFont(graphicsImage, str, drawSettings.Font, (int)(bitmap.Width * .9f), drawSettings.MaxTextSize, drawSettings.MinTextSize, true);

            graphicsImage.DrawString(str, font, new SolidBrush(StringColor), point,
                                     drawSettings.StringFormat);
            return(bitmap);
        }