1using CommunityToolkit.Mvvm.ComponentModel;
2using CommunityToolkit.Mvvm.Input;
4using System.Threading.Tasks;
43 await base.OnAppearingAsync();
48 this.ImageCropperView.ImageSource = this.args.Source;
51 if (this.args?.OutputResolution is not
null && this.
ImageCropperView is not
null)
53 this.ImageCropperView.OutputMaxResolution = this.args.OutputResolution.Value;
58 this.ImageCropperView.CropMode = this.args.CropMode;
67 private async Task CropAsync()
76 this.args.CompletionSource?.TrySetResult(CroppedResult);
87 private async Task CancelAsync()
89 this.args?.CompletionSource?.SetResult(
null);
98 private Task RotateAsync()
103 double NewRotation = this.ImageCropperView.RotationAngle + 90;
105 this.ImageCropperView.RotationAngle = NewRotation % 360;
107 return Task.CompletedTask;
A custom view that displays an image with pinch-zoom, pan, and rotation support, and allows cropping ...
byte?[] PerformCrop()
Performs cropping of the image using the current pan, zoom, and rotation transformations....
A base class for all view models, inheriting from the BindableObject. NOTE: using this class requir...
virtual async Task GoBack()
Method called when user wants to navigate to the previous screen.
Holds navigation parameters for opening the Image Cropping page.
The ViewModel for ImageCroppingPage. Handles cropping commands and navigation logic.
ImageCroppingViewModel(ImageCroppingNavigationArgs? args)
Initializes a new instance of the ImageCroppingViewModel class.
override async Task OnAppearingAsync()
Called when the page appears. Assigns the incoming source to the cropper control.
CropMode
Specifies how the image should be cropped.