We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
ReferencesGraphicsArkGraphics 2DC APIsHeader Filesdrawing_path_iterator.h

drawing_path_iterator.h

Phone23+PC/2in123+Tablet23+TV23+Wearable23+

Overview

This file declares the functions related to the path operation iterator object.

File to include: <native_drawing/drawing_path_iterator.h>

Library: libnative_drawing.so

System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing

Since: 23

Related module: Drawing

Summary

Enums

Expand
Name typedef Keyword Description
OH_Drawing_PathIteratorVerb OH_Drawing_PathIteratorVerb Enumerates the path operation types contained in an iterator. It is used to read path operation instructions.

Enum Description

OH_Drawing_PathIteratorVerb

Phone23+PC/2in123+Tablet23+TV23+Wearable23+
Collapse
Word wrap
Dark theme
Copy code
  1. enum OH_Drawing_PathIteratorVerb

Description

Enumerates the path operation types contained in an iterator. It is used to read path operation instructions.

Since: 23

Expand
Enum Item Description
MOVE = 0 Sets the start point of the path.
LINE = 1 Adds a line segment.
QUAD = 2 Adds a quadratic Bezier curve for smooth transitions.
CONIC = 3 Adds a conic curve.
CUBIC = 4 Adds a cubic Bezier curve for smooth transitions.
CLOSE = 5 Closes the path.
DONE = CLOSE + 1 Completes the path configuration.

Function Description

OH_Drawing_PathIteratorCreate()

Phone23+PC/2in123+Tablet23+TV23+Wearable23+
Collapse
Word wrap
Dark theme
Copy code
  1. OH_Drawing_ErrorCode OH_Drawing_PathIteratorCreate(const OH_Drawing_Path* path, OH_Drawing_PathIterator** pathIterator)

Description

Creates an OH_Drawing_PathIterator object.

Since: 23

Parameters

Expand
Parameter Description
const OH_Drawing_Path* path Pointer to an OH_Drawing_Path object.
OH_Drawing_PathIterator** pathIterator Double pointer to an OH_Drawing_PathIterator object, which serves as an output parameter.

Returns

Expand
Type Description
OH_Drawing_ErrorCode

Execution result.

OH_DRAWING_SUCCESS if the operation is successful.

OH_DRAWING_ERROR_INCORRECT_PARAMETER if path or pathIterator is a null pointer.

OH_Drawing_PathIteratorDestroy()

Phone23+PC/2in123+Tablet23+TV23+Wearable23+
Collapse
Word wrap
Dark theme
Copy code
  1. OH_Drawing_ErrorCode OH_Drawing_PathIteratorDestroy(OH_Drawing_PathIterator* pathIterator)

Description

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

Since: 23

Parameters

Expand
Parameter Description
OH_Drawing_PathIterator* pathIterator Pointer to an OH_Drawing_PathIterator object.

Returns

Expand
Type Description
OH_Drawing_ErrorCode

Execution result.

OH_DRAWING_SUCCESS if the operation is successful.

OH_DRAWING_ERROR_INCORRECT_PARAMETER if pathIterator is a null pointer.

OH_Drawing_PathIteratorHasNext()

Phone23+PC/2in123+Tablet23+TV23+Wearable23+
Collapse
Word wrap
Dark theme
Copy code
  1. OH_Drawing_ErrorCode OH_Drawing_PathIteratorHasNext(const OH_Drawing_PathIterator* pathIterator, bool* hasNext)

Description

Checks whether there is any next operation in the path operation iterator.

Since: 23

Parameters

Expand
Parameter Description
const OH_Drawing_PathIterator* pathIterator Pointer to an OH_Drawing_PathIterator object.
bool* hasNext Whether there is a next operation in the path operation iterator, which serves as an output parameter. A value of true means there is a next operation; false means the opposite.

Returns

Expand
Type Description
OH_Drawing_ErrorCode

Execution result.

OH_DRAWING_SUCCESS if the operation is successful.

OH_DRAWING_ERROR_INCORRECT_PARAMETER if pathIterator or hasNext is a null pointer.

OH_Drawing_PathIteratorNext()

Phone23+PC/2in123+Tablet23+TV23+Wearable23+
Collapse
Word wrap
Dark theme
Copy code
  1. OH_Drawing_ErrorCode OH_Drawing_PathIteratorNext(OH_Drawing_PathIterator* pathIterator, OH_Drawing_Point2D* points, uint32_t count, uint32_t offset, OH_Drawing_PathIteratorVerb* verb)

Description

Retrieves the next operation in this path and moves the iterator to that operation.

Since: 23

Parameters

Expand
Parameter Description
OH_Drawing_PathIterator* pathIterator Pointer to an OH_Drawing_PathIterator object.
OH_Drawing_Point2D* points Array of coordinate points.
uint32_t count Size of the coordinate point array.
uint32_t offset Offset of the write position relative to the start point in the array. The value range is [0, count – 4].
OH_Drawing_PathIteratorVerb* verb Next operation of the current path, which serves as an output parameter.

Returns

Expand
Type Description
OH_Drawing_ErrorCode

Execution result.

OH_DRAWING_SUCCESS if the operation is successful.

OH_DRAWING_ERROR_INCORRECT_PARAMETER if pathIterator, points, or verb is a null pointer.

OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE if count is less than offset + 4.

OH_Drawing_PathIteratorPeek()

Phone23+PC/2in123+Tablet23+TV23+Wearable23+
Collapse
Word wrap
Dark theme
Copy code
  1. OH_Drawing_ErrorCode OH_Drawing_PathIteratorPeek(const OH_Drawing_PathIterator* pathIterator, OH_Drawing_PathIteratorVerb* verb)

Description

Retrieves the next operation in this path, without moving the iterator.

Since: 23

Parameters

Expand
Parameter Description
const OH_Drawing_PathIterator* pathIterator Pointer to an OH_Drawing_PathIterator object.
OH_Drawing_PathIteratorVerb* verb Next operation of the current path, which serves as an output parameter.

Returns

Expand
Type Description
OH_Drawing_ErrorCode

Execution result.

OH_DRAWING_SUCCESS if the operation is successful.

OH_DRAWING_ERROR_INCORRECT_PARAMETER if pathIterator or verb is a null pointer.