openharmony 鸿蒙 capi-drawing-record-cmd-h

2026-08-25 浏览 (1)

drawing_record_cmd.h

Overview

This file declares the functions related to a recording command object.

File to include: <native_drawing/drawing_record_cmd.h>

Library: libnative_drawing.so

System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing

Since: 13

Related module: Drawing

Summary

Functions

NameDescription
OH_Drawing_RecordCmdUtils* OH_Drawing_RecordCmdUtilsCreate(void)Creates an OH_Drawing_RecordCmdUtils object.
OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsDestroy(OH_Drawing_RecordCmdUtils* recordCmdUtils)Destroys an OH_Drawing_RecordCmdUtils object and reclaims the memory occupied by the object.
OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsBeginRecording(OH_Drawing_RecordCmdUtils* recordCmdUtils,int32_t width, int32_t height, OH_Drawing_Canvas** canvas)Starts recording. This API must be used together with OH_Drawing_RecordCmdUtilsFinishRecording.
The OH_Drawing_RecordCmdUtils object generates a canvas object of the recording type and calls the interface of the drawing object to record all drawing commands.
OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsFinishRecording(OH_Drawing_RecordCmdUtils* recordCmdUtils,OH_Drawing_RecordCmd** recordCmd)Stops video recording. This function must be called after OH_Drawing_RecordCmdUtilsBeginRecording.
The OH_Drawing_RecordCmdUtils object ends recording and stores the drawing commands recorded by the canvas object of the recording type into the generated OH_Drawing_RecordCmdUtilsBeginRecording object.
OH_Drawing_ErrorCode OH_Drawing_RecordCmdDestroy(OH_Drawing_RecordCmd* recordCmd)Destroys an OH_Drawing_RecordCmd object and reclaims the memory occupied by the object.

Function Description

OH_Drawing_RecordCmdUtilsCreate()

OH_Drawing_RecordCmdUtils* OH_Drawing_RecordCmdUtilsCreate(void)

Description

Creates an OH_Drawing_RecordCmdUtils object.

System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing

Since: 13

Returns

TypeDescription
OH_Drawing_RecordCmdUtils*Returns the pointer to the OH_Drawing_RecordCmdUtils object created.

OH_Drawing_RecordCmdUtilsDestroy()

OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsDestroy(OH_Drawing_RecordCmdUtils* recordCmdUtils)

Description

Destroys an OH_Drawing_RecordCmdUtils object and reclaims the memory occupied by the object.

System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing

Since: 13

Parameters

NameDescription
OH_Drawing_RecordCmdUtils* recordCmdUtilsPointer to an OH_Drawing_RecordCmdUtils object.

Returns

TypeDescription
OH_Drawing_ErrorCodeReturns one of the following result codes:
OH_DRAWING_SUCCESS if the operation is successful.
OH_DRAWING_ERROR_INVALID_PARAMETER if recordCmdUtils is NULL.

OH_Drawing_RecordCmdUtilsBeginRecording()

OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsBeginRecording(OH_Drawing_RecordCmdUtils* recordCmdUtils,int32_t width, int32_t height, OH_Drawing_Canvas** canvas)

Description

Starts recording. This API must be used together with OH_Drawing_RecordCmdUtilsFinishRecording.
The OH_Drawing_RecordCmdUtils object generates a canvas object of the recording type and calls the interface of the drawing object to record all drawing commands.

System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing

Since: 13

Parameters

NameDescription
OH_Drawing_RecordCmdUtils* recordCmdUtilsPointer to an OH_Drawing_RecordCmdUtils object.
int32_t widthWidth of the canvas.
int32_t heightHeight of the canvas.
OH_Drawing_Canvas** canvasDouble pointer to the OH_Drawing_Canvas object. You do not need to release this pointer.
This object does not support nested calling of OH_Drawing_CanvasDrawRecordCmd.

Returns

TypeDescription
OH_Drawing_ErrorCodeReturns one of the following result codes:
OH_DRAWING_SUCCESS if the operation is successful.
OH_DRAWING_ERROR_INVALID_PARAMETER if either recordCmdUtils or canvas is NULL.
OH_DRAWING_ERROR_INVALID_PARAMETER if either width or height is less than 0.
OH_DRAWING_ERROR_ALLOCATION_FAILED if the system memory is insufficient.

OH_Drawing_RecordCmdUtilsFinishRecording()

OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsFinishRecording(OH_Drawing_RecordCmdUtils* recordCmdUtils,OH_Drawing_RecordCmd** recordCmd)

Description

Stops video recording. This function must be called after OH_Drawing_RecordCmdUtilsBeginRecording.
The OH_Drawing_RecordCmdUtils object ends recording and stores the drawing commands recorded by the canvas object of the recording type into the generated OH_Drawing_RecordCmdUtilsBeginRecording object.

System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing

Since: 13

Parameters

NameDescription
OH_Drawing_RecordCmdUtils* recordCmdUtilsPointer to an OH_Drawing_RecordCmdUtils object.
OH_Drawing_RecordCmd** recordCmdDouble pointer to the OH_Drawing_RecordCmd object. You need to call OH_Drawing_CanvasDrawRecordCmd to draw the object, and call OH_Drawing_RecordCmdDestroy to release it.

Returns

TypeDescription
OH_Drawing_ErrorCodeReturns one of the following result codes:
OH_DRAWING_SUCCESS if the operation is successful.
OH_DRAWING_ERROR_INVALID_PARAMETER if either recordCmdUtils or recordCmd is NULL.
OH_DRAWING_ERROR_ALLOCATION_FAILED if the system memory is insufficient.

OH_Drawing_RecordCmdDestroy()

OH_Drawing_ErrorCode OH_Drawing_RecordCmdDestroy(OH_Drawing_RecordCmd* recordCmd)

Description

Destroys an OH_Drawing_RecordCmd object and reclaims the memory occupied by the object.

System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing

Since: 13

Parameters

NameDescription
OH_Drawing_RecordCmd* recordCmdPointer to an OH_Drawing_RecordCmd object.

Returns

TypeDescription
OH_Drawing_ErrorCodeReturns one of the following result codes:
OH_DRAWING_SUCCESS if the operation is successful.
OH_DRAWING_ERROR_INVALID_PARAMETER if recordCmd is NULL.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-drawing-gpu-context-h

openharmony 鸿蒙 capi-drawing-nativepixelmap-

openharmony 鸿蒙 capi-nativevsync-oh-nativevsync-expectedraterange

openharmony 鸿蒙 capi-drawing-oh-drawing-brush

openharmony 鸿蒙 capi-drawing-oh-drawing-image-info

openharmony 鸿蒙 capi-drawing-text-linetypography-h

openharmony 鸿蒙 capi-oh-nativeimage-oh-nativeimage

openharmony 鸿蒙 capi-drawing-typeface-h

openharmony 鸿蒙 capi-drawing-brush-h

openharmony 鸿蒙 capi-nativewindow

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/i1LAkXqm