示例#1
0
        public static IcnsImage GetImage(Stream stream)
        {
            IcnsElement[]    icnsContents = ReadImage(stream);
            List <IcnsImage> result       = IcnsDecoder.DecodeAllImages(icnsContents);

            if (result.Count <= 0)
            {
                throw new NotSupportedException("No icons in ICNS file");
            }

            IcnsImage max = null;

            foreach (IcnsImage bitmap in result)
            {
                if (bitmap.Bitmap != null && (max == null || (bitmap.Bitmap.Width > bitmap.Bitmap.Height)))
                {
                    max = bitmap;
                }
            }

            return(max);
        }
示例#2
0
 public static List <IcnsImage> GetImages(Stream stream)
 {
     IcnsElement[] icnsContents = ReadImage(stream);
     return(IcnsDecoder.DecodeAllImages(icnsContents));
 }