ImageEditor
sunnylqm(100.00%)
本文档贡献者:文档
方法
cropImage()
static cropImage(uri, cropData, success, failure)
根据指定的 URI 参数剪裁对应的图片。如果 URI 指向一个远程图片,则首先会自动下载该图片。如果图片无法下载或读取,则调用failure
回调函数。
如果剪裁成功完成,则剪裁好的图片会被存放在ImageStore
中,同时success
回调函数中返回的 URI 参数会指向 ImageStore 中的此图片。请记得在完成处理逻辑后删除 ImageStore 中的图片。
cropData
offset
- The top-left corner of the cropped image, specified in the original image's coordinate spacesize
- Size (dimensions) of the cropped imagedisplaySize (optional)
- Size to which you want to scale the cropped imageresizeMode (optional)
- Resizing mode to use when scaling the image
cropData = {
offset: {x: number, y: number},
size: {width: number, height: number},
displaySize: {width: number, height: number},
resizeMode: 'contain/cover/stretch',
};