PathMeasure

class PathMeasure

PathMeasure

Classes

GetPosAndTan

Members:

Methods

__init__

Overloaded function.

getLength

Return the total length of the current contour, or 0 if no path is associated.

getMatrix

Pins distance to 0 <= distance <= getLength(), and then computes the corresponding matrix (by calling getPosTan).

getPosTan

Pins distance to 0 <= distance <= getLength(), and then computes the corresponding position and tangent.

getSegment

Given a start and stop distance, return in dst the intervening segment(s).

isClosed

return:

true if the current contour is closed()

nextContour

Move to the next contour in the path.

setPath

Reset the pathmeasure with the specified path.

Attributes

kGetPosAndTan_MatrixFlag

kGetPosition_MatrixFlag

kGetTangent_MatrixFlag

Methods

PathMeasure.__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: skia.PathMeasure) -> None

    Initializes a PathMeasure without an associated Path

  2. __init__(self: skia.PathMeasure, path: skia.Path, forceClosed: bool, resScale: float = 1.0) -> None

    Initialize the PathMeasure with the specified path.

    The parts of the path that are needed are copied, so the client is free to modify/delete the path after this call.

    resScale controls the precision of the measure. values > 1 increase the precision (and possibly slow down the computation).

PathMeasure.getLength(self: skia.PathMeasure) float

Return the total length of the current contour, or 0 if no path is associated.

PathMeasure.getMatrix(self: skia.PathMeasure, distance: float, flags: skia.PathMeasure.GetPosAndTan = <GetPosAndTan.kGetPosAndTan_MatrixFlag: 3>) object

Pins distance to 0 <= distance <= getLength(), and then computes the corresponding matrix (by calling getPosTan).

Returns false if there is no path, or a zero-length path was specified, in which case matrix is unchanged.

Returns:

None if there is no path, or a zero-length path was

specified. Otherwise returns a Matrix containing the result.

PathMeasure.getPosTan(self: skia.PathMeasure, distance: float) object

Pins distance to 0 <= distance <= getLength(), and then computes the corresponding position and tangent.

Returns:

None if there is no path, or a zero-length path was

specified. Otherwise returns a tuple containing the position Point and tangent Vector.

PathMeasure.getSegment(self: skia.PathMeasure, startD: float, stopD: float, dst: skia.Path, startWithMoveTo: bool) bool

Given a start and stop distance, return in dst the intervening segment(s).

Returns:

If the segment is zero-length, return false, else

return true. startD and stopD are pinned to legal values (0..getLength()). If startD > stopD then return false (and leave dst untouched). Begin the segment with a moveTo if startWithMoveTo is true

PathMeasure.isClosed(self: skia.PathMeasure) bool
Returns:

true if the current contour is closed()

PathMeasure.nextContour(self: skia.PathMeasure) bool

Move to the next contour in the path.

Returns:

true if one exists, or false if we’re done with the

path.

PathMeasure.setPath(self: skia.PathMeasure, arg0: skia.Path, arg1: bool) None

Reset the pathmeasure with the specified path.

The parts of the path that are needed are copied, so the client is free to modify/delete the path after this call..

Attributes

PathMeasure.kGetPosAndTan_MatrixFlag = <GetPosAndTan.kGetPosAndTan_MatrixFlag: 3>
PathMeasure.kGetPosition_MatrixFlag = <GetPosAndTan.kGetPosition_MatrixFlag: 1>
PathMeasure.kGetTangent_MatrixFlag = <GetPosAndTan.kGetTangent_MatrixFlag: 2>