Example #1
0
        // Create the extruded text effect
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.SmoothingMode     = SmoothingMode.AntiAlias;
            e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;

            // Create the outline strategy which is going to shift blit diagonally
            var strategyOutline = CanvasHelper.TextOutline(MaskColor.Blue, MaskColor.Blue, 4);

            Bitmap canvas = CanvasHelper.GenImage(ClientSize.Width, ClientSize.Height, Color.White, 0);

            // Text context to store string and font info to be sent as parameter to Canvas methods
            TextContext context = new TextContext();

            FontFamily fontFamily = new FontFamily("Arial Black");

            context.fontFamily = fontFamily;
            context.fontStyle  = FontStyle.Regular;
            context.nfontSize  = 40;

            context.pszText = "CODING MONKEY";
            context.ptDraw  = new Point(0, 0);

            // the single mask outline
            Bitmap maskOutline = CanvasHelper.GenMask(strategyOutline, ClientSize.Width, ClientSize.Height, new Point(0, 0), context);
            // the mask to store all the single mask blitted diagonally
            Bitmap maskOutlineAll = CanvasHelper.GenImage(ClientSize.Width + 10, ClientSize.Height + 10);

            Graphics graphMaskAll = Graphics.FromImage(maskOutlineAll);

            // blit diagonally
            for (int i = 0; i < 7; ++i)
            {
                graphMaskAll.DrawImage(maskOutline, i, i, ClientSize.Width, ClientSize.Height);
            }

            // Measure the dimension of the big mask in order to generate the correct sized gradient image
            //=============================================================================================
            uint top    = 0;
            uint bottom = 0;
            uint left   = 0;
            uint right  = 0;

            CanvasHelper.MeasureMaskLength(maskOutlineAll, MaskColor.Blue, ref top, ref left, ref bottom, ref right);
            right  += 2;
            bottom += 2;

            // Generate the gradient image for the diagonal outline
            //=======================================================
            Bitmap gradImage = CanvasHelper.GenImage((int)(right - left), (int)(bottom - top));

            List <Color> listColors = new List <Color>();

            listColors.Add(Color.DarkGreen);
            listColors.Add(Color.YellowGreen);
            DrawGradient.Draw(gradImage, listColors, false);

            // Because Canvas::ApplyImageToMask requires all image to have same dimensions,
            // we have to blit our small gradient image onto a temp image as big as the canvas
            //===================================================================================
            Bitmap gradBlitted = CanvasHelper.GenImage(ClientSize.Width, ClientSize.Height);

            Graphics graphgradBlitted = Graphics.FromImage(gradBlitted);

            graphgradBlitted.DrawImage(gradImage, (int)left, (int)top, (int)(gradImage.Width), (int)(gradImage.Height));

            CanvasHelper.ApplyImageToMask(gradBlitted, maskOutlineAll, canvas, MaskColor.Blue, false);

            // Create strategy and mask image for the text body
            //===================================================
            var    strategyText = CanvasHelper.TextNoOutline(MaskColor.Blue);
            Bitmap maskText     = CanvasHelper.GenMask(strategyText, ClientSize.Width, ClientSize.Height, new Point(0, 0), context);

            // Measure the dimension required for text body using the mask
            //=============================================================
            top    = 0;
            bottom = 0;
            left   = 0;
            right  = 0;
            CanvasHelper.MeasureMaskLength(maskText, MaskColor.Blue, ref top, ref left, ref bottom, ref right);
            top  -= 2;
            left -= 2;

            right  += 2;
            bottom += 2;

            // Create the gradient brush for the text body
            LinearGradientBrush gradTextbrush = new LinearGradientBrush(new Rectangle((int)left, (int)top, (int)right, (int)bottom), Color.Orange, Color.OrangeRed, 90.0f);
            // Create the actual strategy for the text body used for rendering, with the gradient brush
            var strategyText2 = CanvasHelper.TextNoOutline(gradTextbrush);

            // Draw the newly created strategy onto the canvas
            CanvasHelper.DrawTextImage(strategyText2, canvas, new Point(0, 0), context);

            // Finally blit the rendered canvas onto the window
            e.Graphics.DrawImage(canvas, 0, 0, ClientSize.Width, ClientSize.Height);

            // Release all the resources
            //============================
            maskOutline.Dispose();
            maskOutlineAll.Dispose();

            gradImage.Dispose();
            gradBlitted.Dispose();
            maskText.Dispose();

            canvas.Dispose();

            strategyText.Dispose();
            strategyText2.Dispose();
            strategyOutline.Dispose();

            gradTextbrush.Dispose();
        }
