Exemplo n.º 1
0
        static public BitmapImage DownloadImage(Uri filename, FileExtensionFilter filter)
        {
            if (filter.CheckExtensionMath(filename.ToString()) != "")
            {
                var image = new BitmapImage();

                image.BeginInit();
                image.UriSource   = filename;
                image.CacheOption = BitmapCacheOption.OnLoad;
                image.EndInit();
                return(image);
            }
            throw new ArgumentException("Image not found!");
        }
Exemplo n.º 2
0
        static private BitmapEncoder GetEncoder(string file, FileExtensionFilter filter)
        {
            var encoderType = filter.CheckExtensionMath(file);

            if (encoderType == ".gif")
            {
                return(new GifBitmapEncoder());
            }
            else if (encoderType == ".bmp")
            {
                return(new BmpBitmapEncoder());
            }
            else if (encoderType == ".png")
            {
                return(new PngBitmapEncoder());
            }
            else
            {
                return(new JpegBitmapEncoder());
            }
        }
Exemplo n.º 3
0
 public ImageCollectionLoader(string path, FileExtensionFilter filter)
 {
     _path   = path;
     Filter  = filter;
     _images = new List <Image>();
 }