From 10917dafb82820e129fba46dba2b61dd8e829fb1 Mon Sep 17 00:00:00 2001 From: guojin26 Date: Thu, 26 Aug 2021 08:47:21 +0800 Subject: [PATCH 1/2] add native image Signed-off-by: guojin26 --- native/NativeImage/README_zh.md | 19 +++ native/NativeImage/build.gradle | 46 +++++++ native/NativeImage/entry/build.gradle | 25 ++++ native/NativeImage/entry/src/main/config.json | 47 +++++++ .../entry/src/main/cpp/CMakeLists.txt | 6 + .../entry/src/main/cpp/nativeimage.cpp | 60 +++++++++ .../ohos/samples/nativeimage/MainAbility.java | 33 +++++ .../samples/nativeimage/MyApplication.java | 30 +++++ .../nativeimage/slice/MainAbilitySlice.java | 127 ++++++++++++++++++ .../samples/nativeimage/utils/HiLogUtils.java | 69 ++++++++++ .../main/resources/base/element/color.json | 24 ++++ .../main/resources/base/element/float.json | 32 +++++ .../main/resources/base/element/pattern.json | 39 ++++++ .../main/resources/base/element/string.json | 36 +++++ .../resources/base/graphic/button_blue.xml | 23 ++++ .../base/graphic/button_blue_empty.xml | 22 +++ .../base/graphic/button_blue_pressed.xml | 22 +++ .../resources/base/layout/ability_main.xml | 57 ++++++++ .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../src/main/resources/base/media/image.jpg | Bin 0 -> 10135199 bytes .../src/main/resources/en/element/string.json | 28 ++++ .../src/main/resources/zh/element/string.json | 28 ++++ native/NativeImage/screenshots/device/get.png | Bin 0 -> 1935884 bytes .../screenshots/device/getinfo.png | Bin 0 -> 1963857 bytes .../screenshots/device/release.png | Bin 0 -> 1935665 bytes native/NativeImage/settings.gradle | 1 + 26 files changed, 774 insertions(+) create mode 100644 native/NativeImage/README_zh.md create mode 100644 native/NativeImage/build.gradle create mode 100644 native/NativeImage/entry/build.gradle create mode 100644 native/NativeImage/entry/src/main/config.json create mode 100644 native/NativeImage/entry/src/main/cpp/CMakeLists.txt create mode 100644 native/NativeImage/entry/src/main/cpp/nativeimage.cpp create mode 100644 native/NativeImage/entry/src/main/java/ohos/samples/nativeimage/MainAbility.java create mode 100644 native/NativeImage/entry/src/main/java/ohos/samples/nativeimage/MyApplication.java create mode 100644 native/NativeImage/entry/src/main/java/ohos/samples/nativeimage/slice/MainAbilitySlice.java create mode 100644 native/NativeImage/entry/src/main/java/ohos/samples/nativeimage/utils/HiLogUtils.java create mode 100644 native/NativeImage/entry/src/main/resources/base/element/color.json create mode 100644 native/NativeImage/entry/src/main/resources/base/element/float.json create mode 100644 native/NativeImage/entry/src/main/resources/base/element/pattern.json create mode 100644 native/NativeImage/entry/src/main/resources/base/element/string.json create mode 100644 native/NativeImage/entry/src/main/resources/base/graphic/button_blue.xml create mode 100644 native/NativeImage/entry/src/main/resources/base/graphic/button_blue_empty.xml create mode 100644 native/NativeImage/entry/src/main/resources/base/graphic/button_blue_pressed.xml create mode 100644 native/NativeImage/entry/src/main/resources/base/layout/ability_main.xml create mode 100644 native/NativeImage/entry/src/main/resources/base/media/icon.png create mode 100644 native/NativeImage/entry/src/main/resources/base/media/image.jpg create mode 100644 native/NativeImage/entry/src/main/resources/en/element/string.json create mode 100644 native/NativeImage/entry/src/main/resources/zh/element/string.json create mode 100644 native/NativeImage/screenshots/device/get.png create mode 100644 native/NativeImage/screenshots/device/getinfo.png create mode 100644 native/NativeImage/screenshots/device/release.png create mode 100644 native/NativeImage/settings.gradle diff --git a/native/NativeImage/README_zh.md b/native/NativeImage/README_zh.md new file mode 100644 index 0000000000..accf47300d --- /dev/null +++ b/native/NativeImage/README_zh.md @@ -0,0 +1,19 @@ +# Native_image + + + +### 简介 + +Native_image提供对像素数据和像素图信息的访问,本示例展示了如何声明JNI接口并通过JNI接口锁定和访问或解锁像素数据的函数。 + +### 使用说明 + +1、点击**获取Pixels**,获取给定**PixelMap**对象的内存地址并锁定内存,显示返回的调用结果。 + +2、点击**获取PixelMap信息**,返回PixelMap对象信息并显示。 + +3、点击**解锁Pixels**,显示返回的调用结果。 + +### 约束与限制 + +本示例仅支持在大型系统上运行。 diff --git a/native/NativeImage/build.gradle b/native/NativeImage/build.gradle new file mode 100644 index 0000000000..0e9e2a7917 --- /dev/null +++ b/native/NativeImage/build.gradle @@ -0,0 +1,46 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.huawei.ohos.app' + +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + signingConfigs { + debug { + storeFile file('C:\\Users\\Administrator\\.ohos\\config\\auto_debug_340086000102062381.p12') + storePassword '000000189B3C9C37C319A0B097584F9962429CC93A234C1266CA9A6073D97159B066566403BF1F4C' + keyAlias = 'debugKey' + keyPassword '000000187171D1298EFE4687A5AA7828A64F34FC8374CC9CAFE1C42D778EB72265F8D9CB45E1E83F' + signAlg = 'SHA256withECDSA' + profile file('C:\\Users\\Administrator\\.ohos\\config\\auto_debug_nativeimage_340086000102062381.p7b') + certpath file('C:\\Users\\Administrator\\.ohos\\config\\auto_debug_340086000102062381.cer') + } + } + compileSdkVersion 6 + defaultConfig { + compatibleSdkVersion 5 + } +} + +buildscript { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } + dependencies { + classpath 'com.huawei.ohos:hap:2.4.5.0' + } +} + +allprojects { + repositories { + maven { + url 'https://repo.huaweicloud.com/repository/maven/' + } + maven { + url 'https://developer.huawei.com/repo/' + } + } +} diff --git a/native/NativeImage/entry/build.gradle b/native/NativeImage/entry/build.gradle new file mode 100644 index 0000000000..a8fbd13b10 --- /dev/null +++ b/native/NativeImage/entry/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.huawei.ohos.hap' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 6 + defaultConfig { + compatibleSdkVersion 5 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } + externalNativeBuild { + path "src/main/cpp/CMakeLists.txt" + arguments "-v" + abiFilters "arm64-v8a" + cppFlags "" + } +} +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) +} \ No newline at end of file diff --git a/native/NativeImage/entry/src/main/config.json b/native/NativeImage/entry/src/main/config.json new file mode 100644 index 0000000000..2ac65dfe62 --- /dev/null +++ b/native/NativeImage/entry/src/main/config.json @@ -0,0 +1,47 @@ +{ + "app": { + "bundleName": "ohos.samples.nativeimage", + "vendor": "samples", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.samples.nativeimage", + "name": ".MyApplication", + "mainAbility": "ohos.samples.nativeimage.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "portrait", + "permissions": [], + "name": "ohos.samples.nativeimage.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ] + } +} \ No newline at end of file diff --git a/native/NativeImage/entry/src/main/cpp/CMakeLists.txt b/native/NativeImage/entry/src/main/cpp/CMakeLists.txt new file mode 100644 index 0000000000..b1eb47dff1 --- /dev/null +++ b/native/NativeImage/entry/src/main/cpp/CMakeLists.txt @@ -0,0 +1,6 @@ +# the minimum version of CMake. +cmake_minimum_required(VERSION 3.4.1) +project(nativeimage) + +add_library(nativeimage SHARED nativeimage.cpp) +target_link_libraries(nativeimage libimage_pixelmap.z.so) \ No newline at end of file diff --git a/native/NativeImage/entry/src/main/cpp/nativeimage.cpp b/native/NativeImage/entry/src/main/cpp/nativeimage.cpp new file mode 100644 index 0000000000..4a7df4633d --- /dev/null +++ b/native/NativeImage/entry/src/main/cpp/nativeimage.cpp @@ -0,0 +1,60 @@ +/************************************************************** + Copyright (c) 2021 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. + **************************************************************/ + +#include +#include +#include +#include + +jstring formatString(JNIEnv* env, std::string string) { + int len = string.size(); + jchar res[len]; + for (int i = 0; i < len; i++) { + res[i] = (jchar)string[i]; + } + return env->NewString(res, len); +} + +extern "C" +JNIEXPORT jstring JNICALL +Java_ohos_samples_nativeimage_slice_MainAbilitySlice_GetImageInfoFromJNI(JNIEnv* env, jobject obj, jobject pixelMapObject) { + std::string resultString = ""; + OhosPixelMapInfo imageInfo; + int resultCode = GetImageInfo(env, pixelMapObject, imageInfo); + if (resultCode == 0) { + resultString.append("{\"height\":\"").append(std::to_string(imageInfo.height)).append("\"") + .append(",\"width\":\"").append(std::to_string(imageInfo.width)).append("\"") + .append(",\"rowSize\":\"").append(std::to_string(imageInfo.rowSize)).append("\"") + .append(",\"pixelFormat\":\"").append(std::to_string(imageInfo.pixelFormat)).append("\"}"); + return formatString(env,resultString); + } else { + resultString.append("Failed"); + } + return formatString(env,resultString); +} + + +extern "C" +JNIEXPORT jint JNICALL +Java_ohos_samples_nativeimage_slice_MainAbilitySlice_AccessPixelsFromJNI(JNIEnv* env, jobject obj, jobject pixelMapObject, jlong PixelBytesNumber) { + void* bytes = malloc(PixelBytesNumber); + return AccessPixels(env, pixelMapObject, &bytes); +} + +extern "C" +JNIEXPORT jint JNICALL +Java_ohos_samples_nativeimage_slice_MainAbilitySlice_UnAccessPixelsFromJNI(JNIEnv* env, jobject obj, jobject pixelMapObject) { + return UnAccessPixels(env, pixelMapObject); +} \ No newline at end of file diff --git a/native/NativeImage/entry/src/main/java/ohos/samples/nativeimage/MainAbility.java b/native/NativeImage/entry/src/main/java/ohos/samples/nativeimage/MainAbility.java new file mode 100644 index 0000000000..ec19969dd4 --- /dev/null +++ b/native/NativeImage/entry/src/main/java/ohos/samples/nativeimage/MainAbility.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2021 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. + */ + +package ohos.samples.nativeimage; + +import ohos.samples.nativeimage.slice.MainAbilitySlice; +import ohos.aafwk.ability.Ability; +import ohos.aafwk.content.Intent; + +/** + * MainAbility + * + * @since 2021-08-16 + */ +public class MainAbility extends Ability { + @Override + public void onStart(Intent intent) { + super.onStart(intent); + super.setMainRoute(MainAbilitySlice.class.getName()); + } +} diff --git a/native/NativeImage/entry/src/main/java/ohos/samples/nativeimage/MyApplication.java b/native/NativeImage/entry/src/main/java/ohos/samples/nativeimage/MyApplication.java new file mode 100644 index 0000000000..2427d72217 --- /dev/null +++ b/native/NativeImage/entry/src/main/java/ohos/samples/nativeimage/MyApplication.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021 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. + */ + +package ohos.samples.nativeimage; + +import ohos.aafwk.ability.AbilityPackage; + +/** + * MyApplication + * + * @since 2021-08-16 + */ +public class MyApplication extends AbilityPackage { + @Override + public void onInitialize() { + super.onInitialize(); + } +} diff --git a/native/NativeImage/entry/src/main/java/ohos/samples/nativeimage/slice/MainAbilitySlice.java b/native/NativeImage/entry/src/main/java/ohos/samples/nativeimage/slice/MainAbilitySlice.java new file mode 100644 index 0000000000..d7a485549b --- /dev/null +++ b/native/NativeImage/entry/src/main/java/ohos/samples/nativeimage/slice/MainAbilitySlice.java @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2021 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. + */ + +package ohos.samples.nativeimage.slice; + +import ohos.aafwk.ability.AbilitySlice; +import ohos.aafwk.content.Intent; +import ohos.agp.components.*; +import ohos.media.image.PixelMap; +import ohos.samples.nativeimage.ResourceTable; +import ohos.samples.nativeimage.utils.HiLogUtils; + +/** + * MainAbilitySlice + * + * @since 2021-08-16 + */ +public class MainAbilitySlice extends AbilitySlice { + // Load the 'native-lib' library on application startup. + static { + System.loadLibrary("nativeimage"); + } + + private static final String TAG = MainAbilitySlice.class.getSimpleName(); + private static final int OHOS_IMAGE_RESULT_SUCCESS = 0; + private static final int OHOS_IMAGE_RESULT_BAD_PARAMETER = -1; + private static final int OHOS_IMAGE_RESULT_JNI_EXCEPTION = -2; + + private Text resultText; + private PixelMap pixelMap; + + @Override + public void onStart(Intent intent) { + super.onStart(intent); + super.setUIContent(ResourceTable.Layout_ability_main); + initComponents(); + } + + private void initComponents() { + Image image = (Image) findComponentById(ResourceTable.Id_image); + Button btnAccessPixels = (Button) findComponentById(ResourceTable.Id_access_pixels); + Button btnGetImageInfo = (Button) findComponentById(ResourceTable.Id_get_image_info); + Button btnUnAccessPixels = (Button) findComponentById(ResourceTable.Id_unaccess_pixels); + resultText = (Text) findComponentById(ResourceTable.Id_result_text); + + pixelMap = image.getPixelMap(); + btnAccessPixels.setClickedListener(this::accessPixels); + btnGetImageInfo.setClickedListener(this::getImageInfo); + btnUnAccessPixels.setClickedListener(this::unAccessPixels); + } + + private void getImageInfo(Component component) { + String result = GetImageInfoFromJNI(pixelMap); + resultText.setText(getString(ResourceTable.String_get_image_info) + ": " + result); + HiLogUtils.info(TAG, getString(ResourceTable.String_get_image_info) + ": " + result); + } + + private void unAccessPixels(Component component) { + int result = UnAccessPixelsFromJNI(pixelMap); + formatResult(getString(ResourceTable.String_unaccess_pixels), result); + pixelMap.release(); + } + + private void accessPixels(Component component) { + int result = AccessPixelsFromJNI(pixelMap, pixelMap.getPixelBytesNumber()); + formatResult(getString(ResourceTable.String_access_pixels), result); + } + + private void formatResult(String str, int result) { + StringBuilder string = new StringBuilder(str); + switch (result) { + case OHOS_IMAGE_RESULT_SUCCESS: + string.append(getString(ResourceTable.String_result_succeed)); + HiLogUtils.info(TAG, string.toString()); + break; + case OHOS_IMAGE_RESULT_BAD_PARAMETER: + string.append(getString(ResourceTable.String_result_bad_parameter)); + HiLogUtils.error(TAG, string.toString()); + break; + case OHOS_IMAGE_RESULT_JNI_EXCEPTION: + string.append(getString(ResourceTable.String_result_jni_exception)); + HiLogUtils.error(TAG, string.toString()); + break; + } + resultText.setText(string.toString()); + } + + @Override + public void onActive() { + super.onActive(); + } + + @Override + public void onForeground(Intent intent) { + super.onForeground(intent); + } + + @Override + public void onStop() { + super.onStop(); + if(!pixelMap.isReleased()){ + pixelMap.release(); + } + } + + /** + * A native method that is implemented by the 'native-lib' native library, + * which is packaged with this application. + */ + public native String GetImageInfoFromJNI(PixelMap pixelMapObject); + + public native int AccessPixelsFromJNI(PixelMap pixelMapObject, long pixelBytesNumber); + + public native int UnAccessPixelsFromJNI(PixelMap pixelMapObject); +} diff --git a/native/NativeImage/entry/src/main/java/ohos/samples/nativeimage/utils/HiLogUtils.java b/native/NativeImage/entry/src/main/java/ohos/samples/nativeimage/utils/HiLogUtils.java new file mode 100644 index 0000000000..10c0ba7a34 --- /dev/null +++ b/native/NativeImage/entry/src/main/java/ohos/samples/nativeimage/utils/HiLogUtils.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2021 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. + */ + +package ohos.samples.nativeimage.utils; + +import ohos.hiviewdfx.HiLog; +import ohos.hiviewdfx.HiLogLabel; + +import java.util.Objects; + +/** + * HiLogUtils + * + * @since 2021-08-16 + */ +public class HiLogUtils { + public static final String APP_NAME = "NativeLayer"; + public static final HiLogLabel LABAL_LOG = new HiLogLabel(3, 0xD000f00, APP_NAME); + public static final String LOG_FORMAT = "%{public}s:%{public}s"; + + private HiLogUtils() { + + } + + /** + * info + * @param className String + * @param msg String + */ + public static void info(String className, String msg) { + HiLog.info(LABAL_LOG, LOG_FORMAT, getLogPrefix(className), msg); + } + + /** + * error + * @param className String + * @param msg String + */ + public static void error(String className, String msg) { + HiLog.error(LABAL_LOG, LOG_FORMAT, getLogPrefix(className), msg); + } + + private static String getLogPrefix(String tag) { + Thread currentThread = Thread.currentThread(); + String threadName = currentThread.getName(); + StackTraceElement[] stackTraceElements = currentThread.getStackTrace(); + int lineNum = 0; + for (int index = 0; index < stackTraceElements.length; index++) { + if (Objects.equals(stackTraceElements[index].getClassName(), HiLogUtils.class.getName()) + && stackTraceElements.length > index + 1 + && !Objects.equals(stackTraceElements[index + 1].getClassName(), HiLogUtils.class.getName())) { + lineNum = stackTraceElements[index + 1].getLineNumber(); + } + } + return "[" + threadName + "]" + "(" + tag + ".java" + lineNum + ")"; + } +} \ No newline at end of file diff --git a/native/NativeImage/entry/src/main/resources/base/element/color.json b/native/NativeImage/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000..30207ec1e2 --- /dev/null +++ b/native/NativeImage/entry/src/main/resources/base/element/color.json @@ -0,0 +1,24 @@ +{ + "color": [ + { + "name": "color_button_blue_empty", + "value": "#3355FF" + }, + { + "name": "color_button_blue_pressed", + "value": "#0000CC" + }, + { + "name": "color_button_blue_text", + "value": "#FFFFFF" + }, + { + "name": "color_light_ray", + "value": "#F0F0F0" + }, + { + "name": "color_white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/native/NativeImage/entry/src/main/resources/base/element/float.json b/native/NativeImage/entry/src/main/resources/base/element/float.json new file mode 100644 index 0000000000..aeb95da0c7 --- /dev/null +++ b/native/NativeImage/entry/src/main/resources/base/element/float.json @@ -0,0 +1,32 @@ +{ + "float": [ + { + "name": "button_height", + "value": "40vp" + }, + { + "name": "button_width", + "value": "180vp" + }, + { + "name": "button_margin", + "value": "10vp" + }, + { + "name": "button_text_size", + "value": "18fp" + }, + { + "name": "layout_padding", + "value": "10vp" + }, + { + "name": "image_height", + "value": "300vp" + }, + { + "name": "text_size", + "value": "18fp" + } + ] +} \ No newline at end of file diff --git a/native/NativeImage/entry/src/main/resources/base/element/pattern.json b/native/NativeImage/entry/src/main/resources/base/element/pattern.json new file mode 100644 index 0000000000..8917cc7110 --- /dev/null +++ b/native/NativeImage/entry/src/main/resources/base/element/pattern.json @@ -0,0 +1,39 @@ +{ + "pattern": [ + { + "name": "button_base", + "value": [ + { + "name": "width", + "value": "$float:button_width" + }, + { + "name": "height", + "value": "$float:button_height" + }, + { + "name": "text_size", + "value": "$float:button_text_size" + }, + { + "name": "margin", + "value": "$float:button_margin" + } + ] + }, + { + "name": "button_blue", + "parent": "button_base", + "value": [ + { + "name": "background_element", + "value": "$graphic:button_blue" + }, + { + "name": "text_color", + "value": "$color:color_button_blue_text" + } + ] + } + ] +} \ No newline at end of file diff --git a/native/NativeImage/entry/src/main/resources/base/element/string.json b/native/NativeImage/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000..aa3985b49b --- /dev/null +++ b/native/NativeImage/entry/src/main/resources/base/element/string.json @@ -0,0 +1,36 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "NativeImage" + }, + { + "name": "mainability_description", + "value": "Native C++" + }, + { + "name": "access_pixels", + "value": "AccessPixels" + }, + { + "name": "get_image_info", + "value": "GetImageInfo" + }, + { + "name": "unaccess_pixels", + "value": "UnAccessPixels" + }, + { + "name": "result_succeed", + "value": " result: success" + }, + { + "name": "result_bad_parameter", + "value": " result: bad parameter" + }, + { + "name": "result_jni_exception", + "value": " result: jni exception" + } + ] +} \ No newline at end of file diff --git a/native/NativeImage/entry/src/main/resources/base/graphic/button_blue.xml b/native/NativeImage/entry/src/main/resources/base/graphic/button_blue.xml new file mode 100644 index 0000000000..a06daf2706 --- /dev/null +++ b/native/NativeImage/entry/src/main/resources/base/graphic/button_blue.xml @@ -0,0 +1,23 @@ + + + + + + + \ No newline at end of file diff --git a/native/NativeImage/entry/src/main/resources/base/graphic/button_blue_empty.xml b/native/NativeImage/entry/src/main/resources/base/graphic/button_blue_empty.xml new file mode 100644 index 0000000000..ed32eae5fa --- /dev/null +++ b/native/NativeImage/entry/src/main/resources/base/graphic/button_blue_empty.xml @@ -0,0 +1,22 @@ + + + + + + + \ No newline at end of file diff --git a/native/NativeImage/entry/src/main/resources/base/graphic/button_blue_pressed.xml b/native/NativeImage/entry/src/main/resources/base/graphic/button_blue_pressed.xml new file mode 100644 index 0000000000..00ae2d38a5 --- /dev/null +++ b/native/NativeImage/entry/src/main/resources/base/graphic/button_blue_pressed.xml @@ -0,0 +1,22 @@ + + + + + + + \ No newline at end of file diff --git a/native/NativeImage/entry/src/main/resources/base/layout/ability_main.xml b/native/NativeImage/entry/src/main/resources/base/layout/ability_main.xml new file mode 100644 index 0000000000..bf255b82b5 --- /dev/null +++ b/native/NativeImage/entry/src/main/resources/base/layout/ability_main.xml @@ -0,0 +1,57 @@ + + + + + + +