From a6b1f74feefedf79cf944bbaa1863966d0369a60 Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Thu, 17 Mar 2022 07:48:48 +0000 Subject: [PATCH] update zh-cn/native_sdk/ace/native_interface_xcomponent.h. Signed-off-by: esterzhou --- .../ace/native_interface_xcomponent.h | 79 +++++++++---------- 1 file changed, 38 insertions(+), 41 deletions(-) diff --git a/zh-cn/native_sdk/ace/native_interface_xcomponent.h b/zh-cn/native_sdk/ace/native_interface_xcomponent.h index db373fd7..82fed4a9 100644 --- a/zh-cn/native_sdk/ace/native_interface_xcomponent.h +++ b/zh-cn/native_sdk/ace/native_interface_xcomponent.h @@ -17,7 +17,7 @@ * @addtogroup OH_NativeXComponent Native XComponent * @{ * - * @brief OH_NativeXComponent描述了ArkUI XComponent组件持有的Surface和Touch事件,可用于EGL/OpenGLES和媒体数据输入,并显示在ArkUI XComponent组件上。 + * @brief Describes the surface and touch event held by the ArkUI XComponent, which can be used for the EGL/OpenGLES and media data input and displayed on the ArkUI XComponent. * * @since 8 * @version 1.0 @@ -26,7 +26,7 @@ /** * @file native_interface_xcomponent.h * - * @brief API for accessing a Native XComponent. + * @brief Declares APIs for accessing a Native XComponent. * * @since 8 * @version 1.0 @@ -42,7 +42,7 @@ extern "C" { #endif /** - * @brief 接口访问状态码。 + * @brief Enumerates the API access states. * * @since 8 * @version 1.0 @@ -86,17 +86,17 @@ struct OH_NativeXComponent_TouchPoint { float y = 0.0; /** Touch type of the touch event. */ OH_NativeXComponent_TouchEventType type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN; - /** 手指和屏幕的接触面积。 */ + /** Contact area between the finger pad and the screen. */ double size = 0.0; - /** The current pressure of this touch event. */ + /** Pressure of the current touch event. */ float force = 0.0; - /** 当前Touch事件的时间戳。 */ + /** Timestamp of the current touch event. */ long long timeStamp = 0; - /** Checks if the current point is pressed. */ + /** Whether the current point is pressed. */ bool isPressed = false; }; -// the active changed point info. +// Represents the touch point information. struct OH_NativeXComponent_TouchEvent { /** Unique identifier of a finger. */ int32_t id = 0; @@ -110,22 +110,22 @@ struct OH_NativeXComponent_TouchEvent { float y = 0.0; /** Touch type of the touch event. */ OH_NativeXComponent_TouchEventType type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN; - /** 手指和屏幕的接触面积。 */ + /** Contact area between the finger pad and the screen. */ double size = 0.0; - /** The current pressure of this touch event. */ + /** Pressure of the current touch event. */ float force = 0.0; - /** The ID for the device that the current event came from. */ + /** ID of the device where the current touch event is generated. */ int64_t deviceId = 0; - /** 当前Touch事件的时间戳。 */ + /** Timestamp of the current touch event. */ long long timeStamp = 0; - /** 当前Touch Pointer集合。 */ + /** Array of the current touch points. */ OH_NativeXComponent_TouchPoint touchPoints[OH_MAX_TOUCH_POINTS_NUMBER]; - /** 当前Touch Pointer数量。 */ + /** Number of current touch points. */ uint32_t numPoints = 0; }; /** - * @brief 结构体NativeXComponent, 提供一个封装的OH_NativeXComponent实例对象。 + * @brief Provides an encapsulated OH_NativeXComponent instance. * * @since 8 * @version 1.0 @@ -133,7 +133,7 @@ struct OH_NativeXComponent_TouchEvent { typedef struct OH_NativeXComponent OH_NativeXComponent; /** - * @brief 结构体OH_NativeXComponent_Callback,用于注册Surface生命周期和Touch事件回调。 + * @brief Registers the surface lifecycle and touch event callbacks. * * @since 8 * @version 1.0 @@ -143,41 +143,38 @@ typedef struct OH_NativeXComponent_Callback { void (*OnSurfaceCreated)(OH_NativeXComponent* component, void* window); /** * Called when the surface is changed.\n - * 本接口在OpenHarmony3.1Release版本仅为接口定义,暂不支持使用。接口将在OpenHarmony3.1MR版本中提供使用支持。\n + * This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.\n */ void (*OnSurfaceChanged)(OH_NativeXComponent* component, void* window); /** Called when the surface is destroyed. */ void (*OnSurfaceDestroyed)(OH_NativeXComponent* component, void* window); - /** Called when touch event is triggered. */ + /** Called when a touch event is triggered. */ void (*DispatchTouchEvent)(OH_NativeXComponent* component, void* window); } OH_NativeXComponent_Callback; /** - * @brief 获得ArkUI XComponent组件的ID。 + * @brief Obtains the ID of the ArkUI XComponent. * * @param component Indicates the pointer to this OH_NativeXComponent instance. - * @param id Indicates the char buffer to keep the ID of the xcomponent.\n - * Notice that a null-terminator will be append to the char buffer, so the size of the + * @param id Indicates the char buffer to keep the ID of this OH_NativeXComponent instance.\n + * Note that a null-terminator will be appended to the char buffer, so the size of the * char buffer should be at least as large as the size of the real id length plus 1.\n - * The size of the char buffer is recommend to be [OH_XCOMPONENT_ID_LEN_MAX + 1]. - * @param size is an in-out param. - * [in] Indicates the length of the id char buffer (including null-terminator). - * The referenced value of 'size' should be in the range (0, OH_XCOMPONENT_ID_LEN_MAX + 1]. - * [out] Receives the length of the id (not include null-terminator). - * @return 返回接口执行的状态码。 + * It is recommended that the size of the char buffer be [OH_XCOMPONENT_ID_LEN_MAX + 1]. + * @param size Indicates the pointer to the length of id, which you can set and receive. + * @return Returns the status code of the execution. * @since 8 * @version 1.0 */ int32_t OH_NativeXComponent_GetXComponentId(OH_NativeXComponent* component, char* id, uint64_t* size); /** - * @brief 获得ArkUI XComponent组件持有Surface的大小。 + * @brief Obtains the size of the surface held by the ArkUI XComponent. * * @param component Indicates the pointer to this OH_NativeXComponent instance. * @param window Indicates the native window handler. - * @param width 表示当前Surface的宽度。 - * @param height 表示当前Surface的高度。 - * @return 返回接口执行的状态码。 + * @param width Indicates the pointer to the width of the current surface. + * @param height Indicates the pointer to the height of the current surface. + * @return Returns the status code of the execution. * @since 8 * @version 1.0 */ @@ -185,13 +182,13 @@ int32_t OH_NativeXComponent_GetXComponentSize( OH_NativeXComponent* component, const void* window, uint64_t* width, uint64_t* height); /** - * @brief 获得ArkUI XComponent组件持有Surface的偏移量。 + * @brief Obtains the offset of the surface held by the ArkUI XComponent. * * @param component Indicates the pointer to this OH_NativeXComponent instance. * @param window Indicates the native window handler. - * @param x 表示当前Surface的x坐标。 - * @param y 表示当前Surface的y坐标。 - * @return 返回接口执行的状态码。 + * @param x Indicates the pointer to the x coordinate of the current surface. + * @param y Indicates the pointer to the y coordinate of the current surface. + * @return Returns the status code of the execution. * @since 8 * @version 1.0 */ @@ -199,12 +196,12 @@ int32_t OH_NativeXComponent_GetXComponentOffset( OH_NativeXComponent* component, const void* window, double* x, double* y); /** - * @brief 获得ArkUI XComponent组件派发的Touch事件。 + * @brief Obtains the touch event dispatched by the ArkUI XComponent. * * @param component Indicates the pointer to this OH_NativeXComponent instance. * @param window Indicates the native window handler. - * @param touchEvent 表示当前Touch事件。 - * @return 返回接口执行的状态码。 + * @param touchEvent Indicates the pointer to the current touch event. + * @return Returns the status code of the execution. * @since 8 * @version 1.0 */ @@ -212,11 +209,11 @@ int32_t OH_NativeXComponent_GetTouchEvent( OH_NativeXComponent* component, const void* window, OH_NativeXComponent_TouchEvent* touchEvent); /** - * @brief 提供OH_NativeXComponent回调注册接口。 + * @brief Registers a callback for this OH_NativeXComponent instance. * * @param component Indicates the pointer to this OH_NativeXComponent instance. - * @param callback 表示Surface生命周期和Touch事件回调实现。 - * @return 返回接口执行的状态码。 + * @param callback Indicates the pointer to a surface lifecycle and touch event callback. + * @return Returns the status code of the execution. * @since 8 * @version 1.0 */ -- Gitee