private void RegionDeterminerUserControl_OnSelectedRegionCompleted(object sender, Int32Rect selectedRect) { if (RegionDeterminerUserControl.BmpSource != null) { CroppedImage.Source = new CroppedBitmap(RegionDeterminerUserControl.BmpSource, selectedRect); } if (selectedRect.Width < 10 || selectedRect.Height < 10) { RegionDeterminerUserControl.ResetSelection(); } }
private void LoadImageFromCurrentIndex(bool isShowOnImgScene) { if (_imageInfoList[_currentImageIndex] == null) { return; } Dispatcher.Invoke(() => { // Thumbnail of current image ThumbnailImage.Source = _imageInfoList[_currentImageIndex].BitmapSource; // Load original image from current image if (_originalBitmap != null) { _originalBitmap.Dispose(); } _originalBitmap = Util.Get24BppRgb(_imageInfoList[_currentImageIndex].ImagePath); // Change original image ApplyFilters(ref _originalBitmap); if (!RegionDeterminerUserControl.SelectedRegion.IsEmpty) { RegionDeterminerUserControl.ResetSelection(); } if (isShowOnImgScene) { // Show changed image RegionDeterminerUserControl.BmpSource = Util.BitmapToBitmapImage( ref _originalBitmap, BitmapCacheOption.OnLoad, BitmapCreateOptions.DelayCreation); } if (IsResized.IsChecked == null || !IsResized.IsChecked.Value) { NewWidthTextBox.Text = $"{_originalBitmap.Width}"; } SizeStatusTextBlock.Text = $"{_originalBitmap.Height}"; ImageInfoTextBlock.Text = string.Format("[{0}/{1}] {2}", _currentImageIndex + 1, _imageInfoList.Count, _imageInfoList[_currentImageIndex].ImagePath); }); }