public Bitmap GetImage(TextureItem item) { lock (PlaceholderImage) { return(new Bitmap(PlaceholderImage)); } }
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)); } }
public void AddTexture(TextureItem item) { if (Items.ContainsKey(item.Name.ToLowerInvariant())) { return; } Items.Add(item.Name.ToLowerInvariant(), item); }
public static void LoadTextureItem(TextureItem item) { if (item == null || item.Package == null) { return; } item.Package.Provider.LoadTextures(new[] { item }); }
public Bitmap GetImage(TextureItem item) { foreach (var ss in _streams) { if (ss.HasImage(item)) { return(ss.GetImage(item)); } } return(null); }
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); }
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(); }
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)); } }
public bool HasImage(TextureItem item) { return(_streams.Any(x => x.HasFile(item.Name.ToLowerInvariant()))); }
public bool HasImage(TextureItem item) { return(_packages.Any(x => x.Items.ContainsValue(item))); }
public bool HasImage(TextureItem item) { return(_roots.Any(x => x.HasFile(item.PrimarySubItem.Name))); }
public bool HasImage(TextureItem item) { return(_streams.Any(x => x.HasImage(item))); }
public bool HasImage(TextureItem item) { return(item.Flags.HasFlag(TextureFlags.Missing)); }