Example #2
0
        private WriteableBitmap DrawChar(int x_offset, Rect rect, TextContext context)
        {
            // Create the outline strategy which is going to shift blit diagonally
            var strategyOutline = TextDesignerWpf.Canvas.TextOutline(MaskColor.Blue, MaskColor.Blue, 4);

            WriteableBitmap canvas = TextDesignerWpf.Canvas.GenImage((int)(image1.Width), (int)(image1.Height), Colors.White, 0);

            // the single mask outline
            WriteableBitmap maskOutline = TextDesignerWpf.Canvas.GenMask(strategyOutline, (int)(image1.Width), (int)(image1.Height), new Point(0, 0), context);
            // the mask to store all the single mask blitted diagonally
            WriteableBitmap maskOutlineAll = TextDesignerWpf.Canvas.GenImage((int)(image1.Width) + 10, (int)(image1.Height) + 10);

            RenderTargetBitmap bmp            = new RenderTargetBitmap((int)(maskOutlineAll.Width), (int)(maskOutlineAll.Height), 96, 96, PixelFormats.Pbgra32);
            DrawingVisual      drawingVisual  = new DrawingVisual();
            DrawingContext     drawingContext = drawingVisual.RenderOpen();

            // blit diagonally
            for (int i = 0; i < 8; ++i)
            {
                drawingContext.DrawImage(maskOutline, new Rect((double)(-i), (double)(-i), maskOutline.Width, maskOutline.Height - 0.0));
            }

            drawingContext.Close();

            bmp.Render(drawingVisual);

            maskOutlineAll = new WriteableBitmap(bmp);

            // Measure the dimension of the big mask in order to generate the correct sized gradient image
            //=============================================================================================
            uint top    = 0;
            uint bottom = 0;
            uint left   = 0;
            uint right  = 0;

            TextDesignerWpf.Canvas.MeasureMaskLength(maskOutlineAll, MaskColor.Blue, ref top, ref left, ref bottom, ref right);
            right  += 2;
            bottom += 2;

            // Generate the gradient image for the diagonal outline
            //=======================================================
            WriteableBitmap gradImage = TextDesignerWpf.Canvas.GenImage((int)(right - left), (int)(bottom - top));

            List <Color> listColors = new List <Color>();

            listColors.Add(Colors.Purple);
            listColors.Add(Colors.MediumPurple);
            DrawGradient.Draw(ref gradImage, listColors, false);

            // Because Canvas::ApplyImageToMask requires all image to have same dimensions,
            // we have to blit our small gradient image onto a temp image as big as the canvas
            //===================================================================================
            WriteableBitmap gradBlitted = TextDesignerWpf.Canvas.GenImage((int)(image1.Width), (int)(image1.Height));

            byte[] pixels2 = new byte[gradImage.PixelHeight * gradImage.PixelWidth * gradImage.Format.BitsPerPixel / 8];
            gradImage.CopyPixels(pixels2, gradImage.BackBufferStride, 0);
            gradBlitted.WritePixels(new Int32Rect((int)left, (int)top, (int)(gradImage.Width), (int)(gradImage.Height)), pixels2, gradImage.BackBufferStride, 0);

            TextDesignerWpf.Canvas.ApplyImageToMask(gradBlitted, maskOutlineAll, canvas, MaskColor.Blue, false);

            // Create strategy and mask image for the text body
            //===================================================
            var             strategyText = TextDesignerWpf.Canvas.TextNoOutline(MaskColor.Blue);
            WriteableBitmap maskText     = TextDesignerWpf.Canvas.GenMask(strategyText, (int)(image1.Width), (int)(image1.Height), new Point(0, 0), context);

            // Measure the dimension required for text body using the mask
            //=============================================================
            top    = 0;
            bottom = 0;
            left   = 0;
            right  = 0;
            TextDesignerWpf.Canvas.MeasureMaskLength(maskText, MaskColor.Blue, ref top, ref left, ref bottom, ref right);
            top  -= 2;
            left -= 2;

            right  += 2;
            bottom += 2;

            GradientStopCollection coll = new GradientStopCollection();
            GradientStop           stop = new GradientStop(Colors.DeepPink, 0.0);

            coll.Add(stop);
            stop = new GradientStop(Colors.LightPink, 1.0);
            coll.Add(stop);

            // Create the gradient brush for the text body
            LinearGradientBrush gradTextbrush = new LinearGradientBrush(coll, 90.0);

            // Create the actual strategy for the text body used for rendering, with the gradient brush
            var strategyText2 = TextDesignerWpf.Canvas.TextNoOutline(gradTextbrush);

            // Draw the newly created strategy onto the canvas
            TextDesignerWpf.Canvas.DrawTextImage(strategyText2, ref canvas, new Point(0, 0), context);

            return(canvas);
        }
