diff --git a/CHANGELOG.md b/CHANGELOG.md index 1513f95..6d65d46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## 1.0.6 +- 变换能力的图片处理默认使用GPU,提升处理效率。 ## 1.0.5 - 自定义组件已支持通用属性和通用事件绑定,因此ImageKnifeComponent将删除相关内容,相关内容由用户自定义实现,提高扩展能力 diff --git a/README.md b/README.md index f20fcbd..f214827 100644 --- a/README.md +++ b/README.md @@ -441,7 +441,8 @@ request.skipMemoryCache(true) ## 兼容性 -支持 OpenHarmony API version 9 及以上版本。 +- [DevEco Studio版本](https://developer.harmonyos.com/cn/develop/deveco-studio#download):DevEco Studio 3.1Beta1及以上版本。 +- OpenHarmony SDK版本:API version 9及以上版本。 ## 目录结构 diff --git a/entry/package.json b/entry/package.json index 4611da5..5acd003 100644 --- a/entry/package.json +++ b/entry/package.json @@ -1,16 +1,16 @@ { - "license": "ISC", - "devDependencies": {}, - "name": "entry", - "ohos": { - "org": "huawei", - "directoryLevel": "module", - "buildTool": "hvigor" - }, - "description": "example description", - "repository": {}, - "version": "1.0.0", - "dependencies": { - "@ohos/imageknife": "file:../imageknife" - } + "license": "ISC", + "devDependencies": {}, + "name": "entry", + "ohos": { + "org": "huawei", + "directoryLevel": "module", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/imageknife": "file:../imageknife" + } } diff --git a/entry/src/main/ets/Application/AbilityStage.ts b/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100644 index 3185f51..0000000 --- a/entry/src/main/ets/Application/AbilityStage.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import AbilityStage from '@ohos.application.AbilityStage' -import { ImageKnife,ImageKnifeDrawFactory} from '@ohos/imageknife' - -import ArkWorker from '@ohos.worker' - -export default class MyAbilityStage extends AbilityStage { - onCreate() { - globalThis.ImageKnife = ImageKnife.with(this.context); - - // 全局配置网络加载进度条 - globalThis.ImageKnife.setDefaultLifeCycle(ImageKnifeDrawFactory.createProgressLifeCycle("#10a5ff", 0.5)) - } -} \ No newline at end of file diff --git a/entry/src/main/ets/MainAbility/MainAbility.ts b/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100644 index 10d1cee..0000000 --- a/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import Ability from '@ohos.application.Ability' -import {ImageKnife} from '@ohos/imageknife' -export default class MainAbility extends Ability { - onCreate(want, launchParam) { - globalThis.abilityWant = want; - } - - onDestroy() { - } - - onWindowStageCreate(windowStage) { - windowStage.setUIContent(this.context, "pages/index", null) - } - - onWindowStageDestroy() { - } - - onForeground() { - } - - onBackground() { - } -}; diff --git a/entry/src/main/ets/entryability/EntryAbility.ts b/entry/src/main/ets/entryability/EntryAbility.ts new file mode 100644 index 0000000..2243e00 --- /dev/null +++ b/entry/src/main/ets/entryability/EntryAbility.ts @@ -0,0 +1,45 @@ +import UIAbility from '@ohos.app.ability.UIAbility'; +import hilog from '@ohos.hilog'; +import window from '@ohos.window'; +import { ImageKnife,ImageKnifeDrawFactory} from '@ohos/imageknife' + +export default class EntryAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + globalThis.ImageKnife = ImageKnife.with(this.context); + // 全局配置网络加载进度条 + globalThis.ImageKnife.setDefaultLifeCycle(ImageKnifeDrawFactory.createProgressLifeCycle("#10a5ff", 0.5)) + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index d69072a..7071f74 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -2,7 +2,7 @@ "module": { "name": "entry", "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ @@ -12,12 +12,17 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", - + "metadata": [ + { + "name": "ArkTSPartialUpdate", + "value": "true" + } + ], "uiSyntax": "ets", "abilities": [ { "name": "MainAbility", - "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "srcEntrance": "./ets/entryability/EntryAbility.ts", "description": "$string:MainAbility_desc", "icon": "$media:icon", "label": "$string:MainAbility_label", diff --git a/gpu_transform/package.json b/gpu_transform/package.json index e2644e5..0be7c9d 100644 --- a/gpu_transform/package.json +++ b/gpu_transform/package.json @@ -1,24 +1,25 @@ { - "license":"Apache License 2.0", - "types":"", - "devDependencies":{}, - "keywords":[ - "OpenHarmony", - "transformation", - "gpu_transform" - ], - "name":"@ohos/gpu_transform", - "description":"based on OpenHarmony system, it can quickly realize image blur, Mosaic, sketch and other transformation effects through GPU", - "author":"ohos_tpc", - "ohos":{ - "org":"opensource" - }, - "tags":[ - "Tool" - ], - "main":"index.ets", - "repository":"https://gitee.com/openharmony-tpc/ImageKnife", - "type":"module", - "version":"1.0.0", - "dependencies":{} -} \ No newline at end of file + "types": "", + "keywords": [ + "OpenHarmony", + "transformation", + "gpuTransform", + "HarmonyOS" + ], + "author": "ohos_tpc", + "description": "based on OpenHarmony system, it can quickly realize image blur, Mosaic, sketch and other transformation effects through GPU", + "ohos": { + "org": "opensource" + }, + "main": "index.ets", + "repository": "https://gitee.com/openharmony-tpc/ImageKnife", + "type": "module", + "version": "0.1.0", + "tags": [ + "Tool" + ], + "dependencies": {}, + "license": "Apache License 2.0", + "devDependencies": {}, + "name": "@ohos/gpu_transform" +} diff --git a/imageknife/package.json b/imageknife/package.json index 7de7f53..9d7b9fd 100644 --- a/imageknife/package.json +++ b/imageknife/package.json @@ -1,33 +1,34 @@ { - "types": "", - "keywords": [ - "OpenHarmony", - "ImageKnife", - "glide" - ], - "author": "ohos_tpc", - "description": "专门为OpenHarmony打造的一款图像加载缓存库,致力于更高效、更轻便、更简单", - "ohos": { - "org": "opensource" - }, - "main": "index.ets", - "repository": "https://gitee.com/openharmony-tpc/ImageKnife", - "type": "module", - "version": "1.0.5", - "dependencies": { - "pako": "^1.0.5", - "js-binary-schema-parser": "^2.0.3", - "@ohos/disklrucache": "^1.0.0", - "@ohos/svg": "1.1.0", - "crc-32": "^1.2.0", - "spark-md5": "^3.0.2", - "@ohos/gpu_transform": "file:../gpu_transform" - }, - "tags": [ - "ImageCache", - "UI" - ], - "license": "Apache License 2.0", - "devDependencies": {}, - "name": "@ohos/imageknife" + "types": "", + "keywords": [ + "OpenHarmony", + "ImageKnife", + "glide", + "HarmonyOS" + ], + "author": "ohos_tpc", + "description": "专门为OpenHarmony打造的一款图像加载缓存库,致力于更高效、更轻便、更简单", + "ohos": { + "org": "opensource" + }, + "main": "index.ets", + "repository": "https://gitee.com/openharmony-tpc/ImageKnife", + "type": "module", + "version": "1.0.6", + "dependencies": { + "pako": "^1.0.5", + "js-binary-schema-parser": "^2.0.3", + "@ohos/disklrucache": "^1.0.0", + "@ohos/svg": "1.1.0", + "crc-32": "^1.2.0", + "spark-md5": "^3.0.2", + "@ohos/gpu_transform": "^0.1.0" + }, + "tags": [ + "ImageCache", + "UI" + ], + "license": "Apache License 2.0", + "devDependencies": {}, + "name": "@ohos/imageknife" } diff --git a/package.json b/package.json index d7dc956..a09d904 100644 --- a/package.json +++ b/package.json @@ -1,19 +1,20 @@ { - "license":"ISC", - "devDependencies":{}, - "name":"imageknife", - "ohos":{ - "org":"huawei", - "directoryLevel":"project", - "buildTool":"hvigor" - }, - "description":"example description", - "repository":{}, - "version":"1.0.0", - "dependencies":{ - "@ohos/hypium":"1.0.3", - "@ohos/hvigor-ohos-plugin":"1.3.1", - "hypium":"^1.0.0", - "@ohos/hvigor":"1.3.1" - } -} \ No newline at end of file + "license": "ISC", + "devDependencies": {}, + "name": "imageknife", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.3", + "@ohos/hvigor-ohos-plugin": "1.4.0", + "hypium": "^1.0.0", + "@ohos/hvigor": "1.4.0", + "@ohos/gpu_transform": "^0.1.0" + } +}