Exemple #1
0
        public void ApplySepia()
        {
            var oldR = LargeBitmap.GetPixel(0, 0).R;
            var oldG = LargeBitmap.GetPixel(0, 0).G;
            var oldB = LargeBitmap.GetPixel(0, 0).B;
            int newR = (int)(oldR * 0.393f + oldG * 0.769f + oldB * 0.189f);
            int newG = (int)(oldR * 0.349f + oldG * 0.686f + oldB * 0.168f);
            int newB = (int)(oldR * 0.272f + oldG * 0.543f + oldB * 0.131f);

            newR = newR > 255 ? 255 : newR;
            newG = newG > 255 ? 255 : newG;
            newB = newB > 255 ? 255 : newB;
            ImageHandler.ApplySepia(LargeBitmap);
            Assert.AreEqual(newR, LargeBitmap.GetPixel(0, 0).R);
            Assert.AreEqual(newG, LargeBitmap.GetPixel(0, 0).G);
            Assert.AreEqual(newB, LargeBitmap.GetPixel(0, 0).B);
        }