Example #3
0
        // Create rainbow Text Effect in Aquarion EVOL anime
        public MainWindow()
        {
            InitializeComponent();

            // Create the outline strategy which is used later on for measuring
            // the size of text in order to generate a correct sized gradient image
            var strategyOutline2 = TextDesignerWpf.Canvas.TextOutline(MaskColor.Blue, MaskColor.Blue, 6);

            WriteableBitmap canvas = TextDesignerWpf.Canvas.GenImage((int)(image1.Width), (int)(image1.Height));

            // Text context to store string and font info to be sent as parameter to Canvas methods
            TextContext context = new TextContext();

            // Load a font from its resource,
            // instead of from system font collection
            //=============================================================
            FontFamily fontFamily = new FontFamily(new Uri("pack://application:,,,/resources/"), "./#Ruzicka Freehand LT Std");

            context.fontFamily = fontFamily;
            context.fontStyle  = FontStyles.Normal;
            context.fontWeight = FontWeights.Regular;
            context.nfontSize  = 46;

            context.pszText = "I cross over the deep blue void";
            context.ptDraw  = new Point(0, 0);

            // Generate the mask image for measuring the size of the text image required
            //============================================================================
            WriteableBitmap maskOutline2 = TextDesignerWpf.Canvas.GenMask(strategyOutline2, (int)(image1.Width), (int)(image1.Height), new Point(0, 0), context);

            uint top    = 0;
            uint bottom = 0;
            uint left   = 0;
            uint right  = 0;

            TextDesignerWpf.Canvas.MeasureMaskLength(maskOutline2, MaskColor.Blue, ref top, ref left, ref bottom, ref right);
            bottom += 2;
            right  += 2;

            // Generate the gradient image
            //=============================
            WriteableBitmap bmpGrad = new WriteableBitmap((int)(right - left), (int)(bottom - top), 96.0, 96.0, PixelFormats.Pbgra32, null);
            List <Color>    list    = new List <Color>();

            list.Add(Color.FromRgb(255, 0, 0));
            list.Add(Color.FromRgb(0, 0, 255));
            list.Add(Color.FromRgb(0, 255, 0));
            DrawGradient.Draw(ref bmpGrad, list, true);

            // Because Canvas::ApplyImageToMask requires the all images to have equal dimension,
            // we need to blit our new gradient image onto a larger image to be same size as canvas image
            //==============================================================================================
            WriteableBitmap bmpGrad2 = new WriteableBitmap((int)(image1.Width), (int)(image1.Height), 96.0, 96.0, PixelFormats.Pbgra32, null);

            byte[] pixels = new byte[bmpGrad.PixelHeight * bmpGrad.PixelWidth * bmpGrad.Format.BitsPerPixel / 8];
            bmpGrad.CopyPixels(pixels, bmpGrad.BackBufferStride, 0);
            bmpGrad2.WritePixels(new Int32Rect((int)left, (int)top, (int)(right - left), (int)(bottom - top)), pixels, bmpGrad.BackBufferStride, 0);

            // Apply the rainbow text against the blue mask onto the canvas
            TextDesignerWpf.Canvas.ApplyImageToMask(bmpGrad2, maskOutline2, canvas, MaskColor.Blue, false);

            // Draw the (white body and black outline) text onto the canvas
            //==============================================================
            ITextStrategy strategyOutline1 = TextDesignerWpf.Canvas.TextOutline(Color.FromRgb(255, 255, 255), Color.FromRgb(0, 0, 0), 1);

            TextDesignerWpf.Canvas.DrawTextImage(strategyOutline1, ref canvas, new Point(0, 0), context);

            // Finally blit the rendered image onto the window by assigning canvas to the image control
            image1.Source = canvas;
        }
