diff --git a/BackgroundBlur/LICENSE b/BackgroundBlur/LICENSE index 338e5b0bc22082e0ffcc7121c2ed3897a3ddccb0..18795a48d6b12fcdc1aa7bac9a9cb99f83815267 100644 --- a/BackgroundBlur/LICENSE +++ b/BackgroundBlur/LICENSE @@ -1,4 +1,4 @@ - Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved. + Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/BackgroundBlur/README.en.md b/BackgroundBlur/README.en.md index 6152d7fd732828a3e1744db2db320af501034abb..92581dcc4462cec3b1b9e066bbe7b6fbfa75d32f 100644 --- a/BackgroundBlur/README.en.md +++ b/BackgroundBlur/README.en.md @@ -30,7 +30,7 @@ This example demonstrates the use of two color extraction methods and two blendi │ ├──entryability │ │ └──EntryAbility.ets // Entry ability lifecycle callbacks │ ├──entrybackupability -│ │ └──EntryBackupAbility.ets // Entry ability that provides backup and restore capabilities for the application +│ │ └──EntryBackupAbility.ets │ └──pages │ ├──MainPage.ets // View layer - parent page │ ├──MotionBlur.ets // View layer - motion blur page diff --git a/BackgroundBlur/README.md b/BackgroundBlur/README.md index 5dfa6da275c0d61eb3dc67b5bd5968581f8c0721..63ce6893af1f7cebc46281cc14bd6821d09766b2 100644 --- a/BackgroundBlur/README.md +++ b/BackgroundBlur/README.md @@ -30,7 +30,7 @@ │ ├──entryability │ │ └──EntryAbility.ets // Ability的生命周期回调内容 │ ├──entrybackupability -│ │ └──EntryBackupAbility.ets // 程序入口类 +│ │ └──EntryBackupAbility.ets │ └──pages │ ├──AdaptiveColorMode.ets // 视图层-使用AdaptiveColor取色效果页面 │ ├──ColorPickerMode.ets // 视图层-使用ColorPicker取色效果页面 diff --git a/BackgroundBlur/build-profile.json5 b/BackgroundBlur/build-profile.json5 index a756110ef798742c7375b6c94d99d51857af9002..adce96361e2c935e9a1f0c303bea4da26485e58b 100644 --- a/BackgroundBlur/build-profile.json5 +++ b/BackgroundBlur/build-profile.json5 @@ -16,21 +16,6 @@ "name": "release" } ], - "signingConfigs": [ - { - "name": "default", - "type": "HarmonyOS", - "material": { - "certpath": "C:\\Users\\chenb\\.ohos\\config\\default_BackgroundBlur_Km48mzyQ17s_I6oGwa-u906WD9GHKKS37Lb3OYDxEmQ=.cer", - "storePassword": "0000001ABA446A9B9F4CD49762E286EC19B9FF05D77AFBE4F485021778AF906B76A10E2C8F62FD076E9C", - "keyAlias": "debugKey", - "keyPassword": "0000001AF0FBB04A708EA24BA0C8B0F78548E2199D7EA30D2161FB07960C5E20492D93F5DAED8A9E90BF", - "profile": "C:\\Users\\chenb\\.ohos\\config\\default_BackgroundBlur_Km48mzyQ17s_I6oGwa-u906WD9GHKKS37Lb3OYDxEmQ=.p7b", - "signAlg": "SHA256withECDSA", - "storeFile": "C:\\Users\\chenb\\.ohos\\config\\default_BackgroundBlur_Km48mzyQ17s_I6oGwa-u906WD9GHKKS37Lb3OYDxEmQ=.p12" - } - } - ] }, "modules": [ { diff --git a/BackgroundBlur/entry/src/main/ets/pages/AdaptiveColorMode.ets b/BackgroundBlur/entry/src/main/ets/pages/AdaptiveColorMode.ets index 5a7b6c4d566981a2fc1c6aae0f5a4d9ab1bc8d5c..b1fae2ca4d211ffc0d4ef8a7b119c5442efb9bc8 100644 --- a/BackgroundBlur/entry/src/main/ets/pages/AdaptiveColorMode.ets +++ b/BackgroundBlur/entry/src/main/ets/pages/AdaptiveColorMode.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 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 @@ -13,27 +13,27 @@ * limitations under the License. */ -import { window } from '@kit.ArkUI'; - +// [Start adaptive_color] @Component export struct AdaptiveColorMode { @Consume('navPathStack') navPathStack: NavPathStack; build() { NavDestination() { - Column(){ + Column() { Row() { Text('Background Material Blur').fontColor('#FFFFFF') } .height('50%') .width('70%') + // just set the parameter adaptiveColor .backgroundEffect({ radius: 20, saturation: 1.0, brightness: 1.0, adaptiveColor: AdaptiveColor.AVERAGE }) - .position({x:'15%', y:'30%'}) + .position({ x: '15%', y: '30%' }) } .height('100%') .width('100%') @@ -43,4 +43,5 @@ export struct AdaptiveColorMode { } .hideTitleBar(true) } -} \ No newline at end of file +} +// [End adaptive_color] \ No newline at end of file diff --git a/BackgroundBlur/entry/src/main/ets/pages/ColorPickerMode.ets b/BackgroundBlur/entry/src/main/ets/pages/ColorPickerMode.ets index 896f4e02ac8baa51897796bdd48f4663a3aad187..4968691eb50ea6191723bcaf12704c817417e64c 100644 --- a/BackgroundBlur/entry/src/main/ets/pages/ColorPickerMode.ets +++ b/BackgroundBlur/entry/src/main/ets/pages/ColorPickerMode.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 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 @@ -13,6 +13,7 @@ * limitations under the License. */ +// [Start color_picker] import { image } from '@kit.ImageKit'; import { effectKit } from '@kit.ArkGraphics2D'; @@ -35,7 +36,9 @@ export struct ColorPickerMode { const buffer = fileData.buffer let imageSource = image.createImageSource(buffer as ArrayBuffer) this.pixMap = await imageSource.createPixelMap(); - this.kitColor = (await effectKit.createColorPicker(this.pixMap, [0,0,1,1])).getAverageColor(); + // create a color picker for color extraction + this.kitColor = (await effectKit.createColorPicker(this.pixMap, [0, 0, 1, 1])).getAverageColor(); + // convert to the format of the blur interface color parameter this.blurColor = 'rgba(' + this.kitColor.red + ',' + this.kitColor.green + ',' + this.kitColor.blue + ',0)'; } @@ -47,23 +50,26 @@ export struct ColorPickerMode { } .width('70%') .height('50%') + // assign a value to the color parameter of a blur interface .backgroundEffect({ radius: 20, saturation: 1.0, brightness: 1.0, color: this.blurColor }) - .position({x:'15%', y:'30%'}) + .position({ x: '15%', y: '30%' }) } .height('100%') .width('100%') .backgroundImage($r('app.media.test')) .backgroundImageSize(ImageSize.Cover) - .onAppear(()=>{ + .onAppear(() => { + // import image resources this.blurPix($r('app.media.test')); }) .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) } .hideTitleBar(true) } -} \ No newline at end of file +} +// [End color_picker] diff --git a/BackgroundBlur/entry/src/main/ets/pages/FastMode.ets b/BackgroundBlur/entry/src/main/ets/pages/FastMode.ets index 9ef5e9d7c826a6cb3d7d4653f0dedd86beeca894..008c1735ded3b7a6bb53a9138a7c4a844451fcab 100644 --- a/BackgroundBlur/entry/src/main/ets/pages/FastMode.ets +++ b/BackgroundBlur/entry/src/main/ets/pages/FastMode.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 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 @@ -13,8 +13,7 @@ * limitations under the License. */ -import { window } from '@kit.ArkUI'; - +// [Start fast_mode] @Component export struct FastMode { @Consume('navPathStack') navPathStack: NavPathStack; @@ -41,6 +40,7 @@ export struct FastMode { }.margin({ left: '16', right: '16' }) .height(300) .borderRadius(15) + // blend mode is set to fast mode .blendMode(BlendMode.SRC_OVER, BlendApplyType.FAST) } .width('100%') @@ -51,4 +51,5 @@ export struct FastMode { } .hideTitleBar(true) } -} \ No newline at end of file +} +// [End fast_mode] \ No newline at end of file diff --git a/BackgroundBlur/entry/src/main/ets/pages/MainPage.ets b/BackgroundBlur/entry/src/main/ets/pages/MainPage.ets index 74c3733a5147c7faae0f904de48b0ec3d313422b..08e021089fcf7e878dc643270e45b12a5f654c06 100644 --- a/BackgroundBlur/entry/src/main/ets/pages/MainPage.ets +++ b/BackgroundBlur/entry/src/main/ets/pages/MainPage.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 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 diff --git a/BackgroundBlur/entry/src/main/ets/pages/OffscreenMode.ets b/BackgroundBlur/entry/src/main/ets/pages/OffscreenMode.ets index f274c0898a8fb7056032954252fe3bce476d2530..17cfaecff4d130bb9602f197cef2e6f05db1e200 100644 --- a/BackgroundBlur/entry/src/main/ets/pages/OffscreenMode.ets +++ b/BackgroundBlur/entry/src/main/ets/pages/OffscreenMode.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 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 @@ -13,8 +13,7 @@ * limitations under the License. */ -import { window } from '@kit.ArkUI'; - +// [Start OffscreenMode] @Component export struct OffscreenMode { @Consume('navPathStack') navPathStack: NavPathStack; @@ -41,6 +40,7 @@ export struct OffscreenMode { }.margin({ left: '16', right: '16' }) .height(300) .borderRadius(15) + // blend mode is set to offscreen mode .blendMode(BlendMode.SRC_OVER, BlendApplyType.OFFSCREEN) } .width('100%') @@ -51,4 +51,5 @@ export struct OffscreenMode { } .hideTitleBar(true) } -} \ No newline at end of file +} +// [End OffscreenMode] \ No newline at end of file