Exemple #1
0
        public void ConvertFormat()
        {
            var result = src.ConvertTo(PixelFormat.RGBA8888);

            Assert.IsTrue(PixelBuffer.PixelsEqual(result, src));

            result = src.ConvertTo(src.PixelFormat);
            Assert.IsTrue(PixelBuffer.PixelsEqual(result, src));
        }
Exemple #2
0
        public void ConvertFormatAndChangeSize()
        {
            var result = src.ConvertTo(PixelFormat.RGBA8888, new Size(50, 50));

            result = new PixelBuffer(result, new Rectangle(Point.Zero, src.Size));
            Assert.IsTrue(PixelBuffer.PixelsEqual(result, src));

            result = src.ConvertTo(src.PixelFormat, new Size(50, 50));
            result = new PixelBuffer(result, new Rectangle(Point.Zero, src.Size));
            Assert.IsTrue(PixelBuffer.PixelsEqual(result, src));
        }
Exemple #3
0
        public void ReplaceColor()
        {
            var result = src.ConvertTo(src.PixelFormat);

            result.ReplaceColor(Color.White, Color.Black);

            Assert.IsFalse(PixelBuffer.PixelsEqual(src, result));
            Assert.AreEqual(Color.Black, result.GetPixel(0, 0));

            result.SetPixel(0, 0, Color.White);
            Assert.IsTrue(PixelBuffer.PixelsEqual(src, result));
        }
Exemple #4
0
        public void PixelsEqualSameFormat()
        {
            var result = new PixelBuffer(PixelFormat.ABGR8888, src.Size);

            result.CopyFrom(src, new Rectangle(Point.Zero, src.Size), Point.Zero, false);

            VerifyCopyResult(result);

            Assert.IsTrue(PixelBuffer.PixelsEqual(result, src));

            result.SetPixel(0, 0, Color.Black);

            Assert.IsFalse(PixelBuffer.PixelsEqual(src, result));
        }
Exemple #5
0
 public void PixelsEqualEasyCases()
 {
     Assert.IsFalse(PixelBuffer.PixelsEqual(src, new PixelBuffer(src.PixelFormat, new Size(src.Width, src.Height + 5))));
     Assert.IsFalse(PixelBuffer.PixelsEqual(src, new PixelBuffer(src.PixelFormat, new Size(src.Width, src.Height + 5))));
     Assert.IsTrue(PixelBuffer.PixelsEqual(src, src));
 }