/// <summary>
 /// Parses the Path data string and converts it to CanvasGeometry.
 /// </summary>
 /// <param name="resourceCreator"><see cref="ICanvasResourceCreator"/></param>
 /// <param name="pathData">Path data</param>
 /// <returns><see cref="CanvasGeometry"/></returns>
 public static CanvasGeometry CreateGeometry(ICanvasResourceCreator resourceCreator, string pathData)
 {
     using (new CultureShield("en-US"))
     {
         // Get the CanvasGeometry from the path data
         return(CanvasGeometryParser.Parse(resourceCreator, pathData));
     }
 }
        /// <summary>
        /// Parses the Path data string and converts it to CanvasGeometry.
        /// </summary>
        /// <param name="resourceCreator">ICanvasResourceCreator</param>
        /// <param name="pathData">Path data</param>
        /// <param name="logger">(Optional) For logging purpose. To log the set of
        /// CanvasPathBuilder commands, used for creating the CanvasGeometry, in
        /// string format.</param>
        /// <returns>CanvasGeometry</returns>
        public static CanvasGeometry CreateGeometry(ICanvasResourceCreator resourceCreator, string pathData,
                                                    StringBuilder logger = null)
        {
            // Log command
            logger?.AppendLine("using (var pathBuilder = new CanvasPathBuilder(resourceCreator))");
            logger?.AppendLine("{");

            // Get the CanvasGeometry from the path data
            var geometry = CanvasGeometryParser.Parse(resourceCreator, pathData, logger);

            // Log command
            logger?.AppendLine("}");

            return(geometry);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Parses the Path data string and converts it to CanvasGeometry.
        /// </summary>
        /// <param name="pathData">Path data</param>
        /// <param name="logger">(Optional) For logging purpose. To log the set of
        /// CanvasPathBuilder commands, used for creating the CanvasGeometry, in
        /// string format.</param>
        /// <returns>CanvasGeometry</returns>
        public static CanvasGeometry CreateGeometry(string pathData, StringBuilder logger = null)
        {
            using (new CultureShield("en-US"))
            {
                // Log command
                logger?.AppendLine("using (var pathBuilder = new CanvasPathBuilder(null))");
                logger?.AppendLine("{");

                // Get the CanvasGeometry from the path data
                var geometry = CanvasGeometryParser.Parse(null, pathData, logger);

                // Log command
                logger?.AppendLine("}");

                return(geometry);
            }
        }