!5 add User-Defined transformation effect interface
Merge pull request !5 from 周黎生/master
This commit is contained in:
commit
6c39fb449d
19
CHANGELOG.md
19
CHANGELOG.md
|
@ -1,12 +1,15 @@
|
|||
## 1.0.2
|
||||
- 支持用户自定义扩展变换接口。
|
||||
|
||||
## 1.0.1
|
||||
- hvigor工程结构整改
|
||||
- 由gradle工程整改为hvigor工程。
|
||||
|
||||
## 1.0.0
|
||||
专门为OpenHarmony打造的一款图像加载缓存库,致力于更高效、更轻便、更简单
|
||||
- 支持内存缓存,使用LRUCache算法,对图片数据进行内存缓存
|
||||
- 支持磁盘缓存,对于下载图片会保存一份至磁盘当中
|
||||
- 支持进行图片变换
|
||||
- 支持用户配置参数使用:(例如:配置是否开启第一级内存缓存,配置磁盘缓存策略,配置仅使用缓存加载数据,配置图片变换效果,配置占位图,配置加载失败占位图等)
|
||||
- 推荐使用ImageKnifeComponent组件配合ImageKnifeOption参数来实现功能
|
||||
- 支持用户自定义配置实现能力参考ImageKnifeComponent组件中对于入参ImageKnifeOption的处理
|
||||
专门为OpenHarmony打造的一款图像加载缓存库,致力于更高效、更轻便、更简单:
|
||||
- 支持内存缓存,使用LRUCache算法,对图片数据进行内存缓存。
|
||||
- 支持磁盘缓存,对于下载图片会保存一份至磁盘当中。
|
||||
- 支持进行图片变换。
|
||||
- 支持用户配置参数使用:(例如:配置是否开启第一级内存缓存,配置磁盘缓存策略,配置仅使用缓存加载数据,配置图片变换效果,配置占位图,配置加载失败占位图等)。
|
||||
- 推荐使用ImageKnifeComponent组件配合ImageKnifeOption参数来实现功能。
|
||||
- 支持用户自定义配置实现能力参考ImageKnifeComponent组件中对于入参ImageKnifeOption的处理。
|
||||
|
||||
|
|
|
@ -321,4 +321,6 @@ let requestOptin = new RequestOption();
|
|||
|
||||
1.图片变换缓慢(待优化)。
|
||||
|
||||
2.目前只支持一种图片变换效果。
|
||||
2.目前只支持一种图片变换效果。
|
||||
|
||||
3.目前svg和gif动图不支持变换效果。
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"app": {
|
||||
"vendor": "example",
|
||||
"bundleName": "com.example.imageknifegiteepro",
|
||||
"vendor": "openharmony",
|
||||
"bundleName": "cn.openharmony.imageknife",
|
||||
"version": {
|
||||
"code": 1000000,
|
||||
"name": "1.0.0"
|
||||
|
@ -51,7 +51,7 @@
|
|||
"deliveryWithInstall": true,
|
||||
"moduleName": "entry"
|
||||
},
|
||||
"package": "com.example.entry",
|
||||
"package": "cn.openharmony.entry",
|
||||
"srcPath": "",
|
||||
"name": ".entry",
|
||||
"reqPermissions": [
|
||||
|
@ -63,7 +63,7 @@
|
|||
"reason": "Api call",
|
||||
"usedScene": {
|
||||
"ability": [
|
||||
"com.example.imageknifegiteepro.MainAbility"
|
||||
"cn.openharmony.imageknife.MainAbility"
|
||||
],
|
||||
"when": "always"
|
||||
}
|
||||
|
@ -77,7 +77,7 @@
|
|||
"usedScene": {
|
||||
"when": "always",
|
||||
"ability": [
|
||||
"com.example.imageknifegiteepro.MainAbility"
|
||||
"cn.openharmony.imageknife.MainAbility"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
@ -87,7 +87,7 @@
|
|||
"usedScene": {
|
||||
"when": "always",
|
||||
"ability": [
|
||||
"com.example.imageknifegiteepro.MainAbility"
|
||||
"cn.openharmony.imageknife.MainAbility"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
import {ImageKnifeComponent} from '@ohos/imageknife'
|
||||
import {ImageKnifeOption} from '@ohos/imageknife'
|
||||
import {RotateImageTransformation} from '@ohos/imageknife'
|
||||
import {GrayscaleTransformation} from '@ohos/imageknife'
|
||||
import {SketchFilterTransformation} from '@ohos/imageknife'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
|
@ -42,7 +44,8 @@ struct TestImageKnifeOptionChangedPage2 {
|
|||
placeholderSrc: $r('app.media.icon_loading'),
|
||||
errorholderSrc: $r('app.media.icon_failed'),
|
||||
margin:{left:5,top:5,right:5,bottom:5},
|
||||
thumbSizeMultiplier:0.1
|
||||
thumbSizeMultiplier:0.1,
|
||||
transformation:new RotateImageTransformation(180)
|
||||
};
|
||||
}).margin({left:5}).backgroundColor(Color.Blue)
|
||||
Button("网络资源png")
|
||||
|
@ -53,7 +56,8 @@ struct TestImageKnifeOptionChangedPage2 {
|
|||
placeholderSrc: $r('app.media.icon_loading'),
|
||||
errorholderSrc: $r('app.media.icon_failed'),
|
||||
margin:{left:5,top:5,right:5,bottom:5},
|
||||
thumbSizeMultiplier:0.1
|
||||
thumbSizeMultiplier:0.1,
|
||||
transformations:[new RotateImageTransformation(180)]
|
||||
};
|
||||
}).margin({left:5}).backgroundColor(Color.Blue)
|
||||
Button("网络资源bmp")
|
||||
|
@ -64,7 +68,8 @@ struct TestImageKnifeOptionChangedPage2 {
|
|||
placeholderSrc: $r('app.media.icon_loading'),
|
||||
errorholderSrc: $r('app.media.icon_failed'),
|
||||
margin:{left:5,top:5,right:5,bottom:5},
|
||||
thumbSizeMultiplier:0.1
|
||||
thumbSizeMultiplier:0.1,
|
||||
transformations:[new GrayscaleTransformation()]
|
||||
};
|
||||
}).margin({left:5}).backgroundColor(Color.Blue)
|
||||
Button("网络资源webp")
|
||||
|
@ -75,7 +80,8 @@ struct TestImageKnifeOptionChangedPage2 {
|
|||
placeholderSrc: $r('app.media.icon_loading'),
|
||||
errorholderSrc: $r('app.media.icon_failed'),
|
||||
margin:{left:5,top:5,right:5,bottom:5},
|
||||
thumbSizeMultiplier:0.1
|
||||
thumbSizeMultiplier:0.1,
|
||||
transformations:[new SketchFilterTransformation()]
|
||||
};
|
||||
}).margin({left:5}).backgroundColor(Color.Blue)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@ohos/imageknife",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
},
|
||||
"main": "index.ets",
|
||||
"repository": "https://gitee.com/openharmony-tpc/ImageKnife",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"dependencies": {
|
||||
"pako": "^1.0.5"
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"app": {
|
||||
"bundleName": "com.example.imageknifegiteepro",
|
||||
"vendor": "example",
|
||||
"bundleName": "cn.openharmony.imageknife",
|
||||
"vendor": "openharmony",
|
||||
"version": {
|
||||
"code": 1000000,
|
||||
"name": "1.0.0"
|
||||
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"deviceConfig": {},
|
||||
"module": {
|
||||
"package": "com.example.imageknife",
|
||||
"package": "cn.openharmony.imageknife",
|
||||
"deviceType": [
|
||||
"phone",
|
||||
"tablet"
|
||||
|
|
|
@ -147,6 +147,12 @@ export struct ImageKnifeComponent {
|
|||
if (this.imageKnifeOption.transform) {
|
||||
this.requestAddTransform(request)
|
||||
}
|
||||
if (this.imageKnifeOption.transformation) {
|
||||
request.transform(this.imageKnifeOption.transformation)
|
||||
}
|
||||
if (this.imageKnifeOption.transformations) {
|
||||
request.transforms(this.imageKnifeOption.transformations)
|
||||
}
|
||||
if (this.imageKnifeOption.dontAnimateFlag) {
|
||||
request.dontAnimate()
|
||||
}
|
||||
|
|
|
@ -73,6 +73,9 @@ export class ImageKnifeOption {
|
|||
rotateImage?:number
|
||||
}
|
||||
|
||||
transformation?:BaseTransform<PixelMap>;
|
||||
|
||||
transformations?:Array<BaseTransform<PixelMap>>;
|
||||
|
||||
// 输出缓存相关内容和信息
|
||||
allCacheInfoCallback?: IAllCacheInfoCallback;
|
||||
|
|
|
@ -308,6 +308,14 @@ export class RequestOption {
|
|||
this.transformations.push(transformation);
|
||||
return this;
|
||||
}
|
||||
transform(input:BaseTransform<PixelMap>){
|
||||
this.transformations.push(input);
|
||||
return this;
|
||||
}
|
||||
transforms(inputs:BaseTransform<PixelMap>[]){
|
||||
this.transformations = inputs;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
// 占位图解析成功
|
||||
|
|
Loading…
Reference in New Issue