public override IPen ToPen(float scale) { float width = scale * Width; IPen pen = null; switch (DashStyle) { case DashStyle.Solid: pen = Pens.Solid(Color, width); break; case DashStyle.Dash: pen = Pens.Dash(Color, width); break; case DashStyle.Dot: pen = Pens.Dot(Color, width); break; case DashStyle.DashDot: pen = Pens.DashDot(Color, width); break; case DashStyle.DashDotDot: pen = Pens.DashDotDot(Color, width); break; } return(pen); }
public void DrawLines_DashDotDot <TPixel>(TestImageProvider <TPixel> provider, string colorName, float alpha, float thickness, bool antialias) where TPixel : unmanaged, IPixel <TPixel> { Color color = TestUtils.GetColorByName(colorName).WithAlpha(alpha); Pen pen = Pens.DashDotDot(color, thickness); DrawLinesImpl(provider, colorName, alpha, thickness, antialias, pen); }
public void ImageShouldBeOverlayedByPathDashDotDot() { string path = TestEnvironment.CreateOutputDirectory("Drawing", "Lines"); var image = new Image <Rgba32>(500, 500); image.Mutate(x => x .BackgroundColor(Rgba32.Blue) .DrawLines(Pens.DashDotDot(Rgba32.HotPink, 5), new SixLabors.Primitives.PointF[] { new Vector2(10, 10), new Vector2(200, 150), new Vector2(50, 300) })); image.Save($"{path}/DashDotDot.png"); }
public void ImageShouldBeOverlayedByPathDashDotDot() { string path = CreateOutputDirectory("Drawing", "Lines"); var image = new Image(500, 500); using (FileStream output = File.OpenWrite($"{path}/DashDotDot.png")) { image .BackgroundColor(Color.Blue) .DrawLines(Pens.DashDotDot(Color.HotPink, 5), new[] { new Vector2(10, 10), new Vector2(200, 150), new Vector2(50, 300) }) .Save(output); } }
public static IPen GetPen(this Cmdlet cmdlet, Pen penType, float width, string colorString) { Rgba32 rgbaColor = cmdlet.ParseColor(colorString); Color color = new Color(rgbaColor); switch (penType) { case Pen.Dash: return(Pens.Dash(color, width)); case Pen.DashDot: return(Pens.DashDot(color, width)); case Pen.DashDotDot: return(Pens.DashDotDot(color, width)); case Pen.Dot: return(Pens.Dot(color, width)); default: return(Pens.Solid(color, width)); } }
/// <summary> /// Create a pen with a 'Dash Dot Dot' drawing patterns /// </summary> /// <param name="brush">The brush.</param> /// <param name="width">The width.</param> /// <returns>The Pen</returns> public static Pen DashDotDot(IBrush <Color> brush, float width) => new Pen(Pens <Color> .DashDotDot(brush, width));
/// <summary> /// Create a pen with a 'Dash Dot Dot' drawing patterns /// </summary> /// <param name="color">The color.</param> /// <param name="width">The width.</param> /// <returns>The Pen</returns> public static Pen DashDotDot(Color color, float width) => new Pen(Pens <Color> .DashDotDot(color, width));