diff --git a/entry/src/main/ets/pages/pngjTestCasePage.ets b/entry/src/main/ets/pages/pngjTestCasePage.ets index 5ebbd07..b2856d4 100644 --- a/entry/src/main/ets/pages/pngjTestCasePage.ets +++ b/entry/src/main/ets/pages/pngjTestCasePage.ets @@ -71,10 +71,10 @@ struct PngjTestCasePage { if (!this.pngdecodeRun1) { this.pngdecodeRun1 = true; let pngj = new Pngj(); - pngj.readPngImageInfo(this.pngSource1, (sender, value) => { + pngj.readPngImageInfo(this.pngSource1,{pngCallback: (sender, value) => { this.hint1 = JSON.stringify(value); this.pngdecodeRun1 = false; - }) + }}) } else { this.hint7 = '已经在执行了,请稍等' @@ -118,12 +118,12 @@ struct PngjTestCasePage { type: 'classic', name: 'readPngImageAsync' }) - pngj.readPngImageAsync(png_worker, this.pngSource1, (sender, value) => { + pngj.readPngImageAsync(png_worker, this.pngSource1, {pngCallback: (sender, value) => { this.pngSource1 = sender this.hint2 = 'img with=' + value.width + ' img height=' + value.height + ' img depth=' + value.depth + ' img ctype=' + value.ctype this.pngdecodeRun2 = false; - }) + }}) } else { this.hint8 = '已经在执行了,请稍等' @@ -163,7 +163,7 @@ struct PngjTestCasePage { type: 'classic', name: 'writePngWithStringAsync' }) - pngj.writePngWithStringAsync(png_worker, 'hello world', this.pngSource3, (sender, value) => { + pngj.writePngWithStringAsync(png_worker, 'hello world', this.pngSource3, {pngCallback: (sender, value) => { this.pngSource3 = sender FileUtils.getInstance().createFileProcess( this.rootFolder + '/pngj', @@ -172,7 +172,7 @@ struct PngjTestCasePage { let png1 = new Uint8Array(value) this.hint3 = 'png写入后长度' + png1.byteLength + '目录文件:' + this.rootFolder + '/pngj/newPng.png' + '保存后使用2进制查看数据是否新增' this.pngdecodeRun3 = false; - }) + }}) } else { this.hint9 = '已经在执行了,请稍等' } @@ -212,7 +212,7 @@ struct PngjTestCasePage { type: 'classic', name: 'writePngAsync' }) - pngj.writePngAsync(png_worker, this.pngSource4, (sender, value) => { + pngj.writePngAsync(png_worker, this.pngSource4,{pngCallback: (sender, value) => { this.pngSource4 = sender FileUtils.getInstance().createFileProcess( this.rootFolder + '/pngj', @@ -221,7 +221,7 @@ struct PngjTestCasePage { let png2 = new Uint8Array(value) this.hint4 = 'png2未写入长度' + png2.byteLength + '目录文件:' + this.rootFolder + '/pngj/newPng2.png' + '保存后使用2进制查看数据是否新增' this.pngdecodeRun4 = false; - }) + }}) } else { this.hint10 = '已经在执行了,请稍等' } diff --git a/imageknife/src/main/ets/components/imageknife/entry/ArcPoint.ets b/imageknife/src/main/ets/components/imageknife/entry/ArcPoint.ets index 1754f7f..a94c90c 100644 --- a/imageknife/src/main/ets/components/imageknife/entry/ArcPoint.ets +++ b/imageknife/src/main/ets/components/imageknife/entry/ArcPoint.ets @@ -14,8 +14,8 @@ */ export class ArcPoint { - private x: number; - private y: number; + private x: number = 0; + private y: number = 0; constructor(x: number, y: number) { this.y = y; diff --git a/imageknife/src/main/ets/components/imageknife/entry/PixelEntry.ets b/imageknife/src/main/ets/components/imageknife/entry/PixelEntry.ets index b14b30d..1f2f871 100644 --- a/imageknife/src/main/ets/components/imageknife/entry/PixelEntry.ets +++ b/imageknife/src/main/ets/components/imageknife/entry/PixelEntry.ets @@ -13,12 +13,12 @@ * limitations under the License. */ export class PixelEntry { - a: number; - b: number; - r: number; - g: number; - f: number; - pixel: number; + a: number = 0; + b: number = 0; + r: number = 0; + g: number = 0; + f: number = 0; + pixel: number = 0; public toString(): string { return "PixelEntry a:" + this.a + ";b:" + this.b + ";r:" + this.r + ";g:" + this.g + ";f:" + this.f; diff --git a/imageknife/src/main/ets/components/imageknife/interface/DataCallBack.ets b/imageknife/src/main/ets/components/imageknife/interface/DataCallBack.ets index 0ccd3ba..5fee466 100644 --- a/imageknife/src/main/ets/components/imageknife/interface/DataCallBack.ets +++ b/imageknife/src/main/ets/components/imageknife/interface/DataCallBack.ets @@ -14,5 +14,5 @@ */ export interface DataCallBack { - callback(data: T); + callback:(data: T)=>void; } \ No newline at end of file diff --git a/imageknife/src/main/ets/components/imageknife/interface/IAllCacheInfoCallback.ets b/imageknife/src/main/ets/components/imageknife/interface/IAllCacheInfoCallback.ets index 9643f5f..267daeb 100644 --- a/imageknife/src/main/ets/components/imageknife/interface/IAllCacheInfoCallback.ets +++ b/imageknife/src/main/ets/components/imageknife/interface/IAllCacheInfoCallback.ets @@ -14,24 +14,24 @@ */ import {ImageKnifeData} from "../../imageknife/ImageKnifeData" - +export interface MemoryCacheInfo{ + key: string, + data: ImageKnifeData +} +export interface ResourceCacheInfo{ + path: string, + key: string +} +export interface DataCacheInfo{ + path: string, + key: string +} export class AllCacheInfo { - memoryCacheInfo: { - key: string, - data: ImageKnifeData - } - - resourceCacheInfo: { - path: string, - key: string - } - - dataCacheInfo: { - path: string, - key: string - } + memoryCacheInfo: MemoryCacheInfo + resourceCacheInfo: ResourceCacheInfo + dataCacheInfo: DataCacheInfo } export interface IAllCacheInfoCallback { - (cacheInfo: AllCacheInfo); + callback :(cacheInfo: AllCacheInfo)=>void; } \ No newline at end of file diff --git a/imageknife/src/main/ets/components/imageknife/requestmanage/RequestManager.ets b/imageknife/src/main/ets/components/imageknife/requestmanage/RequestManager.ets index 4f293e2..f96ac23 100644 --- a/imageknife/src/main/ets/components/imageknife/requestmanage/RequestManager.ets +++ b/imageknife/src/main/ets/components/imageknife/requestmanage/RequestManager.ets @@ -121,7 +121,7 @@ export class RequestManager { key: SparkMD5.hashBinary(this.options.generateDataKey), path: this.mDiskCacheProxy.getCachePath() + SparkMD5.hashBinary(this.options.generateDataKey) } - this.options.allCacheInfoCallback(allCacheInfo) + this.options.allCacheInfoCallback.callback(allCacheInfo) } } catch (err) { LogUtil.log("after err =" + err)