private static void DrawMarqueeToolRectangular(this CanvasDrawingSession drawingSession, ICanvasResourceCreator resourceCreator, TransformerRect transformerRect, Rect sourceRectangle, MarqueeCompositeMode compositeMode = MarqueeCompositeMode.New)
        {
            switch (compositeMode)
            {
            case MarqueeCompositeMode.New:
            {
                drawingSession.Clear(Windows.UI.Colors.Transparent);
                Rect rect = transformerRect.ToRect();
                drawingSession.FillRectangle(rect, Windows.UI.Colors.DodgerBlue);
            }
            break;

            case MarqueeCompositeMode.Add:
            {
                Rect rect = transformerRect.ToRect();
                drawingSession.FillRectangle(rect, Windows.UI.Colors.DodgerBlue);
            }
            break;

            case MarqueeCompositeMode.Subtract:
            {
                CanvasCommandList canvasCommandList = CanvasDrawingSessionExtensions.GetMarqueeToolRectangular(drawingSession, resourceCreator, transformerRect);
                CanvasComposite   canvasComposite   = CanvasComposite.DestinationOut;
                drawingSession.DrawImage(canvasCommandList, 0, 0, sourceRectangle, 1, CanvasImageInterpolation.Linear, canvasComposite);
            }
            break;

            case MarqueeCompositeMode.Intersect:
            {
                CanvasCommandList canvasCommandList = CanvasDrawingSessionExtensions.GetMarqueeToolRectangular(drawingSession, resourceCreator, transformerRect);
                CanvasComposite   canvasComposite   = CanvasComposite.DestinationIn;
                drawingSession.DrawImage(canvasCommandList, 0, 0, sourceRectangle, 1, CanvasImageInterpolation.Linear, canvasComposite);
            }
            break;

            case MarqueeCompositeMode.Xor:
            {
                CanvasCommandList canvasCommandList = CanvasDrawingSessionExtensions.GetMarqueeToolRectangular(drawingSession, resourceCreator, transformerRect);
                CanvasComposite   canvasComposite   = CanvasComposite.Xor;
                drawingSession.DrawImage(canvasCommandList, 0, 0, sourceRectangle, 1, CanvasImageInterpolation.Linear, canvasComposite);
            }
            break;
            }
        }
        private static CanvasCommandList GetMarqueeToolRectangular(CanvasDrawingSession drawingSession, ICanvasResourceCreator resourceCreator, TransformerRect transformerRect)
        {
            CanvasCommandList canvasCommandList = new CanvasCommandList(resourceCreator);

            using (CanvasDrawingSession ds = canvasCommandList.CreateDrawingSession())
            {
                Rect rect = transformerRect.ToRect();
                ds.FillRectangle(rect, Windows.UI.Colors.DodgerBlue);
            }
            return(canvasCommandList);
        }