1.ArkTs整改7 pngTest和部分接口

Signed-off-by: zhoulisheng1 <zhoulisheng1@huawei.com>
This commit is contained in:
zhoulisheng1 2023-09-18 18:53:29 +08:00
parent 2c2dacb367
commit 50116741ea
6 changed files with 34 additions and 34 deletions

View File

@ -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 = '已经在执行了,请稍等'
}

View File

@ -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;

View File

@ -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;

View File

@ -14,5 +14,5 @@
*/
export interface DataCallBack<T> {
callback(data: T);
callback:(data: T)=>void;
}

View File

@ -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;
}

View File

@ -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)