示例#1
0
        public static IBrush GetBrush(this Cmdlet cmdlet, Brush brushType, string colorString, string backgroundString)
        {
            Rgba32 rgbaColor      = cmdlet.ParseColor(colorString);
            Rgba32 rgbaBackground = cmdlet.ParseColor(backgroundString);
            Color  color          = new Color(rgbaColor);
            Color  background     = new Color(rgbaBackground);

            switch (brushType)
            {
            case Brush.Horizontal:
                return(Brushes.Horizontal(color, background));

            case Brush.Vertical:
                return(Brushes.Vertical(color, background));

            case Brush.ForwardDiagonal:
                return(Brushes.ForwardDiagonal(color, background));

            case Brush.BackwardDiagonal:
                return(Brushes.BackwardDiagonal(color, background));

            case Brush.Min:
                return(Brushes.Min(color, background));

            case Brush.Percent10:
                return(Brushes.Percent10(color, background));

            case Brush.Percent20:
                return(Brushes.Percent20(color, background));

            default:
                return(Brushes.Solid(color));
            }
        }
示例#2
0
 public void ImageShouldBeFloodFilledWithForwardDiagonal_transparent()
 {
     Test("ForwardDiagonal_Transparent", Color.Blue, Brushes.ForwardDiagonal(Color.HotPink),
          new Color[, ] {
         { Color.HotPink, Color.Blue, Color.Blue, Color.Blue },
         { Color.Blue, Color.HotPink, Color.Blue, Color.Blue },
         { Color.Blue, Color.Blue, Color.HotPink, Color.Blue },
         { Color.Blue, Color.Blue, Color.Blue, Color.HotPink }
     });
 }
示例#3
0
 public void ImageShouldBeFloodFilledWithForwardDiagonal()
 {
     Test("ForwardDiagonal", Color.Blue, Brushes.ForwardDiagonal(Color.HotPink, Color.LimeGreen),
          new Color[, ] {
         { Color.HotPink, Color.LimeGreen, Color.LimeGreen, Color.LimeGreen },
         { Color.LimeGreen, Color.HotPink, Color.LimeGreen, Color.LimeGreen },
         { Color.LimeGreen, Color.LimeGreen, Color.HotPink, Color.LimeGreen },
         { Color.LimeGreen, Color.LimeGreen, Color.LimeGreen, Color.HotPink }
     });
 }
示例#4
0
 public void ImageShouldBeFloodFilledWithForwardDiagonal_transparent()
 {
     Test("ForwardDiagonal_Transparent", Rgba32.Blue, Brushes.ForwardDiagonal(Rgba32.HotPink),
          new Rgba32[, ] {
         { Rgba32.Blue, Rgba32.Blue, Rgba32.Blue, Rgba32.HotPink },
         { Rgba32.Blue, Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue },
         { Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue },
         { Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue, Rgba32.Blue }
     });
 }
示例#5
0
 public void ImageShouldBeFloodFilledWithForwardDiagonal()
 {
     Test("ForwardDiagonal", Rgba32.Blue, Brushes.ForwardDiagonal(Rgba32.HotPink, Rgba32.LimeGreen),
          new Rgba32[, ] {
         { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.HotPink },
         { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen },
         { Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen },
         { Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen }
     });
 }
示例#6
0
        public void ImageShouldBeFloodFilledWithForwardDiagonal_transparent()
        {
            var expectedPattern = new Rgba32[, ]
            {
                { Color.Blue, Color.Blue, Color.Blue, Color.HotPink },
                { Color.Blue, Color.Blue, Color.HotPink, Color.Blue },
                { Color.Blue, Color.HotPink, Color.Blue, Color.Blue },
                { Color.HotPink, Color.Blue, Color.Blue, Color.Blue }
            };

            this.Test(
                "ForwardDiagonal_Transparent",
                Color.Blue,
                Brushes.ForwardDiagonal(Color.HotPink),
                expectedPattern);
        }
示例#7
0
        public void ImageShouldBeFloodFilledWithForwardDiagonal()
        {
            var expectedPattern = new Rgba32[, ]
            {
                { Color.LimeGreen, Color.LimeGreen, Color.LimeGreen, Color.HotPink },
                { Color.LimeGreen, Color.LimeGreen, Color.HotPink, Color.LimeGreen },
                { Color.LimeGreen, Color.HotPink, Color.LimeGreen, Color.LimeGreen },
                { Color.HotPink, Color.LimeGreen, Color.LimeGreen, Color.LimeGreen }
            };

            this.Test(
                "ForwardDiagonal",
                Color.Blue,
                Brushes.ForwardDiagonal(Color.HotPink, Color.LimeGreen),
                expectedPattern);
        }
 /// <summary>
 /// Create as brush that will paint a Forward Diagonal Hatch Pattern with
 /// in the specified foreground and background colors
 /// </summary>
 /// <param name="foreColor">Color of the foreground.</param>
 /// <param name="backColor">Color of the background.</param>
 /// <returns>A Brush</returns>
 public static PatternBrush ForwardDiagonal(Color foreColor, Color backColor)
 => new PatternBrush(Brushes <Color> .ForwardDiagonal(foreColor, backColor));
 /// <summary>
 /// Create as brush that will paint a Forward Diagonal Hatch Pattern with
 /// in the specified foreground color and a transparent background
 /// </summary>
 /// <param name="foreColor">Color of the foreground.</param>
 /// <returns>A Brush</returns>
 public static PatternBrush ForwardDiagonal(Color foreColor)
 => new PatternBrush(Brushes <Color> .ForwardDiagonal(foreColor, Color.Transparent));