裁剪并旋转捕获的图片Xamarin.Android& Xamarin.iOS [英] Crop and rotate a captured picture Xamarin.Android & Xamarin.iOS

查看:180
本文介绍了裁剪并旋转捕获的图片Xamarin.Android& Xamarin.iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道一个图书馆可以使用Android或iOS智能手机拍照,然后提供裁剪或旋转该图像的视图(因此,没有本机预览)

Anyone knows a library that can take a picture with an Android or iOS smartphone and then offer a view to crop or rotate this image (so, without the native preview)

我使用PCL / Xamarin.Android / Xamarin.iOS(不是Xamarin.Form)

I work with PCL / Xamarin.Android / Xamarin.iOS (Not Xamarin.Form)

推荐答案

您可以使用 FFImageLoading 来裁剪和旋转图像。尝试在您的图像上添加捏合/滑动手势识别器,然后在触发此事件时使用旋转变换来旋转图像:

You can use FFImageLoading to crop and rotate your images. Try to add pinch/swipe gesture recognizer to your images, when this event fires use the rotate transformation to rotate the image:

public RotateTransformation(double degrees, bool ccw, bool resize)
{
    ...
}

和将作物转换为作物图像:

and the Crop Transformation to crop images:

public CropTransformation(double zoomFactor, double xOffset, double yOffset, double cropWidthRatio, double cropHeightRatio)
{
    ...
}

可以在示例中找到每个平台或PCL的更多详细信息代码。但这只为您提供代码,您应该创建自己的界面来完成用户的交互。

More details code can be found in the sample for each platform or PCL. But this only offers you the code, you should create your own interface to complete the user's interaction.

也可以尝试使用其他库,例如:

Also you can try other libraries like:

https://github.com/stormlion227/ImageCropper.Forms
https://github.com/muak/Xamarin.Plugin.ImageEdit

这篇关于裁剪并旋转捕获的图片Xamarin.Android& Xamarin.iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