external_window.h

概述

定义获取和使用NativeWindow的相关函数

起始版本:

8

相关模块:

NativeWindow

汇总

结构体

结构体名称 描述
Region 表示本地窗口OHNativeWindow需要更新内容的矩形区域(脏区)
Region::Rect 矩形区域
OHHDRMetaData HDR元数据结构体定义
OHExtDataHandle 扩展数据句柄结构体定义

类型定义

类型名称 描述
OHNativeWindow 提供对OHNativeWindow的访问功能
OHNativeWindowBuffer 提供对OHNativeWindowBuffer的访问功能
Region 表示本地窗口OHNativeWindow需要更新内容的矩形区域(脏区)

枚举

枚举名称 描述
NativeWindowOperation {
SET_BUFFER_GEOMETRY, GET_BUFFER_GEOMETRY, GET_FORMAT, SET_FORMAT,
GET_USAGE, SET_USAGE, SET_STRIDE, GET_STRIDE,
SET_SWAP_INTERVAL, GET_SWAP_INTERVAL, SET_TIMEOUT, GET_TIMEOUT,
SET_COLOR_GAMUT, GET_COLOR_GAMUT, SET_TRANSFORM, GET_TRANSFORM,
SET_UI_TIMESTAMP
}
OH_NativeWindow_NativeWindowHandleOpt函数中的操作码
OHScalingMode { OH_SCALING_MODE_FREEZE = 0, OH_SCALING_MODE_SCALE_TO_WINDOW, OH_SCALING_MODE_SCALE_CROP, OH_SCALING_MODE_NO_SCALE_CROP } 缩放模式 Scaling Mode
OHHDRMetadataKey {
OH_METAKEY_RED_PRIMARY_X = 0, OH_METAKEY_RED_PRIMARY_Y = 1, OH_METAKEY_GREEN_PRIMARY_X = 2, OH_METAKEY_GREEN_PRIMARY_Y = 3,
OH_METAKEY_BLUE_PRIMARY_X = 4, OH_METAKEY_BLUE_PRIMARY_Y = 5, OH_METAKEY_WHITE_PRIMARY_X = 6, OH_METAKEY_WHITE_PRIMARY_Y = 7,
OH_METAKEY_MAX_LUMINANCE = 8, OH_METAKEY_MIN_LUMINANCE = 9, OH_METAKEY_MAX_CONTENT_LIGHT_LEVEL = 10, OH_METAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL = 11,
OH_METAKEY_HDR10_PLUS = 12, OH_METAKEY_HDR_VIVID = 13
}
枚举HDR元数据关键字

函数

函数名称 描述
OH_NativeWindow_CreateNativeWindow (void *pSurface) 创建OHNativeWindow实例,每次调用都会产生一个新的OHNativeWindow实例
OH_NativeWindow_DestroyNativeWindow (OHNativeWindow *window) 将OHNativeWindow对象的引用计数减1,当引用计数为0的时候,该OHNativeWindow对象会被析构掉
OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer (void *pSurfaceBuffer) 创建OHNativeWindowBuffer实例,每次调用都会产生一个新的OHNativeWindowBuffer实例
OH_NativeWindow_DestroyNativeWindowBuffer (OHNativeWindowBuffer *buffer) 将OHNativeWindowBuffer对象的引用计数减1,当引用计数为0的时候,该OHNativeWindowBuffer对象会被析构掉
OH_NativeWindow_NativeWindowRequestBuffer (OHNativeWindow *window, OHNativeWindowBuffer **buffer, int *fenceFd) 通过OHNativeWindow对象申请一块OHNativeWindowBuffer,用以内容生产
OH_NativeWindow_NativeWindowFlushBuffer (OHNativeWindow *window, OHNativeWindowBuffer *buffer, int fenceFd, Region region) 通过OHNativeWindow将生产好内容的OHNativeWindowBuffer放回到Buffer队列中,用以内容消费
OH_NativeWindow_NativeWindowAbortBuffer (OHNativeWindow *window, OHNativeWindowBuffer *buffer) 通过OHNativeWindow将之前申请出来的OHNativeWindowBuffer返还到Buffer队列中,供下次再申请
OH_NativeWindow_NativeWindowHandleOpt (OHNativeWindow*window, int code,...) 设置/获取OHNativeWindow的属性,包括设置/获取宽高、内容格式等
OH_NativeWindow_GetBufferHandleFromNative (OHNativeWindowBuffer *buffer) 通过OHNativeWindowBuffer获取该buffer的BufferHandle指针
OH_NativeWindow_NativeObjectReference (void *obj) 增加一个NativeObject的引用计数
OH_NativeWindow_NativeObjectUnreference (void *obj) 减少一个NativeObject的引用计数,当引用计数减少为0时,该NativeObject将被析构
OH_NativeWindow_GetNativeObjectMagic (void *obj) 获取NativeObject的MagicId
OH_NativeWindow_NativeWindowSetScalingMode (OHNativeWindownative_window.md#ohscalingmode) scalingMode) 设置OHNativeWindow的ScalingMode
OH_NativeWindow_NativeWindowSetMetaData (OHNativeWindow *window, uint32_t sequence, int32_t size, const OHHDRMetaData *metaData) 设置OHNativeWindow的元数据
OH_NativeWindow_NativeWindowSetMetaDataSet (OHNativeWindow *window, uint32_t sequence, OHHDRMetadataKey key, int32_t size, const uint8_t *metaData) 设置OHNativeWindow的元数据集。
OH_NativeWindow_NativeWindowSetTunnelHandle (OHNativeWindow *window, const OHExtDataHandle *handle) 设置OHNativeWindow的TunnelHandle。