diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index 93b14a1c3adaebadd714c34a09f269a366be891f..5d745e3dc00074c6edbc37c1c7585275eda5151a 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -2574,5 +2574,21 @@ { "first_introduced": "16", "name": "OH_ArkUI_UnregisterDrawCallbackOnNodeHandle" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CreateSnapshotOptions" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_DestroySnapshotOptions" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_SnapshotOptions_SetScale" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_GetNodeSnapshot" } ] \ No newline at end of file diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index f0783cab5dd4aaddb09b85f24ef60bd4e7b1e334..c93ac097cb2eeae8ee9e029a24bfc9adb18e10bc 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -8512,6 +8512,24 @@ int32_t OH_ArkUI_UnregisterLayoutCallbackOnNodeHandle(ArkUI_NodeHandle node); */ int32_t OH_ArkUI_UnregisterDrawCallbackOnNodeHandle(ArkUI_NodeHandle node); +/** + * @brief get the snapshot pixelmap for the given node, + * will get error if the node is not on the tree or is not rendered yet. + * Note: the pixelmap should be released through OH_PixelmapNative_Release when it's not used any more. + * + * @param node Indicates the target node. + * @param snapshotOptions The given configuration for taking snapshot, can be null for using default. + * @param pixelmap Pixelmap pointer created by system, it's the out result. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * Returns {@link ARKUI_ERROR_CODE_INTERNAL_ERROR} if some internal error occurs. + * Returns {@link ARKUI_ERROR_CODE_COMPONENT_SNAPSHOT_TIMEOUT} if the snapshot taking is timeout. + * @since 16 + */ +int32_t OH_ArkUI_GetNodeSnapshot(ArkUI_NodeHandle node, ArkUI_SnapshotOptions* snapshotOptions, + OH_PixelmapNative** pixelMap); + #ifdef __cplusplus }; #endif diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index 05352dd08731ba754349d38749846796f949bd0d..d764501397d507b342585f8ad40ac73122ae60e6 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -1957,6 +1957,11 @@ typedef enum { * @since 16 */ ARKUI_ERROR_CODE_CAPI_INIT_ERROR = 500, + /** + * @error Internal error occurs. + * @since 16 + */ + ARKUI_ERROR_CODE_INTERNAL_ERROR = 100001, /** @error The component does not support specific properties or events. */ ARKUI_ERROR_CODE_ATTRIBUTE_OR_EVENT_NOT_SUPPORTED = 106102, /** @error The corresponding operation does not support nodes created by ArkTS. */ @@ -1979,6 +1984,11 @@ typedef enum { ARKUI_ERROR_CODE_GET_INFO_FAILED = 106201, /** The buffer size is not large enough. */ ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR = 106202, + /** + * @error The snapshot taking is timeout. + * @since 16 + */ + ARKUI_ERROR_CODE_COMPONENT_SNAPSHOT_TIMEOUT = 160002, /** The component is not a scroll container. */ ARKUI_ERROR_CODE_NON_SCROLLABLE_CONTAINER = 180001, /** The buffer is not large enough. */ @@ -2268,6 +2278,13 @@ typedef enum { */ typedef struct ArkUI_SystemFontStyleEvent ArkUI_SystemFontStyleEvent; +/** + * @brief Defines the options for taking snapshot. + * + * @since 16 + */ +typedef struct ArkUI_SnapshotOptions ArkUI_SnapshotOptions; + /** * @brief Creates a size constraint. * @@ -4145,6 +4162,35 @@ float OH_ArkUI_ProgressLinearStyleOption_GetStrokeWidth(ArkUI_ProgressLinearStyl * @since 16 */ float OH_ArkUI_ProgressLinearStyleOption_GetStrokeRadius(ArkUI_ProgressLinearStyleOption* option); + +/** + * @brief Creates an option for taking snapshot, the returned value must be released through + * {@link OH_ArkUI_SnapshotOptions_Dispose} when it's not used anymore. + * + * @return Returns the pointer to the created snapshot options object.If the object returns a null pointer, + * it indicates a creation failure, and the reason for the failure may be that the address space is full. + * @since 16 + */ +ArkUI_SnapshotOptions* OH_ArkUI_CreateSnapshotOptions(); + +/** + * @brief Dispose a snapshot option object. + * + * @param snapshotOptions Indicates the pointer to the snapshot option. + * @since 16 + */ +void OH_ArkUI_DestroySnapshotOptions(ArkUI_SnapshotOptions* snapshotOptions); + +/** + * @brief Config the snapshot option with scale. + * + * @param snapshotOptions Indicates the pointer to the snapshot option. + * @param scale Indicates the scale property to take the snapshot. + * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +void OH_ArkUI_SnapshotOptions_SetScale(ArkUI_SnapshotOptions* snapshotOptions, float scale); #ifdef __cplusplus }; #endif