Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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");
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        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));
            }
        }
Ejemplo n.º 6
0
 /// <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));
Ejemplo n.º 7
0
 /// <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));