private async void Save() { bool resumePlaybackAfterSave = _animationTimer.IsEnabled; Stop(); SetControlsEnabled(false); ShowProgressIndicator("Saving"); if (_frameEnabled) { await GifExporter.Export(_onScreenImageProviders, _animatedArea.Rect); } else { await GifExporter.Export(_onScreenImageProviders, null); } HideProgressIndicator(); if (resumePlaybackAfterSave) { Play(); } SetControlsEnabled(true); _saveButton.IsEnabled = false; }
private async Task Save() { if (_frameEnabled) { double _imageWidth = (_onScreenImageProviders == _unalignedImageProviders) ? _unalignedImageWidth : _alignedImageWidth; double _imageHeight = (_onScreenImageProviders == _unalignedImageProviders) ? _unalignedImageHeight : _alignedImageHeight; // Scale animated area coordinates from display coordinates to the match the original bitmap size double xScale = _imageWidth / ImageElementBackground.ActualWidth; double yScale = _imageHeight / ImageElementBackground.ActualHeight; Rect frame = new Rect( _animatedArea.Rect.Left * xScale, _animatedArea.Rect.Top * yScale, _animatedArea.Rect.Width * xScale, _animatedArea.Rect.Height * yScale); await GifExporter.Export(_onScreenImageProviders, frame); } else { await GifExporter.Export(_onScreenImageProviders, null); } }