注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

沉默蜂B4A安卓编程

国内资料最全的B4A资料库

 
 
 

日志

 
 

图片编辑剪裁库  

2014-08-17 12:59:08|  分类: 图形图像 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
感谢上海网友“马里奥”的翻译

[Library] RSCrop - Crop images with gallery 对图库中图片进行编辑剪裁


For an app i'm developing, I needed to let the user crop a piece of a bitmap to use in my app.
在我最近开发的一个应用中,我需要用户去裁减原始图片以捕获新的图片

I stumbled on this thread: http://www.basic4ppc.com/forum/basic4android-updates-questions/19550-resize-crop.html
but it lacked some features like pinching, rectangular cropping, resizing, zoom and panning and more.

我偶然发现了这个帖子,但是它缺少一些功能,包括双手指缩放、矩形剪裁、重设大小、缩放、平移及其他。
After some googling, i figured out that you could send an intent to the default media gallery to let it crop your images.
我又搜索了网络,我发现可以先发送意图(Android语法中的Intent,Activity页面之间切换都需要Intent)到系统默认的媒体库中来剪裁图片。

It opens your gallery where you select your image and then the cropping activity opens. After the cropping is done, an event is raised with the Path and a success boolean.
打开你的图库,选中你需要操作的图片,之后剪裁页面打开。当操作完成后,触发剪裁完成事件,返回图片路径及成功与否的布尔值。
3 Functions are needed to get you going:
你需要写3个函数


库 RSCrop > 类 RSCrop > 方法 cropImage 

cropImage ( aspectX As int, aspectY As int, outputX As int, outputY As int, scale As boolean, return_data As boolean, faceDetection As boolean, circleCrop As boolean ) 

Crops an image with the standard media gallery.
从默认图库中选择图片并进行剪裁
aspectX: - Set this to define the X aspect ratio of the shape 设置图形X方向的比例大小
aspectY: - Set this to define the Y aspect ratio of the shape 设置图形Y方向的比例大小
outputX: - Set this to define the max size of the output bitmap 设置输出图形的X方向最大尺寸
outputY: - Set this to define the max size of the output bitmap 设置输出图形的Y方向最大尺寸
scale: - should it scale 是否允许缩放图片
return_data: - Return the bitmap with Action=inline-data by using the data (是否保留原始图片?这个不大明白)
faceDetection: 朝向(应该是横屏还是竖屏吗?)
circleCrop: - if this string is not null, it will provide some circular crop 是否提供圆形剪裁


库 RSCrop > 类 RSCrop > 方法 cropImage2 

cropImage2 ( scale As boolean, return_data As boolean, faceDetection As boolean, circleCrop As boolean ) 
Crops an image with the standard media gallery. 
Difference is that you can use a rectangular crop with this.与上个函数不同的是,这个你可以用矩形剪裁。 
scale: - should it scale 
return_data: - Return the bitmap with Action=inline-data by using the data 
faceDetection: 
circleCrop: - if this string is not null, it will provide some circular crop


库 RSCrop > 类 RSCrop > 方法 cropImage3 

cropImage3 ( scale As boolean, return_data As boolean, faceDetection As boolean, circleCrop As boolean, btmp As Bitmap ) 
Crops an image with the standard media gallery. 
Difference is that you can preselect a bitmap with this. 与上个函数不同的是,这个你可以先通过其他方法提前获取图片,然后将获取图片作为参数传入本剪裁函数。
scale: - should it scale return_data: - Return the bitmap with Action=inline-data by using the data 
faceDetection: 
circleCrop: - if this string is not null, it will provide some circular crop


库 RSCrop > 类 RSCrop > 方法 Initialize 

Initialize ( EventName As String, FileName As String ) 
Initializes the RSCrop Library. 初始化RSCrop 库
EventName - Events subs prefix. 
Events: "Cropped (Success As Boolean, Path as String)"


  评论这张
 
阅读(172)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017