Ejemplo n.º 1
0
 /// <summary>
 /// Called once before the first rendering iteration
 /// </summary>
 /// <param name="width">The width of the frame buffer</param>
 /// <param name="height">The height of the frame buffer</param>
 public override void Init(int width, int height)
 {
     Image       = new MonochromeImage(width, height);
     momentImage = new MonochromeImage(width, height);
     meanImage   = new MonochromeImage(width, height);
     bufferImage = new MonochromeImage(width, height);
 }
Ejemplo n.º 2
0
        public void Part2(string filename, long expected)
        {
            var parser = new Parser(filename);
            var tiles  = parser.Parse(new TileFactory())
                         .Where(img => img != null);
            var sut    = new MonochromeImage(tiles);
            var actual = sut.FindSeaMosters();

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 3
0
        public void Part1(string filename, long expected)
        {
            var parser = new Parser(filename);
            var tiles  = parser.Parse(new TileFactory())
                         .Where(img => img != null);
            var sut    = new MonochromeImage(tiles);
            var actual = sut.CornerTiles().Aggregate(1L, (acc, tile) => acc * tile.Id);

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 4
0
 static void Main(string[] args)
 {
     // Calls the Run method on all the example classes
     // The rasterized images will be saved in the applications bin folder by default
     GifWithWebPalette.Run();
     IndexedImage.Run();
     JpegImage.Run();
     MonochromeImage.Run();
     MultiPageTiff.Run();
     PdfPortfolio.Run();
     PngImageWithRgbColor.Run();
     PngImageWithUserPalette.Run();
     RgbaImage.Run();
     TiffImageColorFormat.Run();
 }
Ejemplo n.º 5
0
        public void Clone_GivenMonochromeImage_ShouldReturnNewInstanceWithSameBackgroundColour()
        {
            // Arrange.
            Image initialImage = new MonochromeImage
            {
                BackgroundColour = "black"
            };

            // Act.
            var newImage = initialImage.Clone();

            // Assert.
            Assert.NotNull(newImage);
            Assert.AreNotSame(initialImage, newImage);
            Assert.IsInstanceOf <MonochromeImage>(newImage);
            Assert.AreEqual(initialImage.BackgroundColour, newImage.BackgroundColour);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Called once before the first rendering iteration
 /// </summary>
 /// <param name="width">The width of the frame buffer</param>
 /// <param name="height">The height of the frame buffer</param>
 public override void Init(int width, int height) => Image = new MonochromeImage(width, height);