diff --git a/NOTICE b/NOTICE index 76349e6..cdbbfe8 100644 --- a/NOTICE +++ b/NOTICE @@ -148,7 +148,7 @@ http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html Java Author: Mario Klingemann http://incubator.quasimondo.com -created Feburary 29, 2004 +created February 29, 2004 port : Yahel Bouaziz http://www.kayenko.com ported april 5th, 2012 diff --git a/build-profile.json5 b/build-profile.json5 index 4f249a9..7ec08ca 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -39,8 +39,8 @@ "srcPath": "./gpu_transform" }, { - "name": "library", - "srcPath": "./library", + "name": "sharedlibrary", + "srcPath": "./sharedlibrary", "targets": [ { "name": "default", diff --git a/entry/oh-package.json5 b/entry/oh-package.json5 index f371f22..95dd844 100644 --- a/entry/oh-package.json5 +++ b/entry/oh-package.json5 @@ -6,8 +6,11 @@ "repository": {}, "version": "2.1.1-rc.4", "dependencies": { - "@ohos/libraryimageknife": "file:../library", + // 如果测试entry的demo需要开启以下2个依赖, 然后点击entry勾选 Edit Configurations->点击Deploy Multi Hap->勾选Deploy Multi Hap Packages + // 然后点击module栏目 把library也勾选上,这样就可以在HSP场景下测试Entry里面的HSP场景 + "@ohos/libraryimageknife": "file:../sharedlibrary", "@ohos/disklrucache": "^2.0.2-rc.0", + // 下面这个依赖是为了跑XTS用例的,需要跑XTS时,需要注释上面2个依赖单独使用imageknife依赖 "@ohos/imageknife": "file:../imageknife" } -} +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/imageknifeTestCaseIndex.ets b/entry/src/main/ets/pages/imageknifeTestCaseIndex.ets index ac35f87..77024bd 100644 --- a/entry/src/main/ets/pages/imageknifeTestCaseIndex.ets +++ b/entry/src/main/ets/pages/imageknifeTestCaseIndex.ets @@ -262,7 +262,7 @@ struct IndexFunctionDemo { Button("进入HSP的library共享包") .onClick(() => { - router.pushUrl({url:'@bundle:com.openharmony.imageknife/library/ets/pages/Index'}) + router.pushUrl({url:'@bundle:com.openharmony.imageknife/sharedlibrary/ets/pages/Index'}) .then(()=>{ console.log('push page suceess') }) diff --git a/entry/src/main/ets/pages/testImageKnifeOptionChangedPage.ets b/entry/src/main/ets/pages/testImageKnifeOptionChangedPage.ets index e2aaf7c..dc95841 100644 --- a/entry/src/main/ets/pages/testImageKnifeOptionChangedPage.ets +++ b/entry/src/main/ets/pages/testImageKnifeOptionChangedPage.ets @@ -23,6 +23,7 @@ import worker from '@ohos.worker' @Component struct TestImageKnifeOptionChangedPage { + svgUrl:string = '' @State imageKnifeOption1: ImageKnifeOption = { loadSrc: $r('app.media.jpgSample'), @@ -139,10 +140,28 @@ struct TestImageKnifeOptionChangedPage { errorholderSrc: $r('app.media.icon_failed') }; }).margin({left:5}).backgroundColor(Color.Blue) - Button('svg') + + Text("请先设置SVG图片的url地址") + TextArea({ placeholder: '请输入SVG图片的url地址' }) + .placeholderColor("rgb(0,0,35)") + .placeholderFont({ size: 20, weight: 100, family: 'cursive', style: FontStyle.Italic }) + .textAlign(TextAlign.Center) + .caretColor(Color.Blue) + .height(40) + .width(400) + .fontSize(20) + .fontWeight(FontWeight.Bold) + .fontFamily("sans-serif") + .fontStyle(FontStyle.Normal) + .fontColor(Color.Red) + .onChange((value: string) => { + this.svgUrl = value + }) + + Button('svg') .onClick(()=>{ this.imageKnifeOption1 = { - loadSrc: 'http://124.222.187.78/download/test.svg', + loadSrc: this.svgUrl, placeholderSrc: $r('app.media.icon_loading'), errorholderSrc: $r('app.media.icon_failed') diff --git a/entry/src/main/ets/pages/testPreloadPage.ets b/entry/src/main/ets/pages/testPreloadPage.ets index 7d0272a..62a16be 100644 --- a/entry/src/main/ets/pages/testPreloadPage.ets +++ b/entry/src/main/ets/pages/testPreloadPage.ets @@ -23,7 +23,7 @@ import { BusinessError } from '@ohos.base' @Entry @Component struct TestPreloadPage { - + svgUrl:string = '' @State imageKnifeOption1: ImageKnifeOption = { loadSrc: $r('app.media.jpgSample'), @@ -255,13 +255,28 @@ struct TestPreloadPage { } .margin({ top: 15 }) - + Text("请先设置SVG图片的url地址") + TextArea({ placeholder: '请输入SVG图片的url地址' }) + .placeholderColor("rgb(0,0,35)") + .placeholderFont({ size: 20, weight: 100, family: 'cursive', style: FontStyle.Italic }) + .textAlign(TextAlign.Center) + .caretColor(Color.Blue) + .height(40) + .width(400) + .fontSize(20) + .fontWeight(FontWeight.Bold) + .fontFamily("sans-serif") + .fontStyle(FontStyle.Normal) + .fontColor(Color.Red) + .onChange((value: string) => { + this.svgUrl = value + }) Flex({ direction: FlexDirection.Row }) { Button('预加载网络资源svg') .onClick(() => { let request = new RequestOption(); - request.load('http://124.222.187.78/download/test.svg') + request.load(this.svgUrl) .setImageViewSize({ width: 300, height: 300 }) .addListener({callback:(err:BusinessError|string, data:ImageKnifeData) => { if (err) { @@ -279,7 +294,7 @@ struct TestPreloadPage { Button('网络资源svg') .onClick(() => { this.imageKnifeOption = { - loadSrc: 'http://124.222.187.78/download/test.svg', + loadSrc: this.svgUrl, placeholderSrc: $r('app.media.icon_loading'), errorholderSrc: $r('app.media.icon_failed'), diff --git a/imageknife/src/main/ets/components/imageknife/ImageKnifeComponent.ets b/imageknife/src/main/ets/components/imageknife/ImageKnifeComponent.ets index 7aa4a26..e1d0394 100644 --- a/imageknife/src/main/ets/components/imageknife/ImageKnifeComponent.ets +++ b/imageknife/src/main/ets/components/imageknife/ImageKnifeComponent.ets @@ -445,7 +445,7 @@ export struct ImageKnifeComponent { LogUtil.log('ImageKnifeComponent default drawPlaceholder start!') data.drawPixelMap?.imagePixelMap?.getImageInfo().then((imageInfo) => { - LogUtil.log('ImageKnifeComponent imageinfo widht =' + imageInfo.size.width + ' height=' + imageInfo.size.height) + LogUtil.log('ImageKnifeComponent imageinfo width =' + imageInfo.size.width + ' height=' + imageInfo.size.height) let scaleType = (typeof imageKnifeOption.placeholderScaleType == 'number') ? imageKnifeOption.placeholderScaleType : ScaleType.FIT_CENTER context.save(); context.clearRect(0, 0, compWidth, compHeight) @@ -500,7 +500,7 @@ export struct ImageKnifeComponent { LogUtil.log('ImageKnifeComponent default drawThumbSizeMultiplier start!') data.drawPixelMap?.imagePixelMap?.getImageInfo().then((imageInfo) => { - LogUtil.log('ImageKnifeComponent imageinfo widht =' + imageInfo.size.width + ' height=' + imageInfo.size.height) + LogUtil.log('ImageKnifeComponent imageinfo width =' + imageInfo.size.width + ' height=' + imageInfo.size.height) let scaleType = (typeof imageKnifeOption.thumbSizeMultiplierScaleType == 'number') ? imageKnifeOption.thumbSizeMultiplierScaleType : ScaleType.FIT_CENTER context.save(); context.clearRect(0, 0, compWidth, compHeight) @@ -553,7 +553,7 @@ export struct ImageKnifeComponent { LogUtil.log('ImageKnifeComponent default drawErrorholder start!') data.drawPixelMap?.imagePixelMap?.getImageInfo().then((imageInfo) => { - LogUtil.log('ImageKnifeComponent imageinfo widht =' + imageInfo.size.width + ' height=' + imageInfo.size.height) + LogUtil.log('ImageKnifeComponent imageinfo width =' + imageInfo.size.width + ' height=' + imageInfo.size.height) let scaleType = (typeof imageKnifeOption.errorholderSrcScaleType == 'number') ? imageKnifeOption.errorholderSrcScaleType : ScaleType.FIT_CENTER context.save(); context.clearRect(0, 0, compWidth, compHeight) diff --git a/imageknife/src/main/ets/components/imageknife/networkmanage/LoadDataShareFileClient.ets b/imageknife/src/main/ets/components/imageknife/networkmanage/LoadDataShareFileClient.ets index 6ba18ab..e080a67 100644 --- a/imageknife/src/main/ets/components/imageknife/networkmanage/LoadDataShareFileClient.ets +++ b/imageknife/src/main/ets/components/imageknife/networkmanage/LoadDataShareFileClient.ets @@ -27,13 +27,13 @@ export class LoadDataShareFileClient implements IDataFetch { onComplete(buf); fs.close(file.fd); }).catch((err:BusinessError) => { - onError('LoadDataShareFileClient fs.read err happend uri=' + request.loadSrc + " err.msg=" + err?.message + " err.code=" + err?.code) + onError('LoadDataShareFileClient fs.read err happened uri=' + request.loadSrc + " err.msg=" + err?.message + " err.code=" + err?.code) }) }).catch((err:BusinessError) => { - onError('LoadDataShareFileClient fs.stat err happend uri=' + request.loadSrc + " err.msg=" + err?.message + " err.code=" + err?.code) + onError('LoadDataShareFileClient fs.stat err happened uri=' + request.loadSrc + " err.msg=" + err?.message + " err.code=" + err?.code) }) }).catch((err:BusinessError) => { - onError('LoadDataShareFileClient fs.open err happend uri=' + request.loadSrc + " err.msg=" + err?.message + " err.code=" + err?.code) + onError('LoadDataShareFileClient fs.open err happened uri=' + request.loadSrc + " err.msg=" + err?.message + " err.code=" + err?.code) }) } } diff --git a/imageknife/src/main/ets/components/imageknife/utils/FastBlur.ets b/imageknife/src/main/ets/components/imageknife/utils/FastBlur.ets index 1d86b37..86961fe 100644 --- a/imageknife/src/main/ets/components/imageknife/utils/FastBlur.ets +++ b/imageknife/src/main/ets/components/imageknife/utils/FastBlur.ets @@ -30,7 +30,7 @@ export namespace fastBlur { // // Java Author: Mario Klingemann // http://incubator.quasimondo.com -// created Feburary 29, 2004 +// created February 29, 2004 // port : Yahel Bouaziz // http://www.kayenko.com // ported april 5th, 2012 diff --git a/library/.gitignore b/sharedlibrary/.gitignore similarity index 100% rename from library/.gitignore rename to sharedlibrary/.gitignore diff --git a/library/build-profile.json5 b/sharedlibrary/build-profile.json5 similarity index 100% rename from library/build-profile.json5 rename to sharedlibrary/build-profile.json5 diff --git a/library/hvigorfile.ts b/sharedlibrary/hvigorfile.ts similarity index 100% rename from library/hvigorfile.ts rename to sharedlibrary/hvigorfile.ts diff --git a/library/oh-package.json5 b/sharedlibrary/oh-package.json5 similarity index 89% rename from library/oh-package.json5 rename to sharedlibrary/oh-package.json5 index beeccdc..e0cfa8a 100644 --- a/library/oh-package.json5 +++ b/sharedlibrary/oh-package.json5 @@ -1,5 +1,5 @@ { - "name": "library", + "name": "sharedlibrary", "version": "1.0.0", "description": "Please describe the basic information.", "main": "./src/main/ets/Index.ets", diff --git a/library/src/main/ets/Index.ets b/sharedlibrary/src/main/ets/Index.ets similarity index 100% rename from library/src/main/ets/Index.ets rename to sharedlibrary/src/main/ets/Index.ets diff --git a/library/src/main/ets/pages/Index.ets b/sharedlibrary/src/main/ets/pages/Index.ets similarity index 76% rename from library/src/main/ets/pages/Index.ets rename to sharedlibrary/src/main/ets/pages/Index.ets index 86f8d60..b34810d 100644 --- a/library/src/main/ets/pages/Index.ets +++ b/sharedlibrary/src/main/ets/pages/Index.ets @@ -22,15 +22,15 @@ struct Index { @State imageOption1:ImageKnifeOption = { loadSrc: $r('app.media.icon'), - context: getContext(this).createModuleContext('library') as common.UIAbilityContext + context: getContext(this).createModuleContext('sharedlibrary') as common.UIAbilityContext } @State imageOption2:ImageKnifeOption = { loadSrc: $r('app.media.icon'), - context: getContext(this).createModuleContext('library') as common.UIAbilityContext + context: getContext(this).createModuleContext('sharedlibrary') as common.UIAbilityContext } @State imageOption3:ImageKnifeOption = { loadSrc: $r('app.media.icon'), - context: getContext(this).createModuleContext('library') as common.UIAbilityContext + context: getContext(this).createModuleContext('sharedlibrary') as common.UIAbilityContext } build() { @@ -40,27 +40,27 @@ struct Index { this.imageOption1 = { loadSrc: $r('app.media.setting'), // 只要涉及resource加载 在HSP中都要带上context属性 - context: getContext(this).createModuleContext('library') as common.UIAbilityContext + context: getContext(this).createModuleContext('sharedlibrary') as common.UIAbilityContext } }) ImageKnifeComponent({imageKnifeOption:this.imageOption1}).width(300).height(300).backgroundColor(Color.Pink) Button('点击加载网络图片').onClick(()=>{ this.imageOption2 = { loadSrc: 'https://hbimg.huabanimg.com/cc6af25f8d782d3cf3122bef4e61571378271145735e9-vEVggB', - context: getContext(this).createModuleContext('library') as common.UIAbilityContext + context: getContext(this).createModuleContext('sharedlibrary') as common.UIAbilityContext } }) ImageKnifeComponent({imageKnifeOption:this.imageOption2}).width(300).height(300).backgroundColor(Color.Pink) Button('点击加载本地文件').onClick(()=>{ - getContext(this).createModuleContext('library').resourceManager.getMediaContent($r('app.media.setting').id).then((data:Uint8Array)=>{ + getContext(this).createModuleContext('sharedlibrary').resourceManager.getMediaContent($r('app.media.setting').id).then((data:Uint8Array)=>{ let ctx = ImageKnifeGlobal.getInstance().getHapContext() as common.UIAbilityContext; let path = ctx.filesDir+"/set.jpeg"; FileUtils.getInstance().writeFile(path,data.buffer) FileUtils.getInstance().readFilePicAsync(path).then(buffer=>{ this.imageOption3 = { loadSrc: path, - context: getContext(this).createModuleContext('library') as common.UIAbilityContext + context: getContext(this).createModuleContext('sharedlibrary') as common.UIAbilityContext } }) }) diff --git a/library/src/main/ets/pages/InitImageKnife.ets b/sharedlibrary/src/main/ets/pages/InitImageKnife.ets similarity index 100% rename from library/src/main/ets/pages/InitImageKnife.ets rename to sharedlibrary/src/main/ets/pages/InitImageKnife.ets diff --git a/library/src/main/module.json5 b/sharedlibrary/src/main/module.json5 similarity index 88% rename from library/src/main/module.json5 rename to sharedlibrary/src/main/module.json5 index 74570f9..7e37699 100644 --- a/library/src/main/module.json5 +++ b/sharedlibrary/src/main/module.json5 @@ -1,6 +1,6 @@ { "module": { - "name": "library", + "name": "sharedlibrary", "type": "shared", "description": "$string:shared_desc", "deviceTypes": [ diff --git a/library/src/main/resources/base/element/color.json b/sharedlibrary/src/main/resources/base/element/color.json similarity index 100% rename from library/src/main/resources/base/element/color.json rename to sharedlibrary/src/main/resources/base/element/color.json diff --git a/library/src/main/resources/base/element/string.json b/sharedlibrary/src/main/resources/base/element/string.json similarity index 100% rename from library/src/main/resources/base/element/string.json rename to sharedlibrary/src/main/resources/base/element/string.json diff --git a/library/src/main/resources/base/media/icon.png b/sharedlibrary/src/main/resources/base/media/icon.png similarity index 100% rename from library/src/main/resources/base/media/icon.png rename to sharedlibrary/src/main/resources/base/media/icon.png diff --git a/library/src/main/resources/base/media/setting.jpeg b/sharedlibrary/src/main/resources/base/media/setting.jpeg similarity index 100% rename from library/src/main/resources/base/media/setting.jpeg rename to sharedlibrary/src/main/resources/base/media/setting.jpeg diff --git a/library/src/main/resources/base/profile/main_pages.json b/sharedlibrary/src/main/resources/base/profile/main_pages.json similarity index 100% rename from library/src/main/resources/base/profile/main_pages.json rename to sharedlibrary/src/main/resources/base/profile/main_pages.json