BattleInfoPlugin.Models.Repositories.MapResourceExtensions.ToBitmapFrame C# (CSharp) Метод

ToBitmapFrame() публичный статический Метод

public static ToBitmapFrame ( this tag ) : System.Windows.Media.Imaging.BitmapFrame
tag this
Результат System.Windows.Media.Imaging.BitmapFrame
        public static BitmapFrame ToBitmapFrame(this DefineBitsLosslessTag tag)
        {
            if (tag == null) return null;

            BitmapFrame frame;
            try
            {
                using (var stream = new MemoryStream())
                {
                    tag.GetBitmap().Save(stream, ImageFormat.Png);
                    frame = BitmapFrame.Create(stream,
                        BitmapCreateOptions.IgnoreColorProfile, BitmapCacheOption.OnLoad);
                }
            }
            catch (NotSupportedException)
            {
                return null;
            }
            return frame;
        }