目录

drawing_error_code.h

Overview

This file declares the functions related to the error code in the drawing module.

File to include: <native_drawing/drawing_error_code.h>

Library: libnative_drawing.so

System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing

Since: 12

Related module: Drawing

Summary

[h2]Enumerated value

Name typedef Keyword Description
OH_Drawing_ErrorCode OH_Drawing_ErrorCode Defines an enum for the error codes that may be generated by the module.

[h2]Functions

Name Description
OH_Drawing_ErrorCode OH_Drawing_ErrorCodeGet() Obtains the error code of the module.
void OH_Drawing_ErrorCodeReset(void)

Resets the error code of this module to OH_DRAWING_SUCCESS.

When a function that does not return an error code fails, the error code obtained through OH_Drawing_ErrorCodeGet is reset to the corresponding error number. However, it is not reset to OH_DRAWING_SUCCESS for a successful operation.

By calling this function, you can manually reset the error code to OH_DRAWING_SUCCESS, avoiding interference between different functions and simplifying the debugging process.

Enum Description

[h2]OH_Drawing_ErrorCode

enum OH_Drawing_ErrorCode

Description

Defines an enum for the error codes that may be generated by the module.

Since: 12

Value Description
OH_DRAWING_SUCCESS = 0 Operation successful.
OH_DRAWING_ERROR_NO_PERMISSION = 201 Permission denied.
OH_DRAWING_ERROR_INVALID_PARAMETER = 401 Invalid input parameter. For example, NULL is passed in.
OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE = 26200001 The input parameter is not in the valid range.
OH_DRAWING_ERROR_ALLOCATION_FAILED = 26200002

Failed to allocate memory.

Since: 13

OH_DRAWING_ERROR_ATTRIBUTE_ID_MISMATCH = 26200003

No function matches the input attribute ID.

Since: 21

OH_DRAWING_ERROR_INCORRECT_PARAMETER = 26200004

The input parameter is incorrect. For example, the pointer of the input parameter is null.

Since: 22

OH_DRAWING_ERROR_FILE_NOT_FOUND = 26200005

File not found. The specified file does not exist or the path is incorrect.

Since: 23

OH_DRAWING_ERROR_OPEN_FILE_FAILED = 26200006

Failed to open the file, which is caused by insufficient permissions or I/O issues.

Since: 23

OH_DRAWING_ERROR_FILE_SEEK_FAILED = 26200007

Fails to seek the file. The system cannot reposition the file read pointer.

Since: 23

OH_DRAWING_ERROR_GET_FILE_SIZE_FAILED = 26200008

Failed to obtain the file size. The system cannot obtain the file size information.

Since: 23

OH_DRAWING_ERROR_READ_FILE_FAILED = 26200009

Failed to read the file. The file cannot be read completely or contains unreadable data.

Since: 23

OH_DRAWING_ERROR_EMPTY_FILE = 26200010

Empty file. The specified font file is empty and does not contain valid data.

Since: 23

OH_DRAWING_ERROR_FILE_CORRUPTED = 26200011

Corrupted file. The file content is invalid or corrupted, and cannot be parsed.

Since: 23

Function Description

[h2]OH_Drawing_ErrorCodeGet()

OH_Drawing_ErrorCode OH_Drawing_ErrorCodeGet()

Description

Obtains the error code of the module.

System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing

Since: 12

Return value

Type Description
OH_Drawing_ErrorCode Obtains the latest error code of the module. After the function is successfully executed, the error code returned by this function will not be modified.

[h2]OH_Drawing_ErrorCodeReset()

void OH_Drawing_ErrorCodeReset(void)

Description

Resets the error code of this module to OH_DRAWING_SUCCESS.

When a function that does not return an error code fails, the error code obtained through OH_Drawing_ErrorCodeGet is reset to the corresponding error number. However, it is not reset to OH_DRAWING_SUCCESS for a successful operation.

By calling this function, you can manually reset the error code to OH_DRAWING_SUCCESS, avoiding interference between different functions and simplifying the debugging process.

System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing

Since: 18