Exemple #1
0
        public BitmapSource GetNormalImageSource(Rectangle section, bool flipX = false, bool flipY = false)
        {
            BitmapSource source;
            Bitmap       bmp;

            if (StandardSourceCache.TryGetValue(new CacheKey(section, flipX, flipY), out source))
            {
                return(source);
            }
            else
            {
                bmp = CropImage(StandardBitmap, section);
                if (flipX)
                {
                    bmp.RotateFlip(RotateFlipType.RotateNoneFlipX);
                }
                if (flipY)
                {
                    bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
                }


                source = Extensions.ImageExtensions.ToBitmapSource(bmp);
                StandardSourceCache.Add(new CacheKey(section, flipX, flipY), source);
                return(source);
            }
        }
Exemple #2
0
 private void DisposeSourceCache()
 {
     if (null == StandardSourceCache)
     {
         return;
     }
     StandardSourceCache.Clear();
 }