Exemple #1
0
        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();
        }
Exemple #2
0
 private void CloseStream(object sender, EventArgs e)
 {
     if (_streamSource == null)
     {
         return;
     }
     _streamSource.Dispose();
     _streamSource = null;
 }
Exemple #3
0
 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()));
 }
Exemple #4
0
        public void Clear()
        {
            _textures.Clear();
            _lastSelectedItem = null;
            _selection.Clear();

            if (_streamSource != null)
            {
                _streamSource.Dispose();
            }
            _streamSource = null;

            OnSelectionChanged(_selection);
        }
Exemple #5
0
        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;
 }
Exemple #8
0
        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();
        }
Exemple #9
0
        public void RemoveAllTextures()
        {
            _textures.Clear();
            _lastSelectedItem = null;
            _selection.Clear();

            if (_streamSource != null) _streamSource.Dispose();
            _streamSource = null;

            OnSelectionChanged(_selection);
            UpdateRectangles();
        }
Exemple #10
0
        public void Clear()
        {
            _textures.Clear();
            _lastSelectedItem = null;
            _selection.Clear();

            if (_streamSource != null) _streamSource.Dispose();
            _streamSource = null;

            OnSelectionChanged(_selection);
        }
Exemple #11
0
        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));
            }
        }