Example #4
0
        void DrawChar(int x_offset, Rectangle rect, TextContext context, Graphics graphics, Matrix mat)
        {
            Bitmap canvas = Canvas.GenImage(ClientSize.Width, ClientSize.Height, Color.White, 0);

            // Create the outline strategy which is going to shift blit diagonally
            var strategyOutline = Canvas.TextOutline(MaskColor.Blue, MaskColor.Blue, 4);

            // the single mask outline
            Bitmap maskOutline = Canvas.GenMask(strategyOutline, rect.Width, rect.Height, new Point(0, 0), context, mat);
            // the mask to store all the single mask blitted diagonally
            Bitmap maskOutlineAll = Canvas.GenImage(rect.Width + 10, rect.Height + 10);

            Graphics graphMaskAll = Graphics.FromImage(maskOutlineAll);

            // blit diagonally
            for (int i = 0; i < 8; ++i)
            {
                graphMaskAll.DrawImage(maskOutline, -i, -i, rect.Width, rect.Height);
            }

            // Measure the dimension of the big mask in order to generate the correct sized gradient image
            //=============================================================================================
            UInt32 top    = 0;
            UInt32 bottom = 0;
            UInt32 left   = 0;
            UInt32 right  = 0;

            Canvas.MeasureMaskLength(maskOutlineAll, MaskColor.Blue, ref top, ref left, ref bottom, ref right);
            right  += 2;
            bottom += 2;

            // Generate the gradient image for the diagonal outline
            //=======================================================
            Bitmap gradImage = Canvas.GenImage((int)(right - left), (int)(bottom - top));

            List <Color> listColors = new List <Color>();

            listColors.Add(Color.Purple);
            listColors.Add(Color.MediumPurple);
            DrawGradient.Draw(gradImage, listColors, false);

            // Because Canvas::ApplyImageToMask requires all image to have same dimensions,
            // we have to blit our small gradient image onto a temp image as big as the canvas
            //===================================================================================
            Bitmap gradBlitted = Canvas.GenImage(rect.Width, rect.Height);

            Graphics graphgradBlitted = Graphics.FromImage(gradBlitted);

            graphgradBlitted.DrawImage(gradImage, (int)left, (int)top, (int)(gradImage.Width), (int)(gradImage.Height));

            Canvas.ApplyImageToMask(gradBlitted, maskOutlineAll, canvas, MaskColor.Blue, false);

            // Create strategy and mask image for the text body
            //===================================================
            var    strategyText = Canvas.TextNoOutline(MaskColor.Blue);
            Bitmap maskText     = Canvas.GenMask(strategyText, rect.Width, rect.Height, new Point(0, 0), context, mat);

            // Measure the dimension required for text body using the mask
            //=============================================================
            top    = 0;
            bottom = 0;
            left   = 0;
            right  = 0;
            Canvas.MeasureMaskLength(maskText, MaskColor.Blue, ref top, ref left, ref bottom, ref right);
            top  -= 2;
            left -= 2;

            right  += 2;
            bottom += 2;

            // Create the gradient brush for the text body
            LinearGradientBrush gradTextbrush = new LinearGradientBrush(new Rectangle((int)left, (int)top, (int)right, (int)bottom), Color.DeepPink, Color.LightPink, 90.0f);

            // Create the actual strategy for the text body used for rendering, with the gradient brush
            var strategyText2 = Canvas.TextNoOutline(gradTextbrush);

            // Draw the newly created strategy onto the canvas
            Canvas.DrawTextImage(strategyText2, canvas, new Point(0, 0), context, mat);

            // Finally blit the rendered canvas onto the window
            graphics.DrawImage(canvas, x_offset, 0, rect.Width, rect.Height);

            gradImage.Dispose();
            gradBlitted.Dispose();

            maskText.Dispose();

            strategyText.Dispose();
            strategyText2.Dispose();

            maskOutline.Dispose();
            maskOutlineAll.Dispose();

            strategyOutline.Dispose();

            canvas.Dispose();
        }
