1.适配 DevEco Studio 3.1Beta1及以上版本。

OpenHarmony SDK版本:API version 9及以上版本。

Signed-off-by: zhoulisheng1 <zhoulisheng1@huawei.com>
This commit is contained in:
zhoulisheng1 2023-02-24 15:08:33 +08:00
parent 8a611a8c6b
commit 7311a146a4
10 changed files with 146 additions and 154 deletions

View File

@ -1,3 +1,5 @@
## 1.0.6
- 变换能力的图片处理默认使用GPU提升处理效率。
## 1.0.5 ## 1.0.5
- 自定义组件已支持通用属性和通用事件绑定,因此ImageKnifeComponent将删除相关内容,相关内容由用户自定义实现,提高扩展能力 - 自定义组件已支持通用属性和通用事件绑定,因此ImageKnifeComponent将删除相关内容,相关内容由用户自定义实现,提高扩展能力

View File

@ -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及以上版本。
## 目录结构 ## 目录结构

View File

@ -1,16 +1,16 @@
{ {
"license": "ISC", "license": "ISC",
"devDependencies": {}, "devDependencies": {},
"name": "entry", "name": "entry",
"ohos": { "ohos": {
"org": "huawei", "org": "huawei",
"directoryLevel": "module", "directoryLevel": "module",
"buildTool": "hvigor" "buildTool": "hvigor"
}, },
"description": "example description", "description": "example description",
"repository": {}, "repository": {},
"version": "1.0.0", "version": "1.0.0",
"dependencies": { "dependencies": {
"@ohos/imageknife": "file:../imageknife" "@ohos/imageknife": "file:../imageknife"
} }
} }

View File

@ -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))
}
}

View File

@ -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() {
}
};

View File

@ -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');
}
}

View File

@ -2,7 +2,7 @@
"module": { "module": {
"name": "entry", "name": "entry",
"type": "entry", "type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:entry_desc", "description": "$string:entry_desc",
"mainElement": "MainAbility", "mainElement": "MainAbility",
"deviceTypes": [ "deviceTypes": [
@ -12,12 +12,17 @@
"deliveryWithInstall": true, "deliveryWithInstall": true,
"installationFree": false, "installationFree": false,
"pages": "$profile:main_pages", "pages": "$profile:main_pages",
"metadata": [
{
"name": "ArkTSPartialUpdate",
"value": "true"
}
],
"uiSyntax": "ets", "uiSyntax": "ets",
"abilities": [ "abilities": [
{ {
"name": "MainAbility", "name": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts", "srcEntrance": "./ets/entryability/EntryAbility.ts",
"description": "$string:MainAbility_desc", "description": "$string:MainAbility_desc",
"icon": "$media:icon", "icon": "$media:icon",
"label": "$string:MainAbility_label", "label": "$string:MainAbility_label",

View File

@ -1,24 +1,25 @@
{ {
"license":"Apache License 2.0", "types": "",
"types":"", "keywords": [
"devDependencies":{}, "OpenHarmony",
"keywords":[ "transformation",
"OpenHarmony", "gpuTransform",
"transformation", "HarmonyOS"
"gpu_transform" ],
], "author": "ohos_tpc",
"name":"@ohos/gpu_transform", "description": "based on OpenHarmony system, it can quickly realize image blur, Mosaic, sketch and other transformation effects through GPU",
"description":"based on OpenHarmony system, it can quickly realize image blur, Mosaic, sketch and other transformation effects through GPU", "ohos": {
"author":"ohos_tpc", "org": "opensource"
"ohos":{ },
"org":"opensource" "main": "index.ets",
}, "repository": "https://gitee.com/openharmony-tpc/ImageKnife",
"tags":[ "type": "module",
"Tool" "version": "0.1.0",
], "tags": [
"main":"index.ets", "Tool"
"repository":"https://gitee.com/openharmony-tpc/ImageKnife", ],
"type":"module", "dependencies": {},
"version":"1.0.0", "license": "Apache License 2.0",
"dependencies":{} "devDependencies": {},
} "name": "@ohos/gpu_transform"
}

View File

@ -1,33 +1,34 @@
{ {
"types": "", "types": "",
"keywords": [ "keywords": [
"OpenHarmony", "OpenHarmony",
"ImageKnife", "ImageKnife",
"glide" "glide",
], "HarmonyOS"
"author": "ohos_tpc", ],
"description": "专门为OpenHarmony打造的一款图像加载缓存库致力于更高效、更轻便、更简单", "author": "ohos_tpc",
"ohos": { "description": "专门为OpenHarmony打造的一款图像加载缓存库致力于更高效、更轻便、更简单",
"org": "opensource" "ohos": {
}, "org": "opensource"
"main": "index.ets", },
"repository": "https://gitee.com/openharmony-tpc/ImageKnife", "main": "index.ets",
"type": "module", "repository": "https://gitee.com/openharmony-tpc/ImageKnife",
"version": "1.0.5", "type": "module",
"dependencies": { "version": "1.0.6",
"pako": "^1.0.5", "dependencies": {
"js-binary-schema-parser": "^2.0.3", "pako": "^1.0.5",
"@ohos/disklrucache": "^1.0.0", "js-binary-schema-parser": "^2.0.3",
"@ohos/svg": "1.1.0", "@ohos/disklrucache": "^1.0.0",
"crc-32": "^1.2.0", "@ohos/svg": "1.1.0",
"spark-md5": "^3.0.2", "crc-32": "^1.2.0",
"@ohos/gpu_transform": "file:../gpu_transform" "spark-md5": "^3.0.2",
}, "@ohos/gpu_transform": "^0.1.0"
"tags": [ },
"ImageCache", "tags": [
"UI" "ImageCache",
], "UI"
"license": "Apache License 2.0", ],
"devDependencies": {}, "license": "Apache License 2.0",
"name": "@ohos/imageknife" "devDependencies": {},
"name": "@ohos/imageknife"
} }

View File

@ -1,19 +1,20 @@
{ {
"license":"ISC", "license": "ISC",
"devDependencies":{}, "devDependencies": {},
"name":"imageknife", "name": "imageknife",
"ohos":{ "ohos": {
"org":"huawei", "org": "huawei",
"directoryLevel":"project", "directoryLevel": "project",
"buildTool":"hvigor" "buildTool": "hvigor"
}, },
"description":"example description", "description": "example description",
"repository":{}, "repository": {},
"version":"1.0.0", "version": "1.0.0",
"dependencies":{ "dependencies": {
"@ohos/hypium":"1.0.3", "@ohos/hypium": "1.0.3",
"@ohos/hvigor-ohos-plugin":"1.3.1", "@ohos/hvigor-ohos-plugin": "1.4.0",
"hypium":"^1.0.0", "hypium": "^1.0.0",
"@ohos/hvigor":"1.3.1" "@ohos/hvigor": "1.4.0",
} "@ohos/gpu_transform": "^0.1.0"
} }
}