Exemplo n.º 1
0
        public static Sm.Pen ToMediaPen(this Wg.Stroke input)
        {
            Sm.Pen pen = new Sm.Pen(new Sm.SolidColorBrush(input.Color.ToMediaColor()), input.Weight);
            pen.StartLineCap = input.Cap.ToMediaCap();
            pen.EndLineCap   = input.Cap.ToMediaCap();
            pen.DashCap      = input.Cap.ToMediaCap();

            if (input.HasPattern)
            {
                pen.DashStyle = new Sm.DashStyle(input.Pattern, input.Offset);
            }

            pen.LineJoin   = input.Corner.ToMediaJoin();
            pen.MiterLimit = input.MiterLimit;

            return(pen);
        }
Exemplo n.º 2
0
        public static string ToSVG(this Wg.Stroke input)
        {
            string output = "<style>" + Environment.NewLine;

            output += ".cls-" + input.ID + "{" + Environment.NewLine;
            output += "stroke:" + input.Color.ToSVG() + ";" + Environment.NewLine;
            output += "stroke-opacity:" + input.Color.A / 255.0 + ";" + Environment.NewLine;
            output += "stroke-width:" + input.Weight + ";" + Environment.NewLine;
            output += "stroke-linecap:" + input.Cap.ToSVG() + ";" + Environment.NewLine;
            output += "stroke-linejoin:" + input.Corner.ToSVG() + ";" + Environment.NewLine;
            output += "stroke-miterlimit:" + input.MiterLimit + ";";
            if (input.HasPattern)
            {
                output += Environment.NewLine + "stroke-dasharray:" + input.Pattern + ";" + Environment.NewLine;
            }
            output += "}";
            output += "</style>";
            return(output);
        }