// Package gsk was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gsk import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/gobject/types" "github.com/bnema/puregotk/v4/graphene" ) // Represents 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. type PathPoint struct { _ structs.HostLayout } var xPathPointGLibType func() types.GType func PathPointGLibType() types.GType { return xPathPointGLibType() } func (x *PathPoint) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } var xPathPointCompare func(uintptr, *PathPoint) int // Returns whether @point1 is before or after @point2. func (x *PathPoint) Compare(Point2Var *PathPoint) int { cret := xPathPointCompare(x.GoPointer(), Point2Var) return cret } var xPathPointCopy func(uintptr) *PathPoint // Copies a path point. func (x *PathPoint) Copy() *PathPoint { cret := xPathPointCopy(x.GoPointer()) return cret } var xPathPointEqual func(uintptr, *PathPoint) bool // 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. func (x *PathPoint) Equal(Point2Var *PathPoint) bool { cret := xPathPointEqual(x.GoPointer(), Point2Var) return cret } var xPathPointFree func(uintptr) // Frees a path point copied by [method@Gsk.PathPoint.copy]. func (x *PathPoint) Free() { xPathPointFree(x.GoPointer()) } var xPathPointGetCurvature func(uintptr, *Path, PathDirection, *graphene.Point) float32 // 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> func (x *PathPoint) GetCurvature(PathVar *Path, DirectionVar PathDirection, CenterVar *graphene.Point) float32 { cret := xPathPointGetCurvature(x.GoPointer(), PathVar, DirectionVar, CenterVar) return cret } var xPathPointGetDistance func(uintptr, *PathMeasure) float32 // Returns the distance from the beginning of the path // to the point. func (x *PathPoint) GetDistance(MeasureVar *PathMeasure) float32 { cret := xPathPointGetDistance(x.GoPointer(), MeasureVar) return cret } var xPathPointGetPosition func(uintptr, *Path, *graphene.Point) // Gets the position of the point. func (x *PathPoint) GetPosition(PathVar *Path, PositionVar *graphene.Point) { xPathPointGetPosition(x.GoPointer(), PathVar, PositionVar) } var xPathPointGetRotation func(uintptr, *Path, PathDirection) float32 // 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). func (x *PathPoint) GetRotation(PathVar *Path, DirectionVar PathDirection) float32 { cret := xPathPointGetRotation(x.GoPointer(), PathVar, DirectionVar) return cret } var xPathPointGetTangent func(uintptr, *Path, PathDirection, *graphene.Vec2) // 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. func (x *PathPoint) GetTangent(PathVar *Path, DirectionVar PathDirection, TangentVar *graphene.Vec2) { xPathPointGetTangent(x.GoPointer(), PathVar, DirectionVar, TangentVar) } func init() { core.SetPackageName("GSK", "gtk4") core.SetSharedLibraries("GSK", []string{"libgtk-4.so.1"}) var libs []uintptr for _, libPath := range core.GetPaths("GSK") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xPathPointGLibType, libs, "gsk_path_point_get_type") core.PuregoSafeRegister(&xPathPointCompare, libs, "gsk_path_point_compare") core.PuregoSafeRegister(&xPathPointCopy, libs, "gsk_path_point_copy") core.PuregoSafeRegister(&xPathPointEqual, libs, "gsk_path_point_equal") core.PuregoSafeRegister(&xPathPointFree, libs, "gsk_path_point_free") core.PuregoSafeRegister(&xPathPointGetCurvature, libs, "gsk_path_point_get_curvature") core.PuregoSafeRegister(&xPathPointGetDistance, libs, "gsk_path_point_get_distance") core.PuregoSafeRegister(&xPathPointGetPosition, libs, "gsk_path_point_get_position") core.PuregoSafeRegister(&xPathPointGetRotation, libs, "gsk_path_point_get_rotation") core.PuregoSafeRegister(&xPathPointGetTangent, libs, "gsk_path_point_get_tangent") }