PathMeasure

Added in version 4.14.

class PathMeasure(**kwargs)

GskPathMeasure is an object that allows measurements on GskPath’s such as determining the length of the path.

Many measuring operations require sampling the path length at intermediate points. Therefore, a GskPathMeasure has a tolerance that determines what precision is required for such approximations.

A GskPathMeasure struct is a reference counted struct and should be treated as opaque.

Constructors

class PathMeasure
classmethod new(path: Path) PathMeasure

Creates a measure object for the given path with the default tolerance.

Added in version 4.14.

Parameters:

path – the path to measure

classmethod new_with_tolerance(path: Path, tolerance: float) PathMeasure

Creates a measure object for the given path and tolerance.

Added in version 4.14.

Parameters:
  • path – the path to measure

  • tolerance – the tolerance for measuring operations

Methods

class PathMeasure
get_length() float

Gets the length of the path being measured.

The length is cached, so this function does not do any work.

Added in version 4.14.

get_path() Path

Returns the path that the measure was created for.

Added in version 4.14.

get_point(distance: float) tuple[bool, PathPoint]

Sets result to the point at the given distance into the path.

An empty path has no points, so FALSE is returned in that case.

Added in version 4.14.

Parameters:

distance – the distance

get_tolerance() float

Returns the tolerance that the measure was created with.

Added in version 4.14.