Package ch.bailu.gtk.gsk
Klasse PathPoint
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.type.Record
ch.bailu.gtk.gsk.PathPoint
- Alle implementierten Schnittstellen:
PointerInterface
An opaque type representing a point on a path.
It can be queried for properties of the path at that point,
such as its tangent or its curvature.
To obtain a `GskPathPoint`, use [method@Gsk.Path.get_closest_point],
[method@Gsk.Path.get_start_point], [method@Gsk.Path.get_end_point]
or [method@Gsk.PathMeasure.get_point].
Note that `GskPathPoint` structs are meant to be stack-allocated,
and don't hold a reference to the path object they are obtained from.
It is the callers responsibility to keep a reference to the path
as long as the `GskPathPoint` is used.
It can be queried for properties of the path at that point,
such as its tangent or its curvature.
To obtain a `GskPathPoint`, use [method@Gsk.Path.get_closest_point],
[method@Gsk.Path.get_start_point], [method@Gsk.Path.get_end_point]
or [method@Gsk.PathMeasure.get_point].
Note that `GskPathPoint` structs are meant to be stack-allocated,
and don't hold a reference to the path object they are obtained from.
It is the callers responsibility to keep a reference to the path
as long as the `GskPathPoint` is used.
-
Feldübersicht
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungint
Returns whether @point1 is before or after @point2.copy()
Copies a path point.boolean
Returns whether the two path points refer to the same
location on all paths.void
free()
Frees a path point copied by [method@Gsk.PathPoint.copy].static ClassHandler
float
getCurvature
(Path path, int direction, Point center) Calculates the curvature of the path at the point.float
getDistance
(PathMeasure measure) Returns the distance from the beginning of the path
to the point.static int
static long
static TypeSystem.TypeSize
void
getPosition
(Path path, Point position) Gets the position of the point.float
getRotation
(Path path, int direction) Gets the direction of the tangent at a given point.void
getTangent
(Path path, int direction, Vec2 tangent) Gets the tangent of the path at the point.static long
static TypeSystem.TypeSize
Von Klasse geerbte Methoden ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Von Klasse geerbte Methoden ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Konstruktordetails
-
PathPoint
-
-
Methodendetails
-
getClassHandler
-
compare
Returns whether @point1 is before or after @point2.- Parameter:
point2
- another path point- Gibt zurück:
- -1 if @point1 is before @point2, 1 if @point1 is after @point2, 0 if they are equal
-
copy
Copies a path point.- Gibt zurück:
- the copied point
-
equal
Returns whether the two path points refer to the same
location on all paths.
Note that the start- and endpoint of a closed contour
will compare nonequal according to this definition.
Use [method@Gsk.Path.is_closed] to find out if the
start- and endpoint of a concrete path refer to the
same location.- Parameter:
point2
- another path point- Gibt zurück:
- true if @point1 and @point2 are equal
-
free
public void free()Frees a path point copied by [method@Gsk.PathPoint.copy]. -
getCurvature
Calculates the curvature of the path at the point.
Optionally, returns the center of the osculating circle as well.
The curvature is the inverse of the radius of the osculating circle.
Lines have a curvature of zero (indicating an osculating circle of
infinite radius). In this case, the @center is not modified.
Circles with a radius of zero have `INFINITY` as curvature
Note that certain points on a path may not have a single curvature,
such as sharp turns. At such points, there are two curvatures — the
(limit of) the curvature of the path going into the point, and the
(limit of) the curvature of the path coming out of it. The @direction
argument lets you choose which one to get.
<picture>
<source srcset="curvature-dark.png" media="(prefers-color-scheme: dark)">
<img alt="Osculating circle" src="curvature-light.png">
</picture>- Parameter:
path
- the path that @point is ondirection
- the direction for which to return the curvaturecenter
- return location for the center of the osculating circle- Gibt zurück:
- the curvature of the path at the given point
-
getDistance
Returns the distance from the beginning of the path
to the point.- Parameter:
measure
- a path measure for the path- Gibt zurück:
- the distance of @point
-
getPosition
Gets the position of the point.- Parameter:
path
- the path that @point is onposition
- Return location for the coordinates of the point
-
getRotation
Gets the direction of the tangent at a given point.
This is a convenience variant of [method@Gsk.PathPoint.get_tangent]
that returns the angle between the tangent and the X axis. The angle
can e.g. be used in
[gtk_snapshot_rotate()](../gtk4/method.Snapshot.rotate.html).- Parameter:
path
- the path that @point is ondirection
- the direction for which to return the rotation- Gibt zurück:
- the angle between the tangent and the X axis, in degrees
-
getTangent
Gets the tangent of the path at the point.
Note that certain points on a path may not have a single
tangent, such as sharp turns. At such points, there are
two tangents — the direction of the path going into the
point, and the direction coming out of it. The @direction
argument lets you choose which one to get.
If the path is just a single point (e.g. a circle with
radius zero), then the tangent is set to `0, 0`.
If you want to orient something in the direction of the
path, [method@Gsk.PathPoint.get_rotation] may be more
convenient to use.- Parameter:
path
- the path that @point is ondirection
- the direction for which to return the tangenttangent
- Return location for the tangent at the point
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-