Beispiel #1
0
        private List <WriteableBitmap> DeduplicateTemps(List <WriteableBitmap> tempTiles)
        {
            var existingFrames = RipAllFrames();
            var comparer       = new BitmapComparer();

            return(tempTiles
                   .Distinct(comparer)
                   .Except(existingFrames.Keys, comparer)
                   .ToList());
        }
Beispiel #2
0
        private Dictionary <int, WriteableBitmap> MapImageIndicesToUnique(List <WriteableBitmap> images, out List <WriteableBitmap> keys)
        {
            var comparer = new BitmapComparer();
            var groups   = images
                           .Select((img, ix) => new { Index = ix, Image = img })
                           .GroupBy(a => a.Image, comparer);

            keys = groups.Select(g => g.Key).ToList();

            return(groups
                   .SelectMany(g => g.Select(a => new { Index = a.Index, First = g.Key }))
                   .ToDictionary(a => a.Index, a => a.First));
        }