//========================================================================== public Pen GetPen() { if (Stroke == null) { return(null); } if (StrokeWidth.ToDouble() <= 0.0) { return(null); } Brush brush = Stroke.ToBrush(this); brush.Opacity = Opacity.ToDouble() * StrokeOpacity.ToDouble(); Pen pen = new Pen(brush, StrokeWidth.ToDouble()); pen.MiterLimit = this.StrokeMiterlimit; if (this.StrokeDasharray != null && this.StrokeDasharray.Length > 0) { var sda = new double[this.StrokeDasharray.Length]; var i = 0; foreach (var svgLength in this.StrokeDasharray) { sda[i++] = svgLength.Value; } var sdo = this.StrokeDashoffset != null ? this.StrokeDashoffset.Value : 0.0; pen.DashStyle = new DashStyle(sda, sdo); } return(pen); }
//========================================================================== public Pen GetPen() { if (Stroke == null) { return(null); } if (StrokeWidth.ToDouble() <= 0.0) { return(null); } Brush brush = Stroke.ToBrush(this); brush.Opacity = Opacity.ToDouble() * StrokeOpacity.ToDouble(); Pen pen = new Pen(brush, StrokeWidth.ToDouble()); pen.MiterLimit = this.StrokeMiterlimit; if (this.StrokeDasharray != null && this.StrokeDasharray.Length > 0) { var sda = new double[this.StrokeDasharray.Length]; var i = 0; foreach (var svgLength in this.StrokeDasharray) { sda[i++] = svgLength.Value; } var sdo = this.StrokeDashoffset != null ? this.StrokeDashoffset.Value : 0.0; pen.DashStyle = new DashStyle(sda, sdo); switch (StrokeLinecap) { case SvgStrokeLinecap.Round: pen.DashCap = PenLineCap.Round; break; case SvgStrokeLinecap.Square: pen.DashCap = PenLineCap.Square; break; case SvgStrokeLinecap.Butt: case SvgStrokeLinecap.Inherit: default: pen.DashCap = PenLineCap.Flat; break; } } return(pen); }
//========================================================================== public Brush GetBrush() { if (Fill == null) { return(null); } Brush brush = Fill.ToBrush(this); if (brush == null) { return(null); } brush.Opacity = Opacity.ToDouble() * FillOpacity.ToDouble(); return(brush); }
//========================================================================== public Pen GetPen() { if (Stroke == null) { return(null); } if (StrokeWidth.ToDouble() <= 0.0) { return(null); } Brush brush = Stroke.ToBrush(this); brush.Opacity = Opacity.ToDouble() * StrokeOpacity.ToDouble(); Pen pen = new Pen(brush, StrokeWidth.ToDouble()); return(pen); }