/// <summary> /// Sets the stroke style. /// </summary> /// <param name="stroke">The stroke color.</param> /// <param name="thickness">The stroke thickness.</param> /// <param name="dashArray">The dash array.</param> /// <param name="lineJoin">The line join.</param> /// <param name="aliased">Use aliased strokes if set to <c>true</c>.</param> private void SetStroke(OxyColor stroke, double thickness, double[] dashArray = null, OxyPenLineJoin lineJoin = OxyPenLineJoin.Miter, bool aliased = false) { this.paint.SetStyle(Paint.Style.Stroke); this.paint.Color = stroke.ToColor(); this.paint.StrokeWidth = this.Convert(thickness); this.paint.StrokeJoin = lineJoin.Convert(); if (dashArray != null) { var dashArrayF = dashArray.Select(this.Convert).ToArray(); this.paint.SetPathEffect(new DashPathEffect(dashArrayF, 0f)); } this.paint.AntiAlias = !aliased; }
/// <summary> /// Sets the stroke style. /// </summary> /// <param name="c">The stroke color.</param> /// <param name="thickness">The stroke thickness.</param> /// <param name="dashArray">The dash array.</param> /// <param name="lineJoin">The line join.</param> private void SetStroke(OxyColor c, double thickness, double[] dashArray = null, OxyPenLineJoin lineJoin = OxyPenLineJoin.Miter) { this.gctx.SetStrokeColor(c.ToCGColor()); this.gctx.SetLineWidth((float)thickness); this.gctx.SetLineJoin(lineJoin.Convert()); if (dashArray != null) { var lengths = dashArray.Select(d => (float)d).ToArray(); this.gctx.SetLineDash(0f, lengths); } else { this.gctx.SetLineDash(0, null); } }
/// <summary> /// Sets the stroke style. /// </summary> /// <param name="stroke">The stroke color.</param> /// <param name="thickness">The stroke thickness.</param> /// <param name="dashArray">The dash array.</param> /// <param name="lineJoin">The line join.</param> /// <param name="aliased">Use aliased strokes if set to <c>true</c>.</param> private void SetStroke(OxyColor stroke, double thickness, double[] dashArray = null, OxyPenLineJoin lineJoin = OxyPenLineJoin.Miter, bool aliased = false) { this.paint.SetStyle(Paint.Style.Stroke); this.paint.Color = stroke.ToColor(); this.paint.StrokeWidth = this.Convert(thickness); this.paint.StrokeJoin = lineJoin.Convert(); if (dashArray != null) { var dashArrayF = dashArray.Select(this.Convert).ToArray(); this.paint.SetPathEffect(new DashPathEffect(dashArrayF, 0f)); } this.paint.AntiAlias = !aliased; }
/// <summary> /// Sets the stroke style. /// </summary> /// <param name="c">The stroke color.</param> /// <param name="thickness">The stroke thickness.</param> /// <param name="dashArray">The dash array.</param> /// <param name="lineJoin">The line join.</param> private void SetStroke(OxyColor c, double thickness, double[] dashArray = null, OxyPenLineJoin lineJoin = OxyPenLineJoin.Miter) { this.gctx.SetStrokeColor(c.ToCGColor()); this.gctx.SetLineWidth((float)thickness); this.gctx.SetLineJoin(lineJoin.Convert()); if (dashArray != null) { var lengths = dashArray.Select(d => (float)d).ToArray(); this.gctx.SetLineDash(0f, lengths); } else { this.gctx.SetLineDash(0, null); } }