1.cropImage default size changed
2.delete MyAbilityStage.ts useless file 3.ImageKnife create DiskLruCache Function has changed 4. MaskTransformation.ets adapter stage mode getResourceManager Signed-off-by: dodozhou7 <abczp777777@163.com>
This commit is contained in:
parent
4975e0e1a7
commit
38fc363b37
|
@ -1,7 +0,0 @@
|
|||
import AbilityStage from "@ohos.application.AbilityStage"
|
||||
|
||||
export default class MyAbilityStage extends AbilityStage {
|
||||
onCreate() {
|
||||
console.log("[Demo] MyAbilityStage onCreate")
|
||||
}
|
||||
}
|
|
@ -44,8 +44,8 @@ export struct CropImagePage2 {
|
|||
.then(data => {
|
||||
let arrayBuffer = FileUtils.getInstance().uint8ArrayToBuffer(data);
|
||||
let optionx = new PixelMapCrop.Options();
|
||||
optionx.setWidth(600)
|
||||
.setHeight(400)
|
||||
optionx.setWidth(800)
|
||||
.setHeight(800)
|
||||
.setCropFunction((err, pixelmap, sx, sy) => {
|
||||
console.log('PMC setCropFunction callback')
|
||||
if (err) {
|
||||
|
|
|
@ -61,7 +61,7 @@ export class ImageKnife {
|
|||
this.memoryCache = new LruCache<string, any>(100);
|
||||
|
||||
// 创建disk缓存 传入的size 为多少比特 比如20KB 传入20*1024
|
||||
this.diskMemoryCache = DiskLruCache.create(this.imageKnifeContext.filesDir + ImageKnife.SEPARATOR + this.diskCacheFolder, 30 * 1024 * 1024);
|
||||
this.diskMemoryCache = DiskLruCache.create(this.imageKnifeContext);
|
||||
|
||||
// 创建网络下载能力
|
||||
this.dataFetch = new DownloadClient();
|
||||
|
@ -180,12 +180,10 @@ export class ImageKnife {
|
|||
|
||||
// 替代原来的DiskLruCache
|
||||
public replaceDiskLruCache(size:number) {
|
||||
// this.diskMemoryCache = DiskLruCache.create(this.imageKnifeContext.filesDir+ImageKnife.SEPARATOR+this.diskCacheFolder, size);
|
||||
|
||||
if (this.diskMemoryCache.getCacheMap().size() <= 0) {
|
||||
this.diskMemoryCache = DiskLruCache.create(this.imageKnifeContext.filesDir + ImageKnife.SEPARATOR + this.diskCacheFolder, size);
|
||||
this.diskMemoryCache = DiskLruCache.create(this.imageKnifeContext, size);
|
||||
} else {
|
||||
let newDiskLruCache = DiskLruCache.create(this.imageKnifeContext.filesDir + ImageKnife.SEPARATOR + this.diskCacheFolder, size);
|
||||
let newDiskLruCache = DiskLruCache.create(this.imageKnifeContext, size);
|
||||
this.diskMemoryCache.foreachDiskLruCache(function (value, key, map) {
|
||||
newDiskLruCache.set(key, value);
|
||||
})
|
||||
|
|
|
@ -83,10 +83,7 @@ export class MaskTransformation implements BaseTransform<PixelMap> {
|
|||
if (!this._mResourceData) {
|
||||
throw new Error("MaskTransformation resource is empty");
|
||||
}
|
||||
resmgr.getResourceManager()
|
||||
.then(result => {
|
||||
result.getMedia(this._mResourceData
|
||||
.id)
|
||||
globalThis.ImageKnife.getImageKnifeContext().resourceManager.getMedia(this._mResourceData.id)
|
||||
.then(array => {
|
||||
let buffer = array.buffer.slice(array.byteOffset, array.byteLength + array.byteOffset);
|
||||
var imageSource = image.createImageSource(buffer as any);
|
||||
|
@ -105,6 +102,5 @@ export class MaskTransformation implements BaseTransform<PixelMap> {
|
|||
.catch(err => {
|
||||
func("MaskTransformation openInternal error" + err, null);
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue