我正在使用插件。媒体从我的画廊中挑选照片。我想为用户提供一个单击图像时旋转图像的选项。
当我使用rotate属性时,我可以旋转图像一次。但是,我希望每次用户单击按钮时将其旋转90度。
if (!CrossMedia.Current.IsPickPhotoSupported)
{
await DisplayAlert("Photos Not Supported", "Permission not granted
to photos", "OK");
return;
}
var file = Plugin.Media.CrossMedia.Current.PickPhotoAsync(new
Plugin.Media.Abstractions.PickMediaOptions
{
PhotoSize = Plugin.Media.Abstractions.PhotoSize.Small
});
if (file == null)
return;
imageProfile.Source = ImageSource.FromStream(() =>
{
var stream = file.Result.GetStream();
file.Result.Dispose();
return stream;
});
public void rotateButton_Clicked(object sender, Event args e) {
imageProfile.RotateX(90);
// This event allows me to rotate the image only once.
}
int angle = 0;
public void rotateButton_Clicked(object sender, Event args e) {
angle += 90;
imageProfile.RotateX(angle);
}