# Ohos-CutOut **Repository Path**: chinasoft3_ohos/Ohos-CutOut ## Basic Information - **Project Name**: Ohos-CutOut - **Description**: 对图片进行裁剪,旋转,涂鸦,渲染等效果 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 2 - **Created**: 2021-05-26 - **Last Updated**: 2024-11-22 ## Categories & Tags **Categories**: harmonyos-image **Tags**: None ## README # Ohos-CutOut #### 项目介绍 - 项目名称: Ohos-CutOut - 所属系列:openharmony的第三方组件适配移植 - 功能:对图片进行裁剪,旋转,涂鸦,渲染等效果 - 项目移植状态:主功能完成 - 调用差异:无 - 开发版本:sdk6,DevEco Studio 2.2 Beta1 - 基线版本:master分支 #### 效果演示 ![输入图片说明](https://gitee.com/chinasoft3_ohos/Ohos-CutOut/raw/master/gif/demo.gif "demo.gif") #### 安装教程 1.在项目根目录下的build.gradle文件中, ```gradle allprojects { repositories { maven { url 'https://s01.oss.sonatype.org/content/repositories/releases/' } } } ``` 2.在entry模块的build.gradle文件中, ```gradle dependencies { implementation('com.gitee.chinasoft_ohos:cutout:1.0.0') ...... } ``` 在sdk6,DevEco Studio 2.2 Beta1下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 #### 使用说明 1. 开始剪切图片: ``` CutOut.ability(this).start(); ``` 2. 获取剪切后的图片: ``` @Override protected void onAbilityResult(int requestCode, int resultCode, Intent resultData) { super.onAbilityResult(requestCode, resultCode, resultData); if (requestCode == Constants.CUTOUT_ABILITY_REQUEST_CODE && resultCode == Constants.CUTOUT_ABILITY_RESULT_SUCCESS_CODE) { imageView.setPixelMap(GlobalData.getInstance().getResultPixelMap()); } } ``` 3. 可设置的选项: ```java CutOut.ability(MainAbility.this) .src(piexlMap) //默认情况下,用户可以从照相机或多媒体资料中选择图像,但也可以传递已保存图像生成的pixelMap .bordered() //此选项使最终的JPEG在其周围有一个边框,默认边框颜色为白色。 .noCrop() //此选项禁用裁剪屏幕 .intro() //显示说明每个按钮用法的简介,用户可以跳过简介,它只显示一次。 .start(); ``` 4. 注意事项 ``` 因为无法调用系统相机,引入'io.openharmony.tpc.thirdlib:Matisse:1.0.2'用作相机相册功能使用 因本地资源文件生成PixelMap比使用Uri生成方便,故将src(Uri uri)改为src(PixelMap pixelMap) 因页面跳转效果差异,故将activity()改为ability(Ability ability),start(Activity activity)改为start() ``` #### 测试信息 CodeCheck代码测试无异常 CloudTest代码测试无异常 病毒安全检测通过 当前版本demo功能与原组件基本无差异 ## 版本迭代 - 1.0.0 ## 版权和许可信息 ```` Copyright (c) 2018 Gabriel Basilio Brito Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to use, copy, modify, merge, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 1 - You cannot use this software to make an Android app that its main goal is to remove background from images and publish it to the Google Play Store, but you can use it to integrate the functionality in an existing app or a new app that does more than just this. 2 - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ````