From f627a1a431c95530023d78523400e90ec97b4890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A2=A6=E9=BE=99?= Date: Tue, 16 Sep 2025 02:58:33 +0000 Subject: [PATCH 01/18] update ArkTS/entry/src/main/ets/pages/AOPReplaced.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨梦龙 --- ArkTS/entry/src/main/ets/pages/AOPReplaced.ets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ArkTS/entry/src/main/ets/pages/AOPReplaced.ets b/ArkTS/entry/src/main/ets/pages/AOPReplaced.ets index aef4e458..4f76d8c1 100644 --- a/ArkTS/entry/src/main/ets/pages/AOPReplaced.ets +++ b/ArkTS/entry/src/main/ets/pages/AOPReplaced.ets @@ -39,10 +39,10 @@ export struct AOPReplaced { .fontSize(50) .fontWeight(FontWeight.Bold) .onClick(() => { - // 获取 myMethod 的属性描述符 + // Obtain the property descriptor of myMethod let des = ObjectUtil.ObjectGetOwnPropertyDescriptor(Test, 'printData') console.log('des',JSON.stringify(des)) - // 判断 writable 字段是否为 true + // Determine whether the writable field is true if (des && des.writable) { console.log('Method is writable'); } else { -- Gitee From 523b175d527a68cb38f28806b8eea1c73444f1bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A2=A6=E9=BE=99?= Date: Tue, 16 Sep 2025 03:04:16 +0000 Subject: [PATCH 02/18] update ArkUI/entry/src/main/ets/pages/ReplaceDefaultTimeSet.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨梦龙 --- ArkUI/entry/src/main/ets/pages/ReplaceDefaultTimeSet.ets | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ArkUI/entry/src/main/ets/pages/ReplaceDefaultTimeSet.ets b/ArkUI/entry/src/main/ets/pages/ReplaceDefaultTimeSet.ets index ba6a9ae5..a3c92ffd 100644 --- a/ArkUI/entry/src/main/ets/pages/ReplaceDefaultTimeSet.ets +++ b/ArkUI/entry/src/main/ets/pages/ReplaceDefaultTimeSet.ets @@ -212,7 +212,7 @@ struct ReplaceDefaultTimeSetPage { LongPressGesture({ repeat: true, duration: 50 - })//控制触发拖动的长按事件的时间,默认500毫秒,设置小于0为默认值,这里设置为50毫秒 + }) // Control the duration of the long-press event that triggers dragging, defaulting to 500 milliseconds. Setting it to less than 0 reverts to the default value; here it is set to 50 milliseconds .onAction((_event?: GestureEvent) => { this.getUIContext().animateTo({ curve: Curve.Friction, @@ -245,7 +245,6 @@ struct ReplaceDefaultTimeSetPage { this.getUIContext().animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => { let index = this.numbers.indexOf(this.dragItem); - // 44 宽度一半 减间距 if (this.offsetY >= this.FIX_VP_Y / 2 && (this.offsetX <= this.FIX_VP_X / 2 && this.offsetX >= -this.FIX_VP_X / 2) && (index + this.row <= this.lastIndex)) { -- Gitee From 9c39cc409567be693df18cd810cce04ab238b5c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A2=A6=E9=BE=99?= Date: Tue, 16 Sep 2025 03:06:20 +0000 Subject: [PATCH 03/18] update ArkUI/entry/src/main/ets/pages/XComponentSurfaceRenderFit.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨梦龙 --- ArkUI/entry/src/main/ets/pages/XComponentSurfaceRenderFit.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArkUI/entry/src/main/ets/pages/XComponentSurfaceRenderFit.ets b/ArkUI/entry/src/main/ets/pages/XComponentSurfaceRenderFit.ets index be3772e3..25f8b815 100644 --- a/ArkUI/entry/src/main/ets/pages/XComponentSurfaceRenderFit.ets +++ b/ArkUI/entry/src/main/ets/pages/XComponentSurfaceRenderFit.ets @@ -27,7 +27,7 @@ struct XComponentSurfaceRenderFit { build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) { XComponent({ - id: 'myXComponent_RenderFitSurface', // 当id的字符串中包含"RenderFitSurface"时,可以使RenderFit显示正确。 + id: 'myXComponent_RenderFitSurface', // When the string of the id contains "RenderFitSurface", RenderFit can be displayed correctly type: XComponentType.SURFACE, controller: this.myXComponentController }) -- Gitee From 13803a7f924f1eedd6bd43e850962848ba9b1d23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A2=A6=E9=BE=99?= Date: Tue, 16 Sep 2025 03:07:33 +0000 Subject: [PATCH 04/18] update ArkUI/entry/src/main/ets/pages/NavigationJumpToPageWithWhiteScreen.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨梦龙 --- .../src/main/ets/pages/NavigationJumpToPageWithWhiteScreen.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArkUI/entry/src/main/ets/pages/NavigationJumpToPageWithWhiteScreen.ets b/ArkUI/entry/src/main/ets/pages/NavigationJumpToPageWithWhiteScreen.ets index 1a1427fd..5b04df7a 100644 --- a/ArkUI/entry/src/main/ets/pages/NavigationJumpToPageWithWhiteScreen.ets +++ b/ArkUI/entry/src/main/ets/pages/NavigationJumpToPageWithWhiteScreen.ets @@ -18,7 +18,7 @@ */ // [Start NavigationJumpToPageWithWhiteScreen] -// 跳转页面入口函数 +// Jump Page Entry Function @Builder export function pageOneBuilder() { NavigationJumpToPageWithWhiteScreen(); -- Gitee From 10046ce77a6731524d83b124609f448adc3bbb44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A2=A6=E9=BE=99?= Date: Tue, 16 Sep 2025 03:08:44 +0000 Subject: [PATCH 05/18] update ArkUI/entry/src/main/moduleNavigationJumpToPageWithWhiteScreen.json5. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨梦龙 --- .../src/main/moduleNavigationJumpToPageWithWhiteScreen.json5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArkUI/entry/src/main/moduleNavigationJumpToPageWithWhiteScreen.json5 b/ArkUI/entry/src/main/moduleNavigationJumpToPageWithWhiteScreen.json5 index b70d539b..99abc862 100644 --- a/ArkUI/entry/src/main/moduleNavigationJumpToPageWithWhiteScreen.json5 +++ b/ArkUI/entry/src/main/moduleNavigationJumpToPageWithWhiteScreen.json5 @@ -21,7 +21,7 @@ "module": { "name": "feature_splash", "type": "feature", - // type类型需要为: "har"或者"shared" + // The type needs to be either "har" or "shared" // [End json5] "description": "$string:module_desc", "mainElement": "EntryAbility", -- Gitee From 17e3d06872a66e4767173bfbb9e2dd88630f87a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A2=A6=E9=BE=99?= Date: Tue, 16 Sep 2025 03:09:51 +0000 Subject: [PATCH 06/18] update ArkWebKit/entry/src/main/ets/pages/SupportVue.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨梦龙 --- ArkWebKit/entry/src/main/ets/pages/SupportVue.ets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ArkWebKit/entry/src/main/ets/pages/SupportVue.ets b/ArkWebKit/entry/src/main/ets/pages/SupportVue.ets index e9df9f2c..76d5bbee 100644 --- a/ArkWebKit/entry/src/main/ets/pages/SupportVue.ets +++ b/ArkWebKit/entry/src/main/ets/pages/SupportVue.ets @@ -29,13 +29,13 @@ struct WebComponent { build() { Column() { Button('loadUrl').onClick(() => { - try { // 点击按钮时,通过loadUrl,跳转到www.example1.com + try { // When the button is clicked, it redirects to www.example1.com via loadUrl this.webviewController.loadUrl('www.example1.com'); } catch (error) { console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); } }) - // 组件创建时,加载www.example.com + // When the component is created, load www.example.com Web({ src: 'www.example.com', controller: this.webviewController }) } } -- Gitee From 237b26bde8244033182e86e20bff63e2c716aa1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A2=A6=E9=BE=99?= Date: Tue, 16 Sep 2025 03:10:52 +0000 Subject: [PATCH 07/18] update ArkWebKit/entry/src/main/ets/pages/SupportVue2.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨梦龙 --- ArkWebKit/entry/src/main/ets/pages/SupportVue2.ets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ArkWebKit/entry/src/main/ets/pages/SupportVue2.ets b/ArkWebKit/entry/src/main/ets/pages/SupportVue2.ets index d19dc1ce..8c5d7762 100644 --- a/ArkWebKit/entry/src/main/ets/pages/SupportVue2.ets +++ b/ArkWebKit/entry/src/main/ets/pages/SupportVue2.ets @@ -30,13 +30,13 @@ struct WebComponent { Button('loadUrl') .onClick(() => { try { - // 点击按钮时,通过resource加载resources/rawfile目录下的local1.html文件 + // When the button is clicked, load the local1.html file from the resources/rawfile directory via resource this.webviewController.loadUrl('resource://rawfile/local1.html'); } catch (error) { console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); } }) - // 组件创建时,使用resource协议加载本地文件local.html + // When creating the component, use the resource protocol to load the local file local.html Web({ src: 'resource://rawfile/local.html', controller: this.webviewController }) } } -- Gitee From 8e376217dd10927725a2947acd8f5b30ecb86115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A2=A6=E9=BE=99?= Date: Tue, 16 Sep 2025 03:12:32 +0000 Subject: [PATCH 08/18] update ArkWebKit/entry/src/main/ets/pages/SupportVue3.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨梦龙 --- ArkWebKit/entry/src/main/ets/pages/SupportVue3.ets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ArkWebKit/entry/src/main/ets/pages/SupportVue3.ets b/ArkWebKit/entry/src/main/ets/pages/SupportVue3.ets index a8566ea0..53e8907c 100644 --- a/ArkWebKit/entry/src/main/ets/pages/SupportVue3.ets +++ b/ArkWebKit/entry/src/main/ets/pages/SupportVue3.ets @@ -30,7 +30,7 @@ struct WebComponent { Button('loadData') .onClick(() => { try { - // 点击按钮时,通过loadData,加载HTML格式的文本数据 + // When the button is clicked, load HTML-formatted text data using loadData this.controller.loadData( "Source:
source
", "text/html", @@ -40,7 +40,7 @@ struct WebComponent { console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); } }) - // 组件创建时,加载www.example.com + // When the component is created, load www.example.com Web({ src: 'www.example.com', controller: this.controller }) } } -- Gitee From 6142da082d3bbe03ad62822028382d8bae6b9baf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A2=A6=E9=BE=99?= Date: Tue, 16 Sep 2025 03:13:41 +0000 Subject: [PATCH 09/18] update ArkWebKit/entry/src/main/ets/pages/DebugProcessId.txt. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨梦龙 --- ArkWebKit/entry/src/main/ets/pages/DebugProcessId.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ArkWebKit/entry/src/main/ets/pages/DebugProcessId.txt b/ArkWebKit/entry/src/main/ets/pages/DebugProcessId.txt index 5041e091..19d71393 100644 --- a/ArkWebKit/entry/src/main/ets/pages/DebugProcessId.txt +++ b/ArkWebKit/entry/src/main/ets/pages/DebugProcessId.txt @@ -47,10 +47,10 @@ echo. echo Script executed successfully. Press any key to exit... pause >nul -:: 尝试在 Edge 中打开页面 +:: Try opening the page in Edge start msedge chrome://inspect/#devices.com -:: 如果 Edge 不可用,那么在 Chrome 中打开页面 +:: If Edge is unavailable, open the page in Chrome if errorlevel 1 ( start chrome chrome://inspect/#devices.com ) -- Gitee From 68b67f139b6ca776e7ed87090547b24fe1ae3b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A2=A6=E9=BE=99?= Date: Tue, 16 Sep 2025 03:17:34 +0000 Subject: [PATCH 10/18] update CryptoArchitectureKit/entry/src/main/ets/pages/RsaDecrypt.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨梦龙 --- .../entry/src/main/ets/pages/RsaDecrypt.ets | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CryptoArchitectureKit/entry/src/main/ets/pages/RsaDecrypt.ets b/CryptoArchitectureKit/entry/src/main/ets/pages/RsaDecrypt.ets index 48859e5e..2f0db1a8 100644 --- a/CryptoArchitectureKit/entry/src/main/ets/pages/RsaDecrypt.ets +++ b/CryptoArchitectureKit/entry/src/main/ets/pages/RsaDecrypt.ets @@ -21,14 +21,14 @@ import { cryptoFramework } from '@kit.CryptoArchitectureKit'; import { buffer, util } from '@kit.ArkTS'; -// 字符串转成字节流 +// Convert string to byte stream function stringToUint8Array(str: string) { return new Uint8Array(buffer.from(str, 'utf-8').buffer); } -// 字节流转成可理解的字符串 +// Convert byte stream into an understandable string function uint8ArrayToString(array: Uint8Array) { - // 将UTF-8编码转换成Unicode编码 + // Convert UTF-8 encoding to Unicode encoding let out: string = ''; let index: number = 0; let len: number = array.length; @@ -68,8 +68,8 @@ export class KeyPair { export class RSA { private ASY_KEY_NAME_RSA_3072: string = 'RSA1024'; private ALG_NAME_RSA_3072: string = 'RSA|PKCS1'; - static priKey: Uint8Array = new Uint8Array(); //用于临时保存 - static pubKey: Uint8Array = new Uint8Array(); //用于临时保存 + static priKey: Uint8Array = new Uint8Array(); // For temporary storage + static pubKey: Uint8Array = new Uint8Array(); // For temporary storage private base: util.Base64Helper = new util.Base64Helper(); public async generateRsaKeyPair(): Promise { @@ -91,9 +91,9 @@ export class RSA { let result = ''; try { let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(this.ASY_KEY_NAME_RSA_3072); - //创建一个 Cipher (解密)对象 + // Create a Cipher (decryption) object let cipher = cryptoFramework.createCipher(this.ALG_NAME_RSA_3072); - //引入外部的公钥加密 + // Introduce external public key encryption let keyGenPromise: cryptoFramework.KeyPair = await asyKeyGenerator.convertKey({ data: this.base.decodeSync(publicKey) }, null); await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, keyGenPromise.pubKey, null); @@ -112,7 +112,7 @@ export class RSA { try { let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(this.ASY_KEY_NAME_RSA_3072); const keyPair = await asyKeyGenerator.convertKey(null, { data: this.base.decodeSync(privateKey) }); - let cipher = cryptoFramework.createCipher(this.ALG_NAME_RSA_3072); //创建一个 Cipher (解密)对象 + let cipher = cryptoFramework.createCipher(this.ALG_NAME_RSA_3072); // Create a Cipher (decryption) object await cipher.init(cryptoFramework.CryptoMode.DECRYPT_MODE, keyPair.priKey, null); let bytes: Uint8Array | string = message; if (typeof message === 'string') { -- Gitee From b9c3628bf30a1af29924d1d16e536a1702e5443a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A2=A6=E9=BE=99?= Date: Tue, 16 Sep 2025 03:19:15 +0000 Subject: [PATCH 11/18] update CryptoArchitectureKit/entry/src/main/ets/pages/EncryptionAndDecryption.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨梦龙 --- .../src/main/ets/pages/EncryptionAndDecryption.ets | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CryptoArchitectureKit/entry/src/main/ets/pages/EncryptionAndDecryption.ets b/CryptoArchitectureKit/entry/src/main/ets/pages/EncryptionAndDecryption.ets index 37ba16b8..ee34c088 100644 --- a/CryptoArchitectureKit/entry/src/main/ets/pages/EncryptionAndDecryption.ets +++ b/CryptoArchitectureKit/entry/src/main/ets/pages/EncryptionAndDecryption.ets @@ -26,17 +26,17 @@ let pubKeyStr = uint8ArrayToHexStr(base.decodeSync('公钥')); let priKeyStr = uint8ArrayToHexStr(base.decodeSync('私钥')); async function encryptionAndDecryption() { - // 根据密钥参数生成公私钥 + // Generate public and private keys based on the key parameters let pk = await convertStrToPubKey(pubKeyStr); let sk = await convertStrToPriKey(priKeyStr); - //加密 + // Encryption let encryptText = await encryptMessagePromise(pk, '加密信息'); - //解密 + // Decryption let res = await decryptMessagePromise(sk, encryptText); } -//根据密钥参数生成sm2公钥 +// Generate SM2 public key based on key parameters async function convertStrToPubKey(keyStr: string): Promise { let pubKeyStr = keyStr.startsWith("04") ? keyStr.slice(2) : keyStr; let pkPart1 = pubKeyStr.slice(0, pubKeyStr.length / 2); @@ -55,7 +55,7 @@ async function convertStrToPubKey(keyStr: string): Promise { let sk = BigInt("0x" + keyStr); let priKeySpec: cryptoFramework.ECCPriKeySpec = { @@ -68,7 +68,7 @@ async function convertStrToPriKey(keyStr: string): Promise Date: Tue, 16 Sep 2025 03:21:36 +0000 Subject: [PATCH 12/18] update CryptoArchitectureKit/entry/src/main/ets/pages/HMACFailed.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨梦龙 --- .../entry/src/main/ets/pages/HMACFailed.ets | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CryptoArchitectureKit/entry/src/main/ets/pages/HMACFailed.ets b/CryptoArchitectureKit/entry/src/main/ets/pages/HMACFailed.ets index 2da8127b..72df200c 100644 --- a/CryptoArchitectureKit/entry/src/main/ets/pages/HMACFailed.ets +++ b/CryptoArchitectureKit/entry/src/main/ets/pages/HMACFailed.ets @@ -29,16 +29,16 @@ struct HMACFailed { @State message: string = 'Hello World'; // [EndExclude HMACFailed] ConvertKeySync() { - // 对称密钥长度为28字节,224比特。 - let keyMessage = '87654321abcdefgh87654321abcd'; // 执行成功 - // 执行成功,key encoded data:56,55,54,53,52,51,50,49,97,98,99,100,101,102,103,104,56,55,54,53,52,51,50,49,97,98,99,100 - // 对称密钥长度为26字节,208比特。 - // let keyMessage = '87654321abcdefgh87654321ab'; // 执行失败 - // 执行失败,报错:Error message:convertSymKey key failed! + // The symmetric key length is 28 bytes, 224 bits + let keyMessage = '87654321abcdefgh87654321abcd'; // Execution successful + // Execution successful. key encoded data:56,55,54,53,52,51,50,49,97,98,99,100,101,102,103,104,56,55,54,53,52,51,50,49,97,98,99,100 + // The symmetric key length is 26 bytes, 208 bits + // let keyMessage = '87654321abcdefgh87654321ab'; // Execution failed + // Execution failed,error message: convertSymKey key failed! let keyBlob: cryptoFramework.DataBlob = { data: new Uint8Array(buffer.from(keyMessage, 'utf-8').buffer) } - // 消息认证码算法:HMAC,摘要算法:SHA224,密钥长度(bit):224,字符串参数:HMAC|SHA224 + // Message Authentication Code Algorithm: HMAC, Digest Algorithm: SHA224, Key Length (bits): 224, String Parameter: HMAC|SHA224 let symKeyGenerator = cryptoFramework.createSymKeyGenerator('HMAC|SHA224'); let key = symKeyGenerator.convertKeySync(keyBlob); let encodedKey = key.getEncoded(); -- Gitee From 7fe5e4525b759b5e0f0613cc0c46d0311f277eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A2=A6=E9=BE=99?= Date: Tue, 16 Sep 2025 03:23:56 +0000 Subject: [PATCH 13/18] update ImageKit/entry/src/main/ets/pages/ImageUpload.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨梦龙 --- ImageKit/entry/src/main/ets/pages/ImageUpload.ets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ImageKit/entry/src/main/ets/pages/ImageUpload.ets b/ImageKit/entry/src/main/ets/pages/ImageUpload.ets index 7d469aeb..f39c9ed2 100644 --- a/ImageKit/entry/src/main/ets/pages/ImageUpload.ets +++ b/ImageKit/entry/src/main/ets/pages/ImageUpload.ets @@ -27,7 +27,7 @@ import { common } from '@kit.AbilityKit'; @Component struct Index { private openPhotoPicker() { - // 获取应用文件路径 + // Obtain the application file path let context = this.getUIContext().getHostContext() as common.UIAbilityContext; let cacheDir = context.cacheDir; let photoPicker = new photoAccessHelper.PhotoViewPicker(); @@ -38,7 +38,7 @@ struct Index { if (result) { result.photoUris.forEach((uri) => { let file = fs.openSync(uri, fs.OpenMode.CREATE); - // 复制文件到缓存目录下 + // Copy the file to the cache directory fs.copyFileSync(file.fd, cacheDir + '/test.jpeg'); this.uploadImage(['internal://cache/test.jpeg']); }) -- Gitee From 782aa77d545eff88fc67dfedb9326f1cb92e467f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A2=A6=E9=BE=99?= Date: Tue, 16 Sep 2025 03:24:57 +0000 Subject: [PATCH 14/18] update ImageKit/entry/src/main/ets/pages/SelectedAlbumPictureGeneratePixelMap_One.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨梦龙 --- .../ets/pages/SelectedAlbumPictureGeneratePixelMap_One.ets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ImageKit/entry/src/main/ets/pages/SelectedAlbumPictureGeneratePixelMap_One.ets b/ImageKit/entry/src/main/ets/pages/SelectedAlbumPictureGeneratePixelMap_One.ets index 8dd915ae..eb7d97b0 100644 --- a/ImageKit/entry/src/main/ets/pages/SelectedAlbumPictureGeneratePixelMap_One.ets +++ b/ImageKit/entry/src/main/ets/pages/SelectedAlbumPictureGeneratePixelMap_One.ets @@ -41,7 +41,7 @@ struct WebComponent { uris = PhotoSelectResult.photoUris; let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(context); let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates(); - // 配置查询条件,使用PhotoViewPicker选择图片返回的uri进行查询 + // Configure query conditions, use PhotoViewPicker to select the URI of the image to be queried predicates.equalTo('uri', uris[0]); let fetchOptions: photoAccessHelper.FetchOptions = { fetchColumns: [], @@ -52,7 +52,7 @@ struct WebComponent { console.info('fetchResult success'); let photoAsset: photoAccessHelper.PhotoAsset = await fetchResult.getFirstObject(); if (photoAsset !== undefined) { - // 获取缩略图 + // Get Thumbnail photoAsset.getThumbnail((err, pixelMap) => { if (err == undefined) { console.info('getThumbnail successful ' + JSON.stringify(pixelMap)); -- Gitee From fe8b23ebfe092cc69f3672611c52f1a047144555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A2=A6=E9=BE=99?= Date: Tue, 16 Sep 2025 03:26:10 +0000 Subject: [PATCH 15/18] update ImageKit/CPixelMapToMat/src/main/ets/pages/Index.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨梦龙 --- ImageKit/CPixelMapToMat/src/main/ets/pages/Index.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ImageKit/CPixelMapToMat/src/main/ets/pages/Index.ets b/ImageKit/CPixelMapToMat/src/main/ets/pages/Index.ets index a556cf1e..5fd994d4 100644 --- a/ImageKit/CPixelMapToMat/src/main/ets/pages/Index.ets +++ b/ImageKit/CPixelMapToMat/src/main/ets/pages/Index.ets @@ -42,7 +42,7 @@ struct Index { this.pixelMap = await imageResource.createPixelMap(opts); } - const readBuffer: ArrayBuffer = new ArrayBuffer(this.pixelMap.getPixelBytesNumber()); // 获取pixelmap的arraybuffer + const readBuffer: ArrayBuffer = new ArrayBuffer(this.pixelMap.getPixelBytesNumber()); // Obtain the array buffer of the pixelmap console.info("readBuffer length: " + readBuffer.byteLength); this.pixelMap.readPixelsToBuffer(readBuffer).then(() => { console.info("No Error!") -- Gitee From 7b986d6628950cd033375f69252c154df9b74964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A2=A6=E9=BE=99?= Date: Tue, 16 Sep 2025 03:28:18 +0000 Subject: [PATCH 16/18] update ImageKit/CPixelMapToMat/src/main/cpp/napi_init.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨梦龙 --- .../CPixelMapToMat/src/main/cpp/napi_init.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ImageKit/CPixelMapToMat/src/main/cpp/napi_init.cpp b/ImageKit/CPixelMapToMat/src/main/cpp/napi_init.cpp index 09558d21..3207ebf5 100644 --- a/ImageKit/CPixelMapToMat/src/main/cpp/napi_init.cpp +++ b/ImageKit/CPixelMapToMat/src/main/cpp/napi_init.cpp @@ -35,18 +35,18 @@ static napi_value ArrayBufferToMat(napi_env env, napi_callback_info info) { napi_value error; napi_create_int32(env, -1, &error); - // 初始化PixelMap对象数据 + // Initialize PixelMap object data NativePixelMap *native = OH_PixelMap_InitNativePixelMap(env, args[0]); if (native == nullptr) { return error; } - // 获取图片信息 + // Obtaining Image Information struct OhosPixelMapInfos pixelMapInfos; if (OH_PixelMap_GetImageInfo(native, &pixelMapInfos) != IMAGE_RESULT_SUCCESS) { OH_LOG_Print(LOG_APP, LOG_ERROR, 0xFF00, "Test", "Pure : -1"); return error; } - // 获取buffer + // Obtains the buffer napi_value buffer = args[1]; napi_valuetype valueType; napi_typeof(env, buffer, &valueType); @@ -63,14 +63,14 @@ static napi_value ArrayBufferToMat(napi_env env, napi_callback_info info) { napi_get_arraybuffer_info(env, buffer, &data, &byteLength); int32_t *saveBuffer = (int32_t *)(data); - // 转换成Mat + // Convert to Mat cv::Mat originMat(pixelMapInfos.height, pixelMapInfos.width, CV_8UC4, saveBuffer); if (!originMat.data) { OH_LOG_Print(LOG_APP, LOG_ERROR, 0xFF00, "Read Image", "Pure : -1"); return error; } - // opencv默认bgra或bgr,若pixelmap创建时未指定为这两种格式,需要进行格式转换 + // openCV defaults to BGRA or BGR. If the pixelmap is not created in one of these formats, a format conversion is required cv::Mat saveMat; cv::cvtColor(originMat, saveMat, cv::COLOR_BGRA2RGBA); char pathArray[1024]; @@ -109,17 +109,17 @@ static napi_value AccessToMat(napi_env env, napi_callback_info info) { } void *pixel; - // 获取NativePixelMap对象的内存地址并锁定内存 + // Obtain the memory address of the NativePixelMap object and lock the memory OH_PixelMap_AccessPixels(native, &pixel); - // 转换成Mat,注意对齐,所以要传入rowSize + // Convert to Mat, pay attention to alignment, so rowSize needs to be passed in cv::Mat originMat(pixelMapInfos.height, pixelMapInfos.width, CV_8UC4, pixel, pixelMapInfos.rowSize); if (!originMat.data) { OH_LOG_Print(LOG_APP, LOG_ERROR, 0xFF00, "Read Image", "Pure : -1"); return error; } - // opencv默认bgra或bgr,若pixelmap创建时未指定为这两种格式,需要进行格式转换 + // openCV defaults to BGRA or BGR. If the pixelmap is not created in one of these formats, a format conversion is required cv::Mat saveMat; cv::cvtColor(originMat, saveMat, cv::COLOR_BGRA2RGBA); char pathArray[1024]; -- Gitee From 2b01469bb1cf1474543d3f2706bcc60769c51e45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A2=A6=E9=BE=99?= Date: Tue, 16 Sep 2025 03:29:22 +0000 Subject: [PATCH 17/18] update ImageKit/entry/src/main/ets/pages/PixelMapSaveToAlbum.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨梦龙 --- ImageKit/entry/src/main/ets/pages/PixelMapSaveToAlbum.ets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ImageKit/entry/src/main/ets/pages/PixelMapSaveToAlbum.ets b/ImageKit/entry/src/main/ets/pages/PixelMapSaveToAlbum.ets index 5ec8a8bc..790ce328 100644 --- a/ImageKit/entry/src/main/ets/pages/PixelMapSaveToAlbum.ets +++ b/ImageKit/entry/src/main/ets/pages/PixelMapSaveToAlbum.ets @@ -39,7 +39,7 @@ struct SavePixelMapToAlbum { async aboutToAppear() { const resourceMgr: resourceManager.ResourceManager = this.context.resourceManager; - // beer.jpeg为rawfile文件下的图片名,可根据自身需求修改使用。 + // "beer.jpeg" is the name of the image file under the rawfile directory, which can be modified and used according to your own needs const fileData: Uint8Array = await resourceMgr.getRawFileContent('beer.jpeg'); let buffer = new Uint8Array(fileData).buffer as object as ArrayBuffer; let imageResource = image.createImageSource(buffer); @@ -48,7 +48,7 @@ struct SavePixelMapToAlbum { } async savePixelMapToAlbum() { - // 获取相册的保存路径 + // Obtain the save path of the album let helper = photoAccessHelper.getPhotoAccessHelper(this.context); let uri = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE, 'jpeg'); let file = await fileIo.open(uri, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE); -- Gitee From b8f107c8de2b37d47d74be35bf9e8a3059edf74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A2=A6=E9=BE=99?= Date: Tue, 16 Sep 2025 03:31:10 +0000 Subject: [PATCH 18/18] update ImageKit/entry/src/main/ets/pages/SaveWebPictureToAlbum.ets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨梦龙 --- .../src/main/ets/pages/SaveWebPictureToAlbum.ets | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ImageKit/entry/src/main/ets/pages/SaveWebPictureToAlbum.ets b/ImageKit/entry/src/main/ets/pages/SaveWebPictureToAlbum.ets index 15954440..50e52fe3 100644 --- a/ImageKit/entry/src/main/ets/pages/SaveWebPictureToAlbum.ets +++ b/ImageKit/entry/src/main/ets/pages/SaveWebPictureToAlbum.ets @@ -57,12 +57,12 @@ struct SaveImage { }; let options: Record = { - 'alphaType': 0, // 透明度 - 'editable': false, // 是否可编辑 - 'pixelFormat': 3, // 像素格式 - 'scaleMode': 1, // 缩略值 + 'alphaType': 0, // Transparency + 'editable': false, // Is it editable + 'pixelFormat': 3, // Pixel Format + 'scaleMode': 1, // Abbreviation 'size': { height: 100, width: 100 } - }; // 创建图片大小 + }; // Create Image Size imageSource.createPixelMap(options).then((pixelMap: PixelMap) => { this.pixelMap = pixelMap; this.pixelMap.getImageInfo().then((info: image.ImageInfo) => { @@ -76,10 +76,10 @@ struct SaveImage { let helper = photoAccessHelper.getPhotoAccessHelper(context); let uri = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE, 'png'); let file = await fs.open(uri, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); - // 写入文件 + // Write to file await fs.write(file.fd, buffer); this.getUIContext().getPromptAction().showToast({ message: '已保存至相册!' }); - // 关闭文件 + // Close the file await fs.close(file.fd); } catch (error) { console.error('error is ' + JSON.stringify(error)); -- Gitee