Beispiel #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));
            }
        }
Beispiel #2
0
 public void ImageShouldBeFloodFilledWithBackwardDiagonal_transparent()
 {
     Test("BackwardDiagonal_Transparent", Color.Blue, Brushes.BackwardDiagonal(Color.HotPink),
          new Color[, ] {
         { 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 }
     });
 }
Beispiel #3
0
 public void ImageShouldBeFloodFilledWithBackwardDiagonal()
 {
     Test("BackwardDiagonal", Color.Blue, Brushes.BackwardDiagonal(Color.HotPink, Color.LimeGreen),
          new Color[, ] {
         { 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 }
     });
 }
Beispiel #4
0
 public void ImageShouldBeFloodFilledWithBackwardDiagonal_transparent()
 {
     Test("BackwardDiagonal_Transparent", Rgba32.Blue, Brushes.BackwardDiagonal(Rgba32.HotPink),
          new Rgba32[, ] {
         { Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue, Rgba32.Blue },
         { Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue },
         { Rgba32.Blue, Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue },
         { Rgba32.Blue, Rgba32.Blue, Rgba32.Blue, Rgba32.HotPink }
     });
 }
Beispiel #5
0
 public void ImageShouldBeFloodFilledWithBackwardDiagonal()
 {
     Test("BackwardDiagonal", Rgba32.Blue, Brushes.BackwardDiagonal(Rgba32.HotPink, Rgba32.LimeGreen),
          new Rgba32[, ] {
         { Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen },
         { Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen },
         { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen },
         { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.HotPink }
     });
 }
Beispiel #6
0
        public void ImageShouldBeFloodFilledWithBackwardDiagonal_transparent()
        {
            var expectedPattern = new Rgba32[, ]
            {
                { 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 }
            };

            this.Test(
                "BackwardDiagonal_Transparent",
                Color.Blue,
                Brushes.BackwardDiagonal(Color.HotPink),
                expectedPattern);
        }
Beispiel #7
0
        public void ImageShouldBeFloodFilledWithBackwardDiagonal()
        {
            var expectedPattern = new Rgba32[, ]
            {
                { 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 }
            };

            this.Test(
                "BackwardDiagonal",
                Color.Blue,
                Brushes.BackwardDiagonal(Color.HotPink, Color.LimeGreen),
                expectedPattern);
        }
 /// <summary>
 /// Create as brush that will paint a Backward 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 BackwardDiagonal(Color foreColor, Color backColor)
 => new PatternBrush(Brushes <Color> .BackwardDiagonal(foreColor, backColor));
 /// <summary>
 /// Create as brush that will paint a Backward 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 BackwardDiagonal(Color foreColor)
 => new PatternBrush(Brushes <Color> .BackwardDiagonal(foreColor, Color.Transparent));