Accord.Imaging.Tests.UnmanagedImageTest.SetPixelsTest C# (CSharp) Method

SetPixelsTest() private method

private SetPixelsTest ( PixelFormat pixelFormat ) : void
pixelFormat PixelFormat
return void
        public void SetPixelsTest(PixelFormat pixelFormat)
        {
            UnmanagedImage image = UnmanagedImage.Create(320, 240, pixelFormat);
            Color color = Color.White;
            List<IntPoint> points = new List<IntPoint>();

            points.Add(new IntPoint(0, 0));
            points.Add(new IntPoint(319, 0));
            points.Add(new IntPoint(0, 239));
            points.Add(new IntPoint(319, 239));
            points.Add(new IntPoint(160, 120));

            points.Add(new IntPoint(-1, -1));
            points.Add(new IntPoint(320, 0));
            points.Add(new IntPoint(0, 240));
            points.Add(new IntPoint(320, 240));

            image.SetPixels(points, color);

            List<IntPoint> pixels = image.CollectActivePixels();

            Assert.AreEqual(5, pixels.Count);

            Assert.IsTrue(pixels.Contains(new IntPoint(0, 0)));
            Assert.IsTrue(pixels.Contains(new IntPoint(319, 0)));
            Assert.IsTrue(pixels.Contains(new IntPoint(0, 239)));
            Assert.IsTrue(pixels.Contains(new IntPoint(319, 239)));
            Assert.IsTrue(pixels.Contains(new IntPoint(160, 120)));
        }