openharmony 鸿蒙 capi-drawing-path-iterator-h

2026-08-25 浏览 (1)

drawing_path_iterator.h

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

Nametypedef KeywordDescription
OH_Drawing_PathIteratorVerbOH_Drawing_PathIteratorVerbEnumerates the path operation types contained in an iterator. It is used to read path operation instructions.

Functions

NameDescription
OH_Drawing_ErrorCode OH_Drawing_PathIteratorCreate(const OH_Drawing_Path* path, OH_Drawing_PathIterator** pathIterator)Creates an OH_Drawing_PathIterator object.
OH_Drawing_ErrorCode OH_Drawing_PathIteratorDestroy(OH_Drawing_PathIterator* pathIterator)Destroys an OH_Drawing_PathIterator object and reclaims the memory occupied by the object.
OH_Drawing_ErrorCode OH_Drawing_PathIteratorHasNext(const OH_Drawing_PathIterator* pathIterator, bool* hasNext)Checks whether there is any next operation in the path operation iterator.
OH_Drawing_ErrorCode OH_Drawing_PathIteratorNext(OH_Drawing_PathIterator* pathIterator, OH_Drawing_Point2D* points, uint32_t count, uint32_t offset, OH_Drawing_PathIteratorVerb* verb)Retrieves the next operation in this path and moves the iterator to that operation.
OH_Drawing_ErrorCode OH_Drawing_PathIteratorPeek(const OH_Drawing_PathIterator* pathIterator, OH_Drawing_PathIteratorVerb* verb)Retrieves the next operation in this path, without moving the iterator.

Enum Description

OH_Drawing_PathIteratorVerb

enum OH_Drawing_PathIteratorVerb

Description

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

Since: 23

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

Function Description

OH_Drawing_PathIteratorCreate()

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

ParameterDescription
const OH_Drawing_Path* pathPointer to an OH_Drawing_Path object.
OH_Drawing_PathIterator** pathIteratorDouble pointer to an OH_Drawing_PathIterator object, which serves as an output parameter.

Returns

TypeDescription
OH_Drawing_ErrorCodeExecution 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()

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

ParameterDescription
OH_Drawing_PathIterator* pathIteratorPointer to an OH_Drawing_PathIterator object.

Returns

TypeDescription
OH_Drawing_ErrorCodeExecution result.
OH_DRAWING_SUCCESS if the operation is successful.
OH_DRAWING_ERROR_INCORRECT_PARAMETER if pathIterator is a null pointer.

OH_Drawing_PathIteratorHasNext()

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

ParameterDescription
const OH_Drawing_PathIterator* pathIteratorPointer to an OH_Drawing_PathIterator object.
bool* hasNextWhether 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

TypeDescription
OH_Drawing_ErrorCodeExecution 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()

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

ParameterDescription
OH_Drawing_PathIterator* pathIteratorPointer to an OH_Drawing_PathIterator object.
OH_Drawing_Point2D* pointsArray of coordinate points.
uint32_t countSize of the coordinate point array.
uint32_t offsetOffset of the write position relative to the start point in the array. The value range is [0, count – 4].
OH_Drawing_PathIteratorVerb* verbNext operation of the current path, which serves as an output parameter.

Returns

TypeDescription
OH_Drawing_ErrorCodeExecution 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()

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

ParameterDescription
const OH_Drawing_PathIterator* pathIteratorPointer to an OH_Drawing_PathIterator object.
OH_Drawing_PathIteratorVerb* verbNext operation of the current path, which serves as an output parameter.

Returns

TypeDescription
OH_Drawing_ErrorCodeExecution result.
OH_DRAWING_SUCCESS if the operation is successful.
OH_DRAWING_ERROR_INCORRECT_PARAMETER if pathIterator or verb is a null pointer.

你可能感兴趣的鸿蒙文章

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/0nBSCj4Z