更新说明:
开放.jpg .png .gif解码能力 Signed-off-by: 明月清风 <qiufeihu1@h-partners.com>
This commit is contained in:
parent
e53aace169
commit
2408483211
|
@ -3,7 +3,7 @@
|
||||||
"bundleName": "com.openharmony.imageknife",
|
"bundleName": "com.openharmony.imageknife",
|
||||||
"vendor": "example",
|
"vendor": "example",
|
||||||
"versionCode": 1000000,
|
"versionCode": 1000000,
|
||||||
"versionName": "2.1.1",
|
"versionName": "2.1.2-rc.0",
|
||||||
"icon": "$media:app_icon",
|
"icon": "$media:app_icon",
|
||||||
"label": "$string:app_name",
|
"label": "$string:app_name",
|
||||||
"distributedNotificationEnabled": true
|
"distributedNotificationEnabled": true
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
|
## 2.1.2-rc.0
|
||||||
|
- 开放.jpg .png .gif解码能力
|
||||||
|
|
||||||
|
|
||||||
## 2.1.1
|
## 2.1.1
|
||||||
- 屏蔽了taskpool解码能力
|
- 屏蔽了taskpool解码能力
|
||||||
- 2.1.1正式版本发步
|
- 2.1.1正式版本发布
|
||||||
|
|
||||||
## 2.1.1-rc.5
|
## 2.1.1-rc.5
|
||||||
- .jpg .png .gif解码功能使用taskpool实现
|
- .jpg .png .gif解码功能使用taskpool实现
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"name": "entry",
|
"name": "entry",
|
||||||
"description": "example description",
|
"description": "example description",
|
||||||
"repository": {},
|
"repository": {},
|
||||||
"version": "2.1.1",
|
"version": "2.1.2-rc.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ohos/libraryimageknife": "file:../sharedlibrary",
|
"@ohos/libraryimageknife": "file:../sharedlibrary",
|
||||||
"@ohos/disklrucache": "^2.0.2-rc.0",
|
"@ohos/disklrucache": "^2.0.2-rc.0",
|
||||||
|
|
|
@ -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": "2.1.1",
|
"version": "2.1.2-rc.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pako": "^2.1.0",
|
"pako": "^2.1.0",
|
||||||
"@ohos/disklrucache": "^2.0.2-rc.0",
|
"@ohos/disklrucache": "^2.0.2-rc.0",
|
||||||
|
|
|
@ -27,33 +27,33 @@ export class ParseImageUtil implements IParseImage<PixelMap> {
|
||||||
// scale(0,1)
|
// scale(0,1)
|
||||||
parseImageThumbnail(scale: number, imageinfo: ArrayBuffer, onCompleteFunction: (value: PixelMap) => void | PromiseLike<PixelMap>, onErrorFunction: (reason?: BusinessError | string) => void) {
|
parseImageThumbnail(scale: number, imageinfo: ArrayBuffer, onCompleteFunction: (value: PixelMap) => void | PromiseLike<PixelMap>, onErrorFunction: (reason?: BusinessError | string) => void) {
|
||||||
|
|
||||||
let imageSource: image.ImageSource = image.createImageSource(imageinfo); // 步骤一:文件转为pixelMap 然后变换 给Image组件
|
// let imageSource: image.ImageSource = image.createImageSource(imageinfo); // 步骤一:文件转为pixelMap 然后变换 给Image组件
|
||||||
imageSource.getImageInfo().then((value) => {
|
// imageSource.getImageInfo().then((value) => {
|
||||||
let hValue = Math.round(value.size.height * scale);
|
// let hValue = Math.round(value.size.height * scale);
|
||||||
let wValue = Math.round(value.size.width * scale);
|
// let wValue = Math.round(value.size.width * scale);
|
||||||
let defaultSize: image.Size = {
|
// let defaultSize: image.Size = {
|
||||||
height: hValue,
|
// height: hValue,
|
||||||
width: wValue
|
// width: wValue
|
||||||
};
|
// };
|
||||||
let opts: image.DecodingOptions = {
|
// let opts: image.DecodingOptions = {
|
||||||
editable: true,
|
// editable: true,
|
||||||
desiredSize: defaultSize
|
// desiredSize: defaultSize
|
||||||
};
|
// };
|
||||||
|
//
|
||||||
|
// imageSource.createPixelMap(opts).then((pixelMap: image.PixelMap) => {
|
||||||
|
// onCompleteFunction(pixelMap);
|
||||||
|
// imageSource.release()
|
||||||
|
// }).catch((err: string) => {
|
||||||
|
// onErrorFunction(err);
|
||||||
|
// imageSource.release()
|
||||||
|
// })
|
||||||
|
//
|
||||||
|
// }).catch((err: string) => {
|
||||||
|
// onErrorFunction(err);
|
||||||
|
// imageSource.release()
|
||||||
|
// })
|
||||||
|
|
||||||
imageSource.createPixelMap(opts).then((pixelMap: image.PixelMap) => {
|
taskPoolExecutePixelMap(imageinfo,scale,onCompleteFunction,onErrorFunction); //多线程接口
|
||||||
onCompleteFunction(pixelMap);
|
|
||||||
imageSource.release()
|
|
||||||
}).catch((err: string) => {
|
|
||||||
onErrorFunction(err);
|
|
||||||
imageSource.release()
|
|
||||||
})
|
|
||||||
|
|
||||||
}).catch((err: string) => {
|
|
||||||
onErrorFunction(err);
|
|
||||||
imageSource.release()
|
|
||||||
})
|
|
||||||
|
|
||||||
// taskPoolExecutePixelMap(imageinfo,scale,onCompleteFunction,onErrorFunction); //多线程接口
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,46 +36,46 @@ export interface gifBackData {
|
||||||
export class GIFParseImpl implements IParseGif {
|
export class GIFParseImpl implements IParseGif {
|
||||||
parseGifs(imageinfo: ArrayBuffer, callback: (data?: GIFFrame[], err?: BusinessError | string) => void) {
|
parseGifs(imageinfo: ArrayBuffer, callback: (data?: GIFFrame[], err?: BusinessError | string) => void) {
|
||||||
// 硬解码流程
|
// 硬解码流程
|
||||||
let imageSource = image.createImageSource(imageinfo);
|
// let imageSource = image.createImageSource(imageinfo);
|
||||||
let decodeOpts: image.DecodingOptions = {
|
// let decodeOpts: image.DecodingOptions = {
|
||||||
sampleSize: 1,
|
// sampleSize: 1,
|
||||||
editable: true,
|
// editable: true,
|
||||||
rotate: 0
|
// rotate: 0
|
||||||
}
|
// }
|
||||||
let data:GIFFrame[] = [];
|
// let data:GIFFrame[] = [];
|
||||||
imageSource.createPixelMapList(decodeOpts).then((pixelList: Array<PixelMap>) => {
|
// imageSource.createPixelMapList(decodeOpts).then((pixelList: Array<PixelMap>) => {
|
||||||
//sdk的api接口发生变更:从.getDelayTime() 变为.getDelayTimeList()
|
// //sdk的api接口发生变更:从.getDelayTime() 变为.getDelayTimeList()
|
||||||
imageSource.getDelayTimeList().then(delayTimes => {
|
// imageSource.getDelayTimeList().then(delayTimes => {
|
||||||
if (pixelList.length > 0) {
|
// if (pixelList.length > 0) {
|
||||||
let pixelmap1 = pixelList[0];
|
// let pixelmap1 = pixelList[0];
|
||||||
pixelmap1.getImageInfo().then(imageInfo => {
|
// pixelmap1.getImageInfo().then(imageInfo => {
|
||||||
for (let i = 0; i < pixelList.length; i++) {
|
// for (let i = 0; i < pixelList.length; i++) {
|
||||||
let frame = new GIFFrame();
|
// let frame = new GIFFrame();
|
||||||
frame.drawPixelMap = pixelList[i];
|
// frame.drawPixelMap = pixelList[i];
|
||||||
frame.dims = { width: imageInfo.size.width, height: imageInfo.size.height, top: 0, left: 0 }
|
// frame.dims = { width: imageInfo.size.width, height: imageInfo.size.height, top: 0, left: 0 }
|
||||||
if (i < delayTimes.length) {
|
// if (i < delayTimes.length) {
|
||||||
frame.delay = delayTimes[i];
|
// frame.delay = delayTimes[i];
|
||||||
} else {
|
// } else {
|
||||||
frame.delay = delayTimes[delayTimes.length - 1]
|
// frame.delay = delayTimes[delayTimes.length - 1]
|
||||||
}
|
// }
|
||||||
data.push(frame)
|
// data.push(frame)
|
||||||
}
|
// }
|
||||||
callback(data,undefined)
|
// callback(data,undefined)
|
||||||
imageSource.release();
|
// imageSource.release();
|
||||||
}).catch((err: string) => {
|
// }).catch((err: string) => {
|
||||||
imageSource.release();
|
// imageSource.release();
|
||||||
callback(undefined,err)
|
// callback(undefined,err)
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
}).catch((err: string) => {
|
// }).catch((err: string) => {
|
||||||
imageSource.release();
|
// imageSource.release();
|
||||||
callback(undefined,err)
|
// callback(undefined,err)
|
||||||
})
|
// })
|
||||||
}).catch((err: string) => {
|
// }).catch((err: string) => {
|
||||||
imageSource.release();
|
// imageSource.release();
|
||||||
callback(undefined,err)
|
// callback(undefined,err)
|
||||||
})
|
// })
|
||||||
// taskPoolExecutePixelMapList(imageinfo,callback); //多线程接口
|
taskPoolExecutePixelMapList(imageinfo,callback); //多线程接口
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
"name": "imageknife",
|
"name": "imageknife",
|
||||||
"description": "example description",
|
"description": "example description",
|
||||||
"repository": {},
|
"repository": {},
|
||||||
"version": "2.1.1",
|
"version": "2.1.2-rc.0",
|
||||||
"dependencies": {}
|
"dependencies": {}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue