Exemplo n.º 1
0
        public void Dispose()
        {
            _cl?.Dispose();
            _cl = null;

            shadow?.Dispose();
            shadow = null;
        }
        public async Task Hide()
        {
            ((App)(App.Current)).BackRequested -= PhotoPreviewView_BackRequested;
            SizeChanged           -= PhotoPreviewView_SizeChanged;
            ImageRoot.SizeChanged -= ImageRoot_SizeChanged;

            IsVisible = false;

            var splitChar = _photo.IsLocal ? '\\' : '/';
            var filename  = (_photo.Uri.Split(splitChar).LastOrDefault()?.Split('.').FirstOrDefault() ?? "");

            var saveInkTask          = Inker.SaveInkToFile($"ink_{filename}.gif");
            var saveThumbnailTask    = InkHelpers.RenderImageWithInkToFileAsync(Inker, await _file.OpenReadAsync(), $"thumb_{filename}.jpg");
            var closingAnimationTask = Root.Scale(1.2f, 1.2f, (float)ActualWidth / 2, (float)ActualHeight / 2).Fade(0).StartAsync();

            await Task.WhenAll(saveInkTask, closingAnimationTask, saveThumbnailTask);

            _photo.InkUri       = saveInkTask.Result ?? _photo.InkUri;
            _photo.ThumbnailUri = saveThumbnailTask.Result ?? _photo.ThumbnailUri;


            Root.Visibility = Visibility.Collapsed;

            _canvasImage.Dispose();
            _canvasImage = null;

            _photo = null;
            _file  = null;

            ImageCanvas.Invalidate();

            FinishedHiding?.Invoke(this, null);

            _tags.Clear();
            _knownFaces.Clear();
            _facePanels.Clear();
            FaceCanvas.Children.Clear();

            if (Description != null)
            {
                Description.Text = "";
            }

            _effectsGenerator = null;

            FiltersButton.IsChecked = false;
            DetailsButton.IsChecked = false;
            InkButton.IsChecked     = false;
            Inker.InkPresenter.StrokeContainer.Clear();

            _photoInfoInitialized = false;

            if (EffectsView != null)
            {
                EffectsView.Visibility = Visibility.Collapsed;
                _effects.Clear();
            }
        }
Exemplo n.º 3
0
 public void Dispose()
 {
     _cl?.Dispose();
     _cl = null;
     morphology?.Dispose();
     morphology = null;
     blur?.Dispose();
     blur = null;
 }
Exemplo n.º 4
0
        private void _setup(ICanvasImage source, float amount, Color shadowColor)
        {
            if (_cl != null)
            {
                _cl.Dispose(); _cl = null;
            }
            _cl = source;

            shadow.Source      = _cl;
            shadow.BlurAmount  = amount;
            shadow.ShadowColor = shadowColor;
        }
Exemplo n.º 5
0
        private void _setup(ICanvasImage source, float amount)
        {
            if (amount == 0)
            {
                return;
            }

            if (_cl != null)
            {
                _cl.Dispose(); _cl = null;
            }
            _cl = source;

            morphology.Source = _cl;

            var halfAmount = Math.Min(amount / 2, 100);

            morphology.Width  = (int)Math.Ceiling(halfAmount);
            morphology.Height = (int)Math.Ceiling(halfAmount);
            blur.BlurAmount   = halfAmount;
        }