예제 #1
0
 public Bitmap GetImage(TextureItem item)
 {
     lock (PlaceholderImage)
     {
         return(new Bitmap(PlaceholderImage));
     }
 }
예제 #2
0
 public Bitmap GetImage(TextureItem item)
 {
     using (var stream = _streams.First(x => x.HasFile(item.Name.ToLowerInvariant())).OpenFile(item.Name.ToLowerInvariant()))
     {
         bool hasTransparency;
         return(PostProcessBitmap(item.Package.PackageRelativePath, item.Name.ToLowerInvariant(), new Bitmap(stream), out hasTransparency));
     }
 }
예제 #3
0
 public void AddTexture(TextureItem item)
 {
     if (Items.ContainsKey(item.Name.ToLowerInvariant()))
     {
         return;
     }
     Items.Add(item.Name.ToLowerInvariant(), item);
 }
예제 #4
0
 public static void LoadTextureItem(TextureItem item)
 {
     if (item == null || item.Package == null)
     {
         return;
     }
     item.Package.Provider.LoadTextures(new[] { item });
 }
예제 #5
0
 public Bitmap GetImage(TextureItem item)
 {
     foreach (var ss in _streams)
     {
         if (ss.HasImage(item))
         {
             return(ss.GetImage(item));
         }
     }
     return(null);
 }
예제 #6
0
 public Bitmap GetImage(TextureItem item)
 {
     foreach (var root in item.Package.PackageRoot.Split(';'))
     {
         var file = Path.Combine(root, item.Name);
         if (File.Exists(file))
         {
             return(Parse(file));
         }
     }
     return(null);
 }
예제 #7
0
 public TextureCollection(List <TexturePackage> packages)
 {
     _packages = packages;
     _items    = new Dictionary <string, TextureItem>();
     foreach (var item in packages.SelectMany(x => x.Items))
     {
         var k = item.Key.ToLowerInvariant();
         if (!_items.ContainsKey(k))
         {
             _items.Add(k, item.Value);
         }
     }
     _recentTextures = new List <TextureItem>();
     SelectedTexture = GetDefaultSelection();
 }
예제 #8
0
            public Bitmap GetImage(TextureItem item)
            {
                var root = _roots.FirstOrDefault(x => x.HasFile(item.PrimarySubItem.Name));

                if (root == null)
                {
                    return(null);
                }
                var stream = root.OpenFile(item.PrimarySubItem.Name);

                if (stream == null)
                {
                    return(null);
                }

                using (stream)
                {
                    return(Vtf.VtfProvider.GetImage(stream, _maxWidth, _maxHeight));
                }
            }
예제 #9
0
 public bool HasImage(TextureItem item)
 {
     return(_streams.Any(x => x.HasFile(item.Name.ToLowerInvariant())));
 }
예제 #10
0
 public bool HasImage(TextureItem item)
 {
     return(_packages.Any(x => x.Items.ContainsValue(item)));
 }
예제 #11
0
 public bool HasImage(TextureItem item)
 {
     return(_roots.Any(x => x.HasFile(item.PrimarySubItem.Name)));
 }
예제 #12
0
 public bool HasImage(TextureItem item)
 {
     return(_streams.Any(x => x.HasImage(item)));
 }
예제 #13
0
 public bool HasImage(TextureItem item)
 {
     return(item.Flags.HasFlag(TextureFlags.Missing));
 }