Gsk.PathMeasure

Fields

None

Methods

class

new (path)

class

new_with_tolerance (path, tolerance)

get_length ()

get_path ()

get_point (distance)

get_tolerance ()

ref ()

unref ()

Details

class Gsk.PathMeasure

An object that allows measurements on paths 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.

New in version 4.14.

classmethod new(path)
Parameters:

path (Gsk.Path) – the path to measure

Returns:

a new GskPathMeasure representing path

Return type:

Gsk.PathMeasure

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

New in version 4.14.

classmethod new_with_tolerance(path, tolerance)
Parameters:
  • path (Gsk.Path) – the path to measure

  • tolerance (float) – the tolerance for measuring operations

Returns:

a new GskPathMeasure representing path

Return type:

Gsk.PathMeasure

Creates a measure object for the given path and tolerance.

New in version 4.14.

get_length()
Returns:

the length of the path measured by self

Return type:

float

Gets the length of the path being measured.

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

New in version 4.14.

get_path()
Returns:

the path of self

Return type:

Gsk.Path

Returns the path that the measure was created for.

New in version 4.14.

get_point(distance)
Parameters:

distance (float) – the distance

Returns:

true if result was set

result:

return location for the point

Return type:

(bool, result: Gsk.PathPoint)

Gets the point at the given distance into the path.

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

New in version 4.14.

get_tolerance()
Returns:

the tolerance of self

Return type:

float

Returns the tolerance that the measure was created with.

New in version 4.14.

ref()
Returns:

the passed in GskPathMeasure.

Return type:

Gsk.PathMeasure

Increases the reference count of a GskPathMeasure by one.

New in version 4.14.

unref()

Decreases the reference count of a GskPathMeasure by one.

If the resulting reference count is zero, frees the object.

New in version 4.14.