Compare commits

..

No commits in common. "fa59e2b9ac5dd573b24b4dd91a5a7355854d6fbc" and "bea89c5c775050f0c61ba38eb4ea9be78573cd7b" have entirely different histories.

7 changed files with 14 additions and 61 deletions

View File

@ -1,7 +1,3 @@
## 3.1.0-rc.1
- ImageKnifeAnimatorComponent新增开始、结束、暂停的回调事件
- 文件缓存数量负数和超过INT最大值时默认为INT最大值
## 3.1.0-rc.0 ## 3.1.0-rc.0
- ComponentV2装饰器适配 - ComponentV2装饰器适配
- imageKnifeOption={...}用法改为new ImageKnifeOption({...}) - imageKnifeOption={...}用法改为new ImageKnifeOption({...})

View File

@ -24,6 +24,7 @@
待实现特性 待实现特性
- gif/webp动图显示与控制
- 内存降采样优化,节约内存的占用 - 内存降采样优化,节约内存的占用
- 支持自定义图片解码 - 支持自定义图片解码
@ -38,7 +39,7 @@
- 不支持drawLifeCycle接口通过canvas自会图片 - 不支持drawLifeCycle接口通过canvas自会图片
- mainScaleTypeborder等参数新版本与系统Image保持一致 - mainScaleTypeborder等参数新版本与系统Image保持一致
- gif/webp动图播放与控制(ImageAnimator实现) - gif/webp动图播放与控制
- 抗锯齿相关参数 - 抗锯齿相关参数
## 下载安装 ## 下载安装
@ -244,7 +245,7 @@ ImageKnifeComponent({ ImageKnifeOption: new ImageKnifeOption(
}) })
}).width(100).height(100) }).width(100).height(100)
``` ```
#### 9.ImageKnifeComponent - syncLoad #### 9.ImageKnifeComponent - syncLoad
设置是否同步加载图片默认是异步加载。建议加载尺寸较小的本地图片时将syncLoad设为true因为耗时较短在主线程上执行即可 设置是否同步加载图片默认是异步加载。建议加载尺寸较小的本地图片时将syncLoad设为true因为耗时较短在主线程上执行即可
``` ```
ImageKnifeComponent({ ImageKnifeComponent({
@ -272,16 +273,11 @@ ImageKnifeAnimatorComponent({
| ImageKnifeAnimatorComponent | ImageKnifeOption、AnimatorOption | 动图控制组件 | | ImageKnifeAnimatorComponent | ImageKnifeOption、AnimatorOption | 动图控制组件 |
### AnimatorOption参数列表 ### AnimatorOption参数列表
| 参数名称 | 入参内容 | 功能简介 | | 参数名称 | 入参内容 | 功能简介 |
|------------|-----------------|----------| |-----------------------|-------------------------------------------------------|----------|
| state | AnimationStatus | 播放状态(可选) | | state | AnimationStatus | 播放状态(可选) |
| iterations | number | 播放次数(可选) | | iterations | number | 播放次数(可选) |
| reverse | boolean | 播放顺序(可选) | | reverse | boolean | 播放顺序(可选) |
| onStart | ()=>void | 动画开始播放时触发(可选) |
| onFinish | ()=>void | 动画播放完成时或者停止播放时触发(可选) |
| onPause | ()=>void | 动画暂停播放时触发(可选) |
| onCancel | ()=>void | 动画返回最初状态时触发(可选) |
| onRepeat | ()=>void | 动画重复播放时触发(可选) |
### ImageKnifeOption参数列表 ### ImageKnifeOption参数列表

View File

@ -19,22 +19,7 @@ import { AnimatorOption, ImageKnifeAnimatorComponent,ImageKnifeOption } from "@o
struct ImageAnimatorPage { struct ImageAnimatorPage {
@Local animatorOption: AnimatorOption = new AnimatorOption({ @Local animatorOption: AnimatorOption = new AnimatorOption({
state: AnimationStatus.Running, state: AnimationStatus.Running,
iterations: -1, iterations: -1
onFinish:()=>{
console.log("ImageKnifeAnimatorComponent animatorOption onFinish")
},
onStart:()=>{
console.log("ImageKnifeAnimatorComponent animatorOption onStart")
},
onPause:()=>{
console.log("ImageKnifeAnimatorComponent animatorOption onPause")
},
onCancel:()=>{
console.log("ImageKnifeAnimatorComponent animatorOption onCancel")
},
onRepeat:()=>{
console.log("ImageKnifeAnimatorComponent animatorOption onRepeat")
}
}) })
@Local animatorOption1: AnimatorOption = new AnimatorOption({ @Local animatorOption1: AnimatorOption = new AnimatorOption({
state: AnimationStatus.Initial state: AnimationStatus.Initial

View File

@ -14,7 +14,7 @@
"main": "index.ets", "main": "index.ets",
"repository": "https://gitee.com/openharmony-tpc/ImageKnife", "repository": "https://gitee.com/openharmony-tpc/ImageKnife",
"type": "module", "type": "module",
"version": "3.1.0-rc.1", "version": "3.0.1-rc.2",
"dependencies": { "dependencies": {
"@ohos/gpu_transform": "^1.0.2" "@ohos/gpu_transform": "^1.0.2"
}, },

View File

@ -26,11 +26,6 @@ interface AnimatorType {
state?: AnimationStatus state?: AnimationStatus
iterations?: number iterations?: number
reverse?: boolean reverse?: boolean
onStart?:()=>void
onFinish?:()=>void
onPause?:()=>void
onCancel?:()=>void
onRepeat?:()=>void
} }
@ObservedV2 @ObservedV2
export class AnimatorOption { export class AnimatorOption {
@ -40,25 +35,11 @@ export class AnimatorOption {
iterations?: number = -1 iterations?: number = -1
@Trace @Trace
reverse?: boolean = false reverse?: boolean = false
@Trace
onStart?:()=>void
@Trace
onFinish?:()=>void
@Trace
onPause?:()=>void
@Trace
onCancel?:()=>void
@Trace
onRepeat?:()=>void
constructor(option?:AnimatorType) { constructor(option?:AnimatorType) {
this.state = option?.state this.state = option?.state
this.iterations = option?.iterations this.iterations = option?.iterations
this.reverse = option?.reverse this.reverse = option?.reverse
this.onStart = option?.onStart
this.onFinish = option?.onFinish
this.onPause = option?.onPause
this.onCancel = option?.onCancel
this.onRepeat = option?.onRepeat
} }
} }
interface ImageOption { interface ImageOption {

View File

@ -88,11 +88,6 @@ export struct ImageKnifeAnimatorComponent {
} }
} }
}) })
.onStart(this.animatorOption.onStart)
.onFinish(this.animatorOption.onFinish)
.onPause(this.animatorOption.onPause)
.onCancel(this.animatorOption.onCancel)
.onRepeat(this.animatorOption.onRepeat)
} }
getCurrentContext(): common.UIAbilityContext { getCurrentContext(): common.UIAbilityContext {

View File

@ -18,7 +18,7 @@ import fs from '@ohos.file.fs';
import { LogUtil } from './LogUtil'; import { LogUtil } from './LogUtil';
import { SparkMD5 } from '../3rd_party/sparkmd5/spark-md5'; import { SparkMD5 } from '../3rd_party/sparkmd5/spark-md5';
const INT_MAX = 2147483647
/** /**
* 二级文件缓存 * 二级文件缓存
* 主线程通过lruCache管理缓存大小 * 主线程通过lruCache管理缓存大小
@ -34,12 +34,12 @@ export class FileCache {
private isInited: boolean = false private isInited: boolean = false
private context?: Context private context?: Context
readonly defaultMaxSize: number = 512; readonly defaultMaxSize: number = 512;
readonly defaultSize: number = INT_MAX; readonly defaultSize: number = 128;
readonly defaultMaxMemorySize: number = 512 * 1024 * 1024; readonly defaultMaxMemorySize: number = 512 * 1024 * 1024;
readonly defaultMemorySize: number = 128 * 1024 * 1024; readonly defaultMemorySize: number = 128 * 1024 * 1024;
constructor(context: Context, size: number, memory: number) { constructor(context: Context, size: number, memory: number) {
if (size <= 0 || size > INT_MAX) { if (size <= 0) {
size = this.defaultSize size = this.defaultSize
} }
if (memory <= 0 || memory > this.defaultMaxMemorySize) { if (memory <= 0 || memory > this.defaultMaxMemorySize) {