Example #5
0
        // Create the extruded text effect
        public MainWindow()
        {
            InitializeComponent();

            // Create the outline strategy which is going to shift blit diagonally
            var strategyOutline = TextDesignerWpf.Canvas.TextOutline(MaskColor.Blue, MaskColor.Blue, 4);

            WriteableBitmap canvas = TextDesignerWpf.Canvas.GenImage((int)(image1.Width), (int)(image1.Height), Colors.White, 0);

            // Text context to store string and font info to be sent as parameter to Canvas methods
            TextContext context = new TextContext();

            FontFamily fontFamily = new FontFamily("Arial Black");

            context.fontFamily = fontFamily;
            context.fontStyle  = FontStyles.Normal;
            context.fontWeight = FontWeights.Regular;
            context.nfontSize  = 40;

            context.pszText = "CODING MONKEY";
            context.ptDraw  = new Point(0, 0);

            // the single mask outline
            WriteableBitmap maskOutline = TextDesignerWpf.Canvas.GenMask(strategyOutline, (int)(image1.Width), (int)(image1.Height), new Point(0, 0), context);
            // the mask to store all the single mask blitted diagonally
            WriteableBitmap maskOutlineAll = TextDesignerWpf.Canvas.GenImage((int)(image1.Width) + 10, (int)(image1.Height) + 10);

            RenderTargetBitmap bmp            = new RenderTargetBitmap((int)(maskOutlineAll.Width), (int)(maskOutlineAll.Height), 96, 96, PixelFormats.Pbgra32);
            DrawingVisual      drawingVisual  = new DrawingVisual();
            DrawingContext     drawingContext = drawingVisual.RenderOpen();

            // blit diagonally
            for (int i = 0; i < 7; ++i)
            {
                drawingContext.DrawImage(maskOutline, new Rect((double)(i), (double)(i), maskOutline.Width, maskOutline.Height - 0.0));
            }

            drawingContext.Close();

            bmp.Render(drawingVisual);

            maskOutlineAll = new WriteableBitmap(bmp);

            // Measure the dimension of the big mask in order to generate the correct sized gradient image
            //=============================================================================================
            uint top    = 0;
            uint bottom = 0;
            uint left   = 0;
            uint right  = 0;

            TextDesignerWpf.Canvas.MeasureMaskLength(maskOutlineAll, MaskColor.Blue, ref top, ref left, ref bottom, ref right);
            right  += 2;
            bottom += 2;

            // Generate the gradient image for the diagonal outline
            //=======================================================
            WriteableBitmap gradImage = TextDesignerWpf.Canvas.GenImage((int)(right - left), (int)(bottom - top));

            List <Color> listColors = new List <Color>();

            listColors.Add(Colors.DarkGreen);
            listColors.Add(Colors.YellowGreen);
            DrawGradient.Draw(ref gradImage, listColors, false);

            // Because Canvas::ApplyImageToMask requires all image to have same dimensions,
            // we have to blit our small gradient image onto a temp image as big as the canvas
            //===================================================================================
            WriteableBitmap gradBlitted = TextDesignerWpf.Canvas.GenImage((int)(image1.Width), (int)(image1.Height));

            byte[] pixels2 = new byte[gradImage.PixelHeight * gradImage.PixelWidth * gradImage.Format.BitsPerPixel / 8];
            gradImage.CopyPixels(pixels2, gradImage.BackBufferStride, 0);
            gradBlitted.WritePixels(new Int32Rect((int)left, (int)top, (int)(gradImage.Width), (int)(gradImage.Height)), pixels2, gradImage.BackBufferStride, 0);

            TextDesignerWpf.Canvas.ApplyImageToMask(gradBlitted, maskOutlineAll, canvas, MaskColor.Blue, false);

            // Create strategy and mask image for the text body
            //===================================================
            var             strategyText = TextDesignerWpf.Canvas.TextNoOutline(MaskColor.Blue);
            WriteableBitmap maskText     = TextDesignerWpf.Canvas.GenMask(strategyText, (int)(image1.Width), (int)(image1.Height), new Point(0, 0), context);

            // Measure the dimension required for text body using the mask
            //=============================================================
            top    = 0;
            bottom = 0;
            left   = 0;
            right  = 0;
            TextDesignerWpf.Canvas.MeasureMaskLength(maskText, MaskColor.Blue, ref top, ref left, ref bottom, ref right);
            top  -= 2;
            left -= 2;

            right  += 2;
            bottom += 2;

            GradientStopCollection coll = new GradientStopCollection();
            GradientStop           stop = new GradientStop(Colors.Orange, 0.0);

            coll.Add(stop);
            stop = new GradientStop(Colors.OrangeRed, 1.0);
            coll.Add(stop);

            // Create the gradient brush for the text body
            LinearGradientBrush gradTextbrush = new LinearGradientBrush(coll, 90.0);

            // Create the actual strategy for the text body used for rendering, with the gradient brush
            var strategyText2 = TextDesignerWpf.Canvas.TextNoOutline(gradTextbrush);

            // Draw the newly created strategy onto the canvas
            TextDesignerWpf.Canvas.DrawTextImage(strategyText2, ref canvas, new Point(0, 0), context);

            // Finally blit the rendered image onto the window by assigning canvas to the image control
            image1.Source = canvas;
        }
