private void NewCommand(object sender, ExecutedRoutedEventArgs e) { var dlog = new NewDocument { Owner = this }; var result = dlog.ShowDialog(); if (!result.HasValue || !result.Value) { return; } var bmp = new WriteableBitmap( dlog.ViewModel.Width, dlog.ViewModel.Height, 96, 96, PixelFormats.Bgr32, null); _picture = new Picture(dlog.ViewModel.Name, bmp); Title = _picture.Name; ViewModel.Document = new ReversibleDocument<IPicture>(_picture); ViewModel.AccessPolicy = new PictureAccessPolicy(_picture); _image.Source = bmp; _image.Stretch = Stretch.None; RenderOptions.SetBitmapScalingMode(_image, BitmapScalingMode.NearestNeighbor); RenderOptions.SetEdgeMode(_image, EdgeMode.Aliased); }
private void NewCommand(object sender, ExecutedRoutedEventArgs e) { var dlog = new NewDocument { Owner = this }; var result = dlog.ShowDialog(); if (!result.HasValue || !result.Value) { return; } var bmp = new WriteableBitmap( dlog.ViewModel.Width, dlog.ViewModel.Height, 96, 96, PixelFormats.Bgr32, null); _picture = new Picture(dlog.ViewModel.Name, bmp); Title = _picture.Name; ViewModel.Document = new ReversibleDocument <IPicture>(_picture); ViewModel.AccessPolicy = new PictureAccessPolicy(_picture); _image.Source = bmp; _image.Stretch = Stretch.None; RenderOptions.SetBitmapScalingMode(_image, BitmapScalingMode.NearestNeighbor); RenderOptions.SetEdgeMode(_image, EdgeMode.Aliased); }