/// <summary>
        /// Draw a marquee-tool.
        /// </summary>
        /// <param name="drawingSession"> The drawing-session. </param>
        /// <param name="resourceCreator"> The resource-creator. </param>
        /// <param name="toolType"> The marquee-tool type. </param>
        /// <param name="marqueeTool"> The marquee-tool. </param>
        /// <param name="matrix"> The matrix. </param>
        public static void DrawMarqueeTool(this CanvasDrawingSession drawingSession, ICanvasResourceCreator resourceCreator, MarqueeToolType toolType, MarqueeTool marqueeTool, Matrix3x2 matrix)
        {
            if (marqueeTool.IsStarted)
            {
                switch (toolType)
                {
                case MarqueeToolType.Rectangular:
                {
                    TransformerRect transformerRect = marqueeTool.TransformerRect;
                    CanvasGeometry  canvasGeometry  = transformerRect.ToRectangle(resourceCreator, matrix);
                    drawingSession.DrawThickGeometry(canvasGeometry);
                }
                break;

                case MarqueeToolType.Elliptical:
                {
                    TransformerRect transformerRect = marqueeTool.TransformerRect;
                    CanvasGeometry  canvasGeometry  = transformerRect.ToEllipse(resourceCreator, matrix);
                    drawingSession.DrawThickGeometry(canvasGeometry);
                }
                break;

                case MarqueeToolType.Polygonal:
                {
                    Vector2[]      points                  = marqueeTool.Points.ToArray();
                    CanvasGeometry canvasGeometry          = CanvasGeometry.CreatePolygon(resourceCreator, points);
                    CanvasGeometry canvasGeometryTransform = canvasGeometry.Transform(matrix);
                    drawingSession.DrawThickGeometry(canvasGeometryTransform);

                    Vector2 firstPoint = Vector2.Transform(marqueeTool.Points.First(), matrix);
                    Vector2 lastPoint  = Vector2.Transform(marqueeTool.Points.Last(), matrix);
                    drawingSession.DrawNode5(firstPoint);
                    drawingSession.DrawNode5(lastPoint);
                }
                break;

                case MarqueeToolType.FreeHand:
                {
                    Vector2[]      points                  = marqueeTool.Points.ToArray();
                    CanvasGeometry canvasGeometry          = CanvasGeometry.CreatePolygon(resourceCreator, points);
                    CanvasGeometry canvasGeometryTransform = canvasGeometry.Transform(matrix);
                    drawingSession.DrawThickGeometry(canvasGeometryTransform);
                }
                break;
                }
            }
        }
        /// <summary>
        /// Draw a marquee-tool.
        /// </summary>
        /// <param name="drawingSession"> The drawing-session. </param>
        /// <param name="resourceCreator"> The resource-creator. </param>
        /// <param name="toolType"> The marquee-tool type. </param>
        /// <param name="marqueeTool"> The marquee-tool. </param>
        public static void DrawMarqueeTool(this CanvasDrawingSession drawingSession, ICanvasResourceCreator resourceCreator, MarqueeToolType toolType, MarqueeTool marqueeTool)
        {
            if (marqueeTool.IsStarted)
            {
                switch (toolType)
                {
                case MarqueeToolType.Rectangular:
                {
                    Rect rect = marqueeTool.TransformerRect.ToRect();
                    drawingSession.DrawThickRectangle(rect);
                }
                break;

                case MarqueeToolType.Elliptical:
                {
                    Vector2 centerPoint = marqueeTool.TransformerRect.Center;
                    float   width       = marqueeTool.TransformerRect.Width / 2;
                    float   height      = marqueeTool.TransformerRect.Height / 2;

                    drawingSession.DrawThickEllipse(centerPoint, width, height);
                }
                break;

                case MarqueeToolType.Polygonal:
                {
                    Vector2[]      points         = marqueeTool.Points.ToArray();
                    CanvasGeometry canvasGeometry = CanvasGeometry.CreatePolygon(resourceCreator, points);
                    drawingSession.DrawThickGeometry(canvasGeometry);

                    Vector2 firstPoint = marqueeTool.Points.First();
                    Vector2 lastPoint  = marqueeTool.Points.Last();
                    drawingSession.DrawNode5(firstPoint);
                    drawingSession.DrawNode5(lastPoint);
                }
                break;

                case MarqueeToolType.FreeHand:
                {
                    Vector2[]      points         = marqueeTool.Points.ToArray();
                    CanvasGeometry canvasGeometry = CanvasGeometry.CreatePolygon(resourceCreator, points);
                    drawingSession.DrawThickGeometry(canvasGeometry);
                }
                break;
                }
            }
        }