Esempio n. 1
0
        public static ImageSource ResourceImageSource(string imageName, double scale)
        {
            using (Bitmap img = IconSets.ResourceBitmap(imageName))
            {
                if (img == null)
                {
                    return(null);
                }

                Size smallSize = ImageConverters.ScaleImage(img.Width, img.Height, scale);

                using (Bitmap resized = new Bitmap(img, smallSize))
                {
                    return(ImageConverters.ConvertToImageSource(resized));
                }
            }
        }
Esempio n. 2
0
        public static ImageSource LoadFromFile(string path)
        {
            Bitmap bmp = new Bitmap(path);

            return(ImageConverters.ConvertToImageSource(bmp));
        }