pub unsafe extern "C" fn OH_ArkUI_GetNodeSnapshot(
node: ArkUI_NodeHandle,
snapshotOptions: *mut ArkUI_SnapshotOptions,
pixelmap: *mut *mut OH_PixelmapNative,
) -> i32api-12 and api-15 only.Expand description
Get the snapshot pixelmap for the given node synchronously, 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.
§Arguments
-
node- Indicates the target node. -
snapshotOptions- the given configuration for taking snapshot, can be null for using default. -
pixelmap- Pixelmap pointer created by system, it’s the out result.
§Returns
- Returns the result code.
Returns [
ARKUI_ERROR_CODE_NO_ERROR] if the operation is successful. Returns [ARKUI_ERROR_CODE_PARAM_INVALID] if a parameter error occurs. Returns [ARKUI_ERROR_CODE_INTERNAL_ERROR] if the snapshot taking failed will null pixelmap returned. Returns [ARKUI_ERROR_CODE_COMPONENT_SNAPSHOT_TIMEOUT] if the snapshot taking is timeout.
Available since API-level: 15
Obtains a snapshot of a given component. If the node is not in the component tree or has not been rendered,
the snapshot operation will fail. When the Pixelmap object created is no longer in use, it should be released
by calling [OH_PixelmapNative_Release].
-
node- Target node. -
snapshotOptions- Snapshot settings. If the value is null, the default settings are used. Snapshot settings include scaling, color space, and dynamic range configuration. Scaling: floating-point value greater than 0. Color space: 3 (DISPLAY_P3), 4 (SRGB), 27 (DISPLAY_BT2020_SRGB). Dynamic range:ArkUI_DynamicRangeMode. -
pixelmap- Pointer to the Pixelmap object created by the system. -
Result code. [
ARKUI_ERROR_CODE_NO_ERROR] if the operation is successful. [ARKUI_ERROR_CODE_PARAM_INVALID] if a parameter error occurs. Returns [ARKUI_ERROR_CODE_INTERNAL_ERROR] if the snapshot fails, returning a null pointer. Returns [ARKUI_ERROR_CODE_COMPONENT_SNAPSHOT_TIMEOUT] if the snapshot operation times out. Returns [ARKUI_ERROR_CODE_COMPONENT_SNAPSHOT_MODE_NOT_SUPPORTED] if the provided color space or dynamic range mode is not supported. Returns [ARKUI_ERROR_CODE_COMPONENT_SNAPSHOT_AUTO_NOT_SUPPORTED] if the isAuto parameter of the color space or dynamic range mode is set to true for offscreen node snapshot.
Available since API-level: 23