Example #6
0
        // Create rainbow Text Effect in Aquarion EVOL anime
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.SmoothingMode     = SmoothingMode.AntiAlias;
            e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;

            // Create the outline strategy which is used later on for measuring
            // the size of text in order to generate a correct sized gradient image
            var strategyOutline2 = Canvas.TextOutline(MaskColor.Blue, MaskColor.Blue, 8);

            Bitmap canvas = Canvas.GenImage(ClientSize.Width, ClientSize.Height, Color.White, 0);

            // Text context to store string and font info to be sent as parameter to Canvas methods
            TextContext context = new TextContext();

            // Load a font from its file into private collection,
            // instead of from system font collection
            //=============================================================
            PrivateFontCollection fontcollection = new PrivateFontCollection();

            string szFontFile = "..\\..\\..\\CommonFonts\\Ruzicka TypeK.ttf";

            fontcollection.AddFontFile(szFontFile);

            if (fontcollection.Families.Count() > 0)
            {
                context.fontFamily = fontcollection.Families[0];
            }
            context.fontStyle = FontStyle.Regular;
            context.nfontSize = 36;

            context.pszText = "I cross over the deep blue void";
            context.ptDraw  = new Point(0, 0);

            // Generate the mask image for measuring the size of the text image required
            //============================================================================
            Bitmap maskOutline2 = Canvas.GenMask(strategyOutline2, ClientSize.Width, ClientSize.Height, new Point(0, 0), context);

            uint top    = 0;
            uint bottom = 0;
            uint left   = 0;
            uint right  = 0;

            Canvas.MeasureMaskLength(maskOutline2, MaskColor.Blue, ref top, ref left, ref bottom, ref right);
            bottom += 2;
            right  += 2;

            // Generate the gradient image
            //=============================
            Bitmap       bmpGrad = new Bitmap((int)(right - left), (int)(bottom - top), PixelFormat.Format32bppArgb);
            List <Color> list    = new List <Color>();

            list.Add(Color.FromArgb(255, 0, 0));
            list.Add(Color.FromArgb(0, 0, 255));
            list.Add(Color.FromArgb(0, 255, 0));
            DrawGradient.Draw(bmpGrad, list, true);

            // Because Canvas::ApplyImageToMask requires the all images to have equal dimension,
            // we need to blit our new gradient image onto a larger image to be same size as canvas image
            //==============================================================================================
            Bitmap   bmpGrad2  = new Bitmap(ClientSize.Width, ClientSize.Height, PixelFormat.Format32bppArgb);
            Graphics graphGrad = Graphics.FromImage(bmpGrad2);

            graphGrad.SmoothingMode     = SmoothingMode.AntiAlias;
            graphGrad.InterpolationMode = InterpolationMode.HighQualityBicubic;
            graphGrad.DrawImage(bmpGrad, (int)left, (int)top, (int)(right - left), (int)(bottom - top));

            // Apply the rainbow text against the blue mask onto the canvas
            Canvas.ApplyImageToMask(bmpGrad2, maskOutline2, canvas, MaskColor.Blue, false);

            // Draw the (white body and black outline) text onto the canvas
            //==============================================================
            var strategyOutline1 = Canvas.TextOutline(Color.FromArgb(255, 255, 255), Color.FromArgb(0, 0, 0), 4);

            Canvas.DrawTextImage(strategyOutline1, canvas, new Point(0, 0), context);

            // Finally blit the rendered image onto the window
            e.Graphics.DrawImage(canvas, 0, 0, ClientSize.Width, ClientSize.Height);

            // Release all the resources
            //============================
            e.Graphics.Dispose();

            bmpGrad.Dispose();
            bmpGrad2.Dispose();
            canvas.Dispose();

            maskOutline2.Dispose();
            strategyOutline2.Dispose();
            strategyOutline1.Dispose();
        }