鸿蒙OpenHarmony Native API【Native XComponent】
创始人
2024-12-26 03:06:06
0

Native XComponent

Overview

Description:

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

Summary

Files

File NameDescription
[native_interface_xcomponent.h]Declares APIs for accessing a Native XComponent.

Classes

Classe NameDescription
[OH_NativeXComponent_TouchPoint]
[OH_NativeXComponent_TouchEvent]
[OH_NativeXComponent_Callback]Registers the surface lifecycle and touch event callbacks.

Macros

Macro Name and ValueDescription
OH_NATIVE_XCOMPONENT_OBJ (“NATIVE_XCOMPONENT_OBJ”)

Typedefs

Typedef NameDescription
OH_NativeXComponenttypedef struct OH_NativeXComponent Provides an encapsulated OH_NativeXComponent instance.
OH_NativeXComponent_Callbacktypedef struct OH_NativeXComponent_Callback Registers the surface lifecycle and touch event callbacks.

Enumerations

Enumeration NameDescription
{ OH_NATIVEXCOMPONENT_RESULT_SUCCESS = 0, OH_NATIVEXCOMPONENT_RESULT_FAILED = -1, OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER = -2 }Enumerates the API access states.
OH_NativeXComponent_TouchEventType { OH_NATIVEXCOMPONENT_DOWN = 0, OH_NATIVEXCOMPONENT_UP, OH_NATIVEXCOMPONENT_MOVE, OH_NATIVEXCOMPONENT_CANCEL, OH_NATIVEXCOMPONENT_UNKNOWN }

Functions

FunctionDescription
OH_NativeXComponent_GetXComponentId (OH_NativeXComponent *component, char *id, uint64_t *size)int32_t Obtains the ID of the ArkUI XComponent.
OH_NativeXComponent_GetXComponentSize (OH_NativeXComponent *component, const void *window, uint64_t *width, uint64_t *height)int32_t Obtains the size of the surface held by the ArkUI XComponent.
OH_NativeXComponent_GetXComponentOffset (OH_NativeXComponent *component, const void *window, double *x, double *y)int32_t Obtains the offset of the surface held by the ArkUI XComponent.
OH_NativeXComponent_GetTouchEvent (OH_NativeXComponent *component, const void *window, OH_NativeXComponent_TouchEvent *touchEvent)int32_t Obtains the touch event dispatched by the ArkUI XComponent.
OH_NativeXComponent_RegisterCallback (OH_NativeXComponent *component, OH_NativeXComponent_Callback *callback)int32_t Registers a callback for this OH_NativeXComponent instance.

Details

Typedef

OH_NativeXComponent

typedef struct OH_NativeXComponent OH_NativeXComponent 

Description:

Provides an encapsulated OH_NativeXComponent instance.

OH_NativeXComponent_Callback

typedef struct OH_NativeXComponent_Callback OH_NativeXComponent_Callback 

Description:

Registers the surface lifecycle and touch event callbacks.

Enumeration Type

anonymous enum

anonymous enum 

Description:

Enumerates the API access states.

EnumeratorDescription
OH_NATIVEXCOMPONENT_RESULT_SUCCESSSuccess result.
OH_NATIVEXCOMPONENT_RESULT_FAILEDFailed result.
OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETERInvalid parameters.

OH_NativeXComponent_TouchEventType

enum OH_NativeXComponent_TouchEventType 
EnumeratorDescription
OH_NATIVEXCOMPONENT_DOWNTrigger a touch event when a finger is pressed.
OH_NATIVEXCOMPONENT_UPTrigger a touch event when a finger is lifted.
OH_NATIVEXCOMPONENT_MOVETrigger a touch event when a finger moves on the screen in pressed state.
OH_NATIVEXCOMPONENT_CANCELTrigger an event when a touch event is canceled.
OH_NATIVEXCOMPONENT_UNKNOWNInvalid touch type.

Function

OH_NativeXComponent_GetTouchEvent()

int32_t OH_NativeXComponent_GetTouchEvent (OH_NativeXComponent * component, const void * window, OH_NativeXComponent_TouchEvent * touchEvent ) 

Description:

Obtains the touch event dispatched by the ArkUI XComponent.

Parameters:

NameDescription
componentIndicates the pointer to this OH_NativeXComponent instance.
windowIndicates the native window handler.
touchEventIndicates the pointer to the current touch event.

Returns:

Returns the status code of the execution.

OH_NativeXComponent_GetXComponentId()

int32_t OH_NativeXComponent_GetXComponentId (OH_NativeXComponent * component, char * id, uint64_t * size ) 

Description:

Obtains the ID of the ArkUI XComponent.

Parameters:

NameDescription
componentIndicates the pointer to this OH_NativeXComponent instance.
idIndicates the char buffer to keep the ID of this OH_NativeXComponent instance. 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. It is recommended that the size of the char buffer be [OH_XCOMPONENT_ID_LEN_MAX + 1].
sizeIndicates the pointer to the length of id, which you can set and receive.

Returns:

Returns the status code of the execution.

OH_NativeXComponent_GetXComponentOffset()

int32_t OH_NativeXComponent_GetXComponentOffset (OH_NativeXComponent * component, const void * window, double * x, double * y ) 

Description:

Obtains the offset of the surface held by the ArkUI XComponent.

Parameters:

NameDescription
componentIndicates the pointer to this OH_NativeXComponent instance.
windowIndicates the native window handler.
xIndicates the pointer to the x coordinate of the current surface.
yIndicates the pointer to the y coordinate of the current surface.

Returns:

Returns the status code of the execution.

OH_NativeXComponent_GetXComponentSize()

int32_t OH_NativeXComponent_GetXComponentSize (OH_NativeXComponent * component, const void * window, uint64_t * width, uint64_t * height ) 

Description:

Obtains the size of the surface held by the ArkUI XComponent.

Parameters:

NameDescription
componentIndicates the pointer to this OH_NativeXComponent instance.
windowIndicates the native window handler.
widthIndicates the pointer to the width of the current surface.
heightIndicates the pointer to the height of the current surface.

Returns:

Returns the status code of the execution.

OH_NativeXComponent_RegisterCallback()

int32_t OH_NativeXComponent_RegisterCallback (OH_NativeXComponent * component, OH_NativeXComponent_Callback * callback ) 

Description:

Registers a callback for this OH_NativeXComponent instance.

Parameters:

NameDescription
componentIndicates the pointer to this OH_NativeXComponent instance.
callbackIndicates the pointer to a surface lifecycle and touch event callback.

Returns:

Returns the status code of the execution.

Variable

deviceId

int64_t OH_NativeXComponent_TouchEvent::deviceId = 0 

Description:

ID of the device where the current touch event is generated.

DispatchTouchEvent

void(* OH_NativeXComponent_Callback::DispatchTouchEvent) (OH_NativeXComponent *component, void *window) 

Description:

Called when a touch event is triggered.

force [1/2]

float OH_NativeXComponent_TouchPoint::force = 0.0 

Description:

Pressure of the current touch event.

force [2/2]

float OH_NativeXComponent_TouchEvent::force = 0.0 

Description:

Pressure of the current touch event.

id [1/2]

int32_t OH_NativeXComponent_TouchPoint::id = 0 

Description:

Unique identifier of a finger.

id [2/2]

int32_t OH_NativeXComponent_TouchEvent::id = 0 

Description:

Unique identifier of a finger.

isPressed

bool OH_NativeXComponent_TouchPoint::isPressed = false 

Description:

Whether the current point is pressed.

numPoints

uint32_t OH_NativeXComponent_TouchEvent::numPoints = 0 

Description:

Number of current touch points.

OnSurfaceChanged

void(* OH_NativeXComponent_Callback::OnSurfaceChanged) (OH_NativeXComponent *component, void *window) 

Description:

Called when the surface is changed. This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.

OnSurfaceCreated

void(* OH_NativeXComponent_Callback::OnSurfaceCreated) (OH_NativeXComponent *component, void *window) 

Description:

Called when the surface is created.

OnSurfaceDestroyed

void(* OH_NativeXComponent_Callback::OnSurfaceDestroyed) (OH_NativeXComponent *component, void *window) 

Description:

Called when the surface is destroyed.

screenX [1/2]

float OH_NativeXComponent_TouchPoint::screenX = 0.0 

Description:

X coordinate of the touch point relative to the left edge of the screen.

screenX [2/2]

float OH_NativeXComponent_TouchEvent::screenX = 0.0 

Description:

X coordinate of the touch point relative to the left edge of the screen.

screenY [1/2]

float OH_NativeXComponent_TouchPoint::screenY = 0.0 

Description:

Y coordinate of the touch point relative to the upper edge of the screen.

screenY [2/2]

float OH_NativeXComponent_TouchEvent::screenY = 0.0 

Description:

Y coordinate of the touch point relative to the upper edge of the screen.

size [1/2]

double OH_NativeXComponent_TouchPoint::size = 0.0 

Description:

Contact area between the finger pad and the screen.

size [2/2]

double OH_NativeXComponent_TouchEvent::size = 0.0 

Description:

Contact area between the finger pad and the screen.

timeStamp [1/2]

long long OH_NativeXComponent_TouchPoint::timeStamp = 0 

Description:

Timestamp of the current touch event.

timeStamp [2/2]

long long OH_NativeXComponent_TouchEvent::timeStamp = 0 

Description:

Timestamp of the current touch event.

touchPoints

OH_NativeXComponent_TouchPoint OH_NativeXComponent_TouchEvent::touchPoints[OH_MAX_TOUCH_POINTS_NUMBER] 

Description:

Array of the current touch points.

type [1/2]

OH_NativeXComponent_TouchEventType OH_NativeXComponent_TouchPoint::type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN 

Description:

Touch type of the touch event.

type [2/2]

OH_NativeXComponent_TouchEventType OH_NativeXComponent_TouchEvent::type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN 

Description:

Touch type of the touch event.

x [1/2]

float OH_NativeXComponent_TouchPoint::x = 0.0 

Description:

X coordinate of the touch point relative to the left edge of the element to touch.

x [2/2]

float OH_NativeXComponent_TouchEvent::x = 0.0 

Description:

X coordinate of the touch point relative to the left edge of the element to touch.

y [1/2]

float OH_NativeXComponent_TouchPoint::y = 0.0 

Description:

Y coordinate of the touch point relative to the upper edge of the element to touch.

y [2/2]

float OH_NativeXComponent_TouchEvent::y = 0.0 

鸿蒙更多技术,结尾扫
外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

Description:

Y coordinate of the touch point relative to the upper edge of the element to touch.

相关内容

热门资讯

连日来!陕麻圈辅助开挂软件,w... 您好,陕麻圈辅助开挂软件这款游戏可以开挂的,确实是有挂的,需要了解加去威信【136704302】很多...
辅助透视!hhpoker辅助器... 辅助透视!hhpoker辅助器,hhpoker是正规的吗,原来有辅助方法(哔哩哔哩)所有人都在同一条...
透视神器"德州局透视... 透视神器"德州局透视脚本下载安装最新版本"德普之星透视辅助软件是真的吗(确实是有辅助修改器)-哔哩哔...
围绕透视问题!小程序牵手跑得有... 围绕透视问题!小程序牵手跑得有外g挂吗,wepoker如何设置透视(透视)一贯是有辅助app(哔哩哔...
专业透视!德扑HHpoker有... 专业透视!德扑HHpoker有挂吗,HH平台挂,一贯存在有辅助神器(哔哩哔哩)1、下载好正确养号方法...
据公告内容"wepo... 据公告内容"wepoker有没有辅助"hhpoker视频巡查真的假的(总是是有辅助工具)-哔哩哔哩据...
昨日!新蛮王辅助器,德州透视插... 昨日!新蛮王辅助器,德州透视插件(透视)总是是真的有辅助软件(哔哩哔哩)1、德州透视插件辅助器安装包...
出乎意料的是"安装不... 出乎意料的是"安装不了wepoker"德州局脚本(确实真的是有辅助修改器)-哔哩哔哩1、点击下载安装...
详细透视!hh poker辅助... 详细透视!hh poker辅助器先试用,hhpoker为什么一直输,果然存在有辅助方法(哔哩哔哩)1...
据监测!情怀宜春辅助,wepo... 据监测!情怀宜春辅助,wepoker祈福有用吗(透视)确实有辅助软件(哔哩哔哩)1、首先打开情怀宜春...