async void ExportImage(object sender, RoutedEventArgs e)
        {
            if (_selection.Width == 0 || _selection.Height == 0)
            {
                MessageDialog md = new MessageDialog(Strings.EmptySelectionMessage);
                await md.ShowAsync();

                return;
            }
            var picker = new FileSavePicker();

            picker.FileTypeChoices.Add("png", new List <string> {
                ".png"
            });
            picker.DefaultFileExtension = ".png";

            StorageFile file = await picker.PickSaveFileAsync();

            if (file != null)
            {
                var cropRect = ((RectD)_selection).Round();
                await _bitmap.SaveAsPngAsync(file, new PngOptions { SourceRect = new ImageRect(cropRect) });

                _selection = new Rect(0, 0, _bitmap.PixelWidth, _bitmap.PixelHeight);
                UpdateMask();
            }
        }
예제 #2
0
        async void ExportImage(object sender, RoutedEventArgs e)
        {
            var picker = new FileSavePicker();

            picker.FileTypeChoices.Add("png", new List <string> {
                ".png"
            });
            picker.DefaultFileExtension = ".png";

            StorageFile file = await picker.PickSaveFileAsync();

            if (file != null)
            {
                await _bitmap.SaveAsPngAsync(file, null);
            }
        }