static Win2D.CanvasGeometryCombine Win2dCanvasGeometryCombine(Wcd.Mgcg.CanvasGeometryCombine combine)
        {
            switch (combine)
            {
            case Wcd.Mgcg.CanvasGeometryCombine.Union:
                return(Win2D.CanvasGeometryCombine.Union);

            case Wcd.Mgcg.CanvasGeometryCombine.Exclude:
                return(Win2D.CanvasGeometryCombine.Exclude);

            case Wcd.Mgcg.CanvasGeometryCombine.Intersect:
                return(Win2D.CanvasGeometryCombine.Intersect);

            case Wcd.Mgcg.CanvasGeometryCombine.Xor:
                return(Win2D.CanvasGeometryCombine.Xor);

            default:
                throw new InvalidOperationException();
            }
        }
        internal static Wcd.Mgcg.CanvasGeometry CombineGeometries(Wcd.Mgcg.CanvasGeometry[] geometries, Wcd.Mgcg.CanvasGeometryCombine combineMode)
        {
            // Convert the geometries to Win2D geometries.
            var win2dGeometry = CombineWin2DGeometries(geometries.Select(ToWin2dCanvasGeometry).ToArray(), Win2dCanvasGeometryCombine(combineMode));

            // Convert to a Win2D path.
            var builder = new CpBuilder();

            win2dGeometry.SendPathTo(builder);

            // Convert back to a CanvasGeometry.
            return(builder.ToCanvasGeometry());
        }