Beispiel #1
0
        public IEnumerable <Tuple <StegoPixel, StegoPixel> > PixelDiff(StegoImage otherImage, Func <StegoPixel, bool> pixelsToCompare = null)
        {
            if (Width != otherImage.Width || Height != otherImage.Height)
            {
                throw new Exception("Images do not share the same dimensions.");
            }

            if (pixelsToCompare == null)
            {
                pixelsToCompare = p => true;
            }

            foreach (var pixel in Pixels.Where(pixelsToCompare))
            {
                var otherPixel = otherImage.GetPixel(pixel.Index);

                if (!pixel.ColorsEqual(otherPixel))
                {
                    yield return(Tuple.Create(pixel, otherPixel));
                }
            }
        }
Beispiel #2
0
        public bool PixelsAreEqual(StegoImage otherImage, Func <StegoPixel, bool> pixelsToCompare = null)
        {
            if (Width != otherImage.Width || Height != otherImage.Height)
            {
                return(false);
            }

            if (pixelsToCompare == null)
            {
                pixelsToCompare = p => true;
            }

            foreach (var pixel in Pixels.Where(pixelsToCompare))
            {
                var otherPixel = otherImage.GetPixel(pixel.Index);

                if (!pixel.ColorsEqual(otherPixel))
                {
                    return(false);
                }
            }

            return(true);
        }