1.ArkTs整改7 pngTest和部分接口
Signed-off-by: zhoulisheng1 <zhoulisheng1@huawei.com>
This commit is contained in:
parent
2c2dacb367
commit
50116741ea
|
@ -71,10 +71,10 @@ struct PngjTestCasePage {
|
||||||
if (!this.pngdecodeRun1) {
|
if (!this.pngdecodeRun1) {
|
||||||
this.pngdecodeRun1 = true;
|
this.pngdecodeRun1 = true;
|
||||||
let pngj = new Pngj();
|
let pngj = new Pngj();
|
||||||
pngj.readPngImageInfo(this.pngSource1, (sender, value) => {
|
pngj.readPngImageInfo(this.pngSource1,{pngCallback: (sender, value) => {
|
||||||
this.hint1 = JSON.stringify(value);
|
this.hint1 = JSON.stringify(value);
|
||||||
this.pngdecodeRun1 = false;
|
this.pngdecodeRun1 = false;
|
||||||
})
|
}})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.hint7 = '已经在执行了,请稍等'
|
this.hint7 = '已经在执行了,请稍等'
|
||||||
|
@ -118,12 +118,12 @@ struct PngjTestCasePage {
|
||||||
type: 'classic',
|
type: 'classic',
|
||||||
name: 'readPngImageAsync'
|
name: 'readPngImageAsync'
|
||||||
})
|
})
|
||||||
pngj.readPngImageAsync(png_worker, this.pngSource1, (sender, value) => {
|
pngj.readPngImageAsync(png_worker, this.pngSource1, {pngCallback: (sender, value) => {
|
||||||
this.pngSource1 = sender
|
this.pngSource1 = sender
|
||||||
this.hint2 = 'img with=' + value.width + ' img height=' + value.height
|
this.hint2 = 'img with=' + value.width + ' img height=' + value.height
|
||||||
+ ' img depth=' + value.depth + ' img ctype=' + value.ctype
|
+ ' img depth=' + value.depth + ' img ctype=' + value.ctype
|
||||||
this.pngdecodeRun2 = false;
|
this.pngdecodeRun2 = false;
|
||||||
})
|
}})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.hint8 = '已经在执行了,请稍等'
|
this.hint8 = '已经在执行了,请稍等'
|
||||||
|
@ -163,7 +163,7 @@ struct PngjTestCasePage {
|
||||||
type: 'classic',
|
type: 'classic',
|
||||||
name: 'writePngWithStringAsync'
|
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
|
this.pngSource3 = sender
|
||||||
FileUtils.getInstance().createFileProcess(
|
FileUtils.getInstance().createFileProcess(
|
||||||
this.rootFolder + '/pngj',
|
this.rootFolder + '/pngj',
|
||||||
|
@ -172,7 +172,7 @@ struct PngjTestCasePage {
|
||||||
let png1 = new Uint8Array(value)
|
let png1 = new Uint8Array(value)
|
||||||
this.hint3 = 'png写入后长度' + png1.byteLength + '目录文件:' + this.rootFolder + '/pngj/newPng.png' + '保存后使用2进制查看数据是否新增'
|
this.hint3 = 'png写入后长度' + png1.byteLength + '目录文件:' + this.rootFolder + '/pngj/newPng.png' + '保存后使用2进制查看数据是否新增'
|
||||||
this.pngdecodeRun3 = false;
|
this.pngdecodeRun3 = false;
|
||||||
})
|
}})
|
||||||
} else {
|
} else {
|
||||||
this.hint9 = '已经在执行了,请稍等'
|
this.hint9 = '已经在执行了,请稍等'
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ struct PngjTestCasePage {
|
||||||
type: 'classic',
|
type: 'classic',
|
||||||
name: 'writePngAsync'
|
name: 'writePngAsync'
|
||||||
})
|
})
|
||||||
pngj.writePngAsync(png_worker, this.pngSource4, (sender, value) => {
|
pngj.writePngAsync(png_worker, this.pngSource4,{pngCallback: (sender, value) => {
|
||||||
this.pngSource4 = sender
|
this.pngSource4 = sender
|
||||||
FileUtils.getInstance().createFileProcess(
|
FileUtils.getInstance().createFileProcess(
|
||||||
this.rootFolder + '/pngj',
|
this.rootFolder + '/pngj',
|
||||||
|
@ -221,7 +221,7 @@ struct PngjTestCasePage {
|
||||||
let png2 = new Uint8Array(value)
|
let png2 = new Uint8Array(value)
|
||||||
this.hint4 = 'png2未写入长度' + png2.byteLength + '目录文件:' + this.rootFolder + '/pngj/newPng2.png' + '保存后使用2进制查看数据是否新增'
|
this.hint4 = 'png2未写入长度' + png2.byteLength + '目录文件:' + this.rootFolder + '/pngj/newPng2.png' + '保存后使用2进制查看数据是否新增'
|
||||||
this.pngdecodeRun4 = false;
|
this.pngdecodeRun4 = false;
|
||||||
})
|
}})
|
||||||
} else {
|
} else {
|
||||||
this.hint10 = '已经在执行了,请稍等'
|
this.hint10 = '已经在执行了,请稍等'
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export class ArcPoint {
|
export class ArcPoint {
|
||||||
private x: number;
|
private x: number = 0;
|
||||||
private y: number;
|
private y: number = 0;
|
||||||
|
|
||||||
constructor(x: number, y: number) {
|
constructor(x: number, y: number) {
|
||||||
this.y = y;
|
this.y = y;
|
||||||
|
|
|
@ -13,12 +13,12 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
export class PixelEntry {
|
export class PixelEntry {
|
||||||
a: number;
|
a: number = 0;
|
||||||
b: number;
|
b: number = 0;
|
||||||
r: number;
|
r: number = 0;
|
||||||
g: number;
|
g: number = 0;
|
||||||
f: number;
|
f: number = 0;
|
||||||
pixel: number;
|
pixel: number = 0;
|
||||||
|
|
||||||
public toString(): string {
|
public toString(): string {
|
||||||
return "PixelEntry a:" + this.a + ";b:" + this.b + ";r:" + this.r + ";g:" + this.g + ";f:" + this.f;
|
return "PixelEntry a:" + this.a + ";b:" + this.b + ";r:" + this.r + ";g:" + this.g + ";f:" + this.f;
|
||||||
|
|
|
@ -14,5 +14,5 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export interface DataCallBack<T> {
|
export interface DataCallBack<T> {
|
||||||
callback(data: T);
|
callback:(data: T)=>void;
|
||||||
}
|
}
|
|
@ -14,24 +14,24 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {ImageKnifeData} from "../../imageknife/ImageKnifeData"
|
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 {
|
export class AllCacheInfo {
|
||||||
memoryCacheInfo: {
|
memoryCacheInfo: MemoryCacheInfo
|
||||||
key: string,
|
resourceCacheInfo: ResourceCacheInfo
|
||||||
data: ImageKnifeData
|
dataCacheInfo: DataCacheInfo
|
||||||
}
|
|
||||||
|
|
||||||
resourceCacheInfo: {
|
|
||||||
path: string,
|
|
||||||
key: string
|
|
||||||
}
|
|
||||||
|
|
||||||
dataCacheInfo: {
|
|
||||||
path: string,
|
|
||||||
key: string
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IAllCacheInfoCallback {
|
export interface IAllCacheInfoCallback {
|
||||||
(cacheInfo: AllCacheInfo);
|
callback :(cacheInfo: AllCacheInfo)=>void;
|
||||||
}
|
}
|
|
@ -121,7 +121,7 @@ export class RequestManager {
|
||||||
key: SparkMD5.hashBinary(this.options.generateDataKey),
|
key: SparkMD5.hashBinary(this.options.generateDataKey),
|
||||||
path: this.mDiskCacheProxy.getCachePath() + 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) {
|
} catch (err) {
|
||||||
LogUtil.log("after err =" + err)
|
LogUtil.log("after err =" + err)
|
||||||
|
|
Loading…
Reference in New Issue