Ejemplo n.º 1
0
        /// <summary>
        /// Produces a string with properly-formatted SVG document, containing all the signature strokes
        /// as simple lines.
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static string ToSVG(int[][][] data)
        {
            var stats = new jSignature.Tools.Stats(data);
            var contentsize = stats.ContentSize;
            var limits = stats.ContentLimits;

            string outersvgtemplate = @"<?xml version='1.0' encoding='UTF-8' standalone='no'?>
            <!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
            <svg xmlns='http://www.w3.org/2000/svg' version='1.1' width='{0}' height='{1}'>{2}
            </svg>".Replace('\'', '"');

            return String.Format(
                outersvgtemplate
                , contentsize[0] // width
                , contentsize[1] // height
                , GetPathsSVGFragment(
                    data
                    , limits[0] * -1 + 1
                    , limits[1] * -1 + 1
                )
            );
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Produces a string with properly-formatted SVG document, containing all the signature strokes
        /// as simple lines.
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static string ToSVG(int[][][] data)
        {
            var stats       = new jSignature.Tools.Stats(data);
            var contentsize = stats.ContentSize;
            var limits      = stats.ContentLimits;

            string outersvgtemplate = @"<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
<svg xmlns='http://www.w3.org/2000/svg' version='1.1' width='{0}' height='{1}'>{2}
</svg>".Replace('\'', '"');

            return(String.Format(
                       outersvgtemplate
                       , contentsize[0] // width
                       , contentsize[1] // height
                       , GetPathsSVGFragment(
                           data
                           , limits[0] * -1 + 1
                           , limits[1] * -1 + 1
                           )
                       ));
        }