public void SetTextureList(IEnumerable <TextureItem> textures) { _textures.Clear(); _lastSelectedItem = null; _selection.Clear(); _textures.AddRange(textures); var packs = _textures.Select(t => t.Package).Distinct(); if (_streamSource != null) { _streamSource.Dispose(); } if (DocumentManager.CurrentDocument == null) { _streamSource = null; } else { _streamSource = DocumentManager.CurrentDocument.TextureCollection.GetStreamSource(_imageSize, _imageSize, packs); } OnSelectionChanged(_selection); UpdateRectangles(); }
private void CloseStream(object sender, EventArgs e) { if (_streamSource == null) { return; } _streamSource.Dispose(); _streamSource = null; }
private void OpenStream(object sender, EventArgs e) { if (DocumentManager.CurrentDocument == null || !DocumentManager.CurrentDocument.TextureCollection.Packages.Any()) { return; } _streamSource = DocumentManager.CurrentDocument.TextureCollection.GetStreamSource(64, 64, _packages.Union(DocumentManager.CurrentDocument.TextureCollection.GetRecentTextures().Select(x => x.Package).Distinct())); }
public void Clear() { _textures.Clear(); _lastSelectedItem = null; _selection.Clear(); if (_streamSource != null) { _streamSource.Dispose(); } _streamSource = null; OnSelectionChanged(_selection); }
public void RemoveAllTextures() { _textures.Clear(); _lastSelectedItem = null; _selection.Clear(); if (_streamSource != null) { _streamSource.Dispose(); } _streamSource = null; OnSelectionChanged(_selection); UpdateRectangles(); }
private void OpenStream(object sender, EventArgs e) { if (DocumentManager.CurrentDocument == null || !DocumentManager.CurrentDocument.TextureCollection.Packages.Any()) return; _streamSource = DocumentManager.CurrentDocument.TextureCollection.GetStreamSource( _packages.Union(DocumentManager.CurrentDocument.TextureCollection.GetRecentTextures().Select(x => x.Package).Distinct())); }
private void CloseStream(object sender, EventArgs e) { if (_streamSource == null) return; _streamSource.Dispose(); _streamSource = null; }
public void SetTextureList(IEnumerable<TextureItem> textures) { _textures.Clear(); _lastSelectedItem = null; _selection.Clear(); _textures.AddRange(textures); var packs = _textures.Select(t => t.Package).Distinct(); if (_streamSource != null) _streamSource.Dispose(); if (DocumentManager.CurrentDocument == null) _streamSource = null; else _streamSource = DocumentManager.CurrentDocument.TextureCollection.GetStreamSource(_imageSize, _imageSize, packs); OnSelectionChanged(_selection); UpdateRectangles(); }
public void RemoveAllTextures() { _textures.Clear(); _lastSelectedItem = null; _selection.Clear(); if (_streamSource != null) _streamSource.Dispose(); _streamSource = null; OnSelectionChanged(_selection); UpdateRectangles(); }
public void Clear() { _textures.Clear(); _lastSelectedItem = null; _selection.Clear(); if (_streamSource != null) _streamSource.Dispose(); _streamSource = null; OnSelectionChanged(_selection); }
private async Task <IResource> UploadTexture(IEnvironment environment, TextureItem item, ITextureStreamSource source) { using (var bitmap = await source.GetImage(item.Name, 512, 512)) { var lb = bitmap.LockBits(new Rectangle(0, 0, item.Width, item.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); var data = new byte[lb.Stride * lb.Height]; Marshal.Copy(lb.Scan0, data, 0, data.Length); bitmap.UnlockBits(lb); return(_engine.Value.UploadTexture($"{environment.ID}::{item.Name}", bitmap.Width, bitmap.Height, data, TextureSampleType.Standard)); } }