gi-gsk-4.0.9: Gsk bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gsk.Structs.PathPoint

Contents

- Exported types
- Methods
  - compare
  - copy
  - equal
  - free
  - getCurvature
  - getDistance
  - getPosition
  - getRotation
  - getTangent

Description

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 `pathGetClosestPoint`, `pathGetStartPoint`, `pathGetEndPoint` or `pathMeasureGetPoint`.

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.

Since: 4.14

Synopsis

- newtype PathPoint = PathPoint (ManagedPtr PathPoint)
- pathPointCompare :: (HasCallStack, MonadIO m) => PathPoint -> PathPoint -> m Int32
- pathPointCopy :: (HasCallStack, MonadIO m) => PathPoint -> m PathPoint
- pathPointEqual :: (HasCallStack, MonadIO m) => PathPoint -> PathPoint -> m Bool
- pathPointFree :: (HasCallStack, MonadIO m) => PathPoint -> m ()
- pathPointGetCurvature :: (HasCallStack, MonadIO m) => PathPoint -> Path -> PathDirection -> m (Float, Maybe Point)
- pathPointGetDistance :: (HasCallStack, MonadIO m) => PathPoint -> PathMeasure -> m Float
- pathPointGetPosition :: (HasCallStack, MonadIO m) => PathPoint -> Path -> m Point
- pathPointGetRotation :: (HasCallStack, MonadIO m) => PathPoint -> Path -> PathDirection -> m Float
- pathPointGetTangent :: (HasCallStack, MonadIO m) => PathPoint -> Path -> PathDirection -> m Vec2

# Exported types

newtype PathPoint Source #

Memory-managed wrapper type.

Constructors

PathPoint (ManagedPtr PathPoint) |

#### Instances

Instances details

Eq PathPoint Source # |
Instance details Defined in GI.Gsk.Structs.PathPoint Methods (==) :: PathPoint -> PathPoint -> Bool Source # (/=) :: PathPoint -> PathPoint -> Bool Source #
GBoxed PathPoint Source # |
Instance details Defined in GI.Gsk.Structs.PathPoint
ManagedPtrNewtype PathPoint Source # |
Instance details Defined in GI.Gsk.Structs.PathPoint Methods toManagedPtr :: PathPoint -> ManagedPtr PathPoint Source #
TypedObject PathPoint Source # |
Instance details Defined in GI.Gsk.Structs.PathPoint Methods glibType :: IO GType Source #
HasParentTypes PathPoint Source # |
Instance details Defined in GI.Gsk.Structs.PathPoint
IsGValue (Maybe PathPoint) Source # | Convert `PathPoint` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gsk.Structs.PathPoint Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe PathPoint -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe PathPoint) Source #
type ParentTypes PathPoint Source # |
Instance details Defined in GI.Gsk.Structs.PathPoint type ParentTypes PathPoint = '[] :: [Type]

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

compare, copy, equal, free.

#### Getters

getCurvature, getDistance, getPosition, getRotation, getTangent.

#### Setters

None.

## compare

pathPointCompare Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PathPoint | `point1`: a path point
-> PathPoint | `point2`: another path point
-> m Int32 | Returns: -1 if `point1` is before `point2`, 1 if `point1` is after `point2`, 0 if they are equal

Returns whether `point1` is before or after `point2`.

Since: 4.14

## copy

pathPointCopy Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PathPoint | `point`: a path point
-> m PathPoint | Returns: the copied point

Copies a path point.

Since: 4.14

## equal

pathPointEqual Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PathPoint | `point1`: a path point
-> PathPoint | `point2`: another path point
-> m Bool | Returns: true if `point1` and `point2` are 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 `pathIsClosed` to find out if the start- and endpoint of a concrete path refer to the same location.

Since: 4.14

## free

pathPointFree Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PathPoint | `point`: a path point
-> m () |

Frees a path point copied by `pathPointCopy`.

Since: 4.14

## getCurvature

pathPointGetCurvature Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PathPoint | `point`: a path point
-> Path | `path`: the path that `point` is on
-> PathDirection | `direction`: the direction for which to return the curvature
-> m (Float, Maybe Point) | Returns: the curvature of the path at the given point

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>

Since: 4.14

## getDistance

pathPointGetDistance Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PathPoint | `point`: a point on the path
-> PathMeasure | `measure`: a path measure for the path
-> m Float | Returns: the distance of `point`

Returns the distance from the beginning of the path to the point.

Since: 4.14

## getPosition

pathPointGetPosition Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PathPoint | `point`: a path point
-> Path | `path`: the path that `point` is on
-> m Point |

Gets the position of the point.

Since: 4.14

## getRotation

pathPointGetRotation Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PathPoint | `point`: a path point
-> Path | `path`: the path that `point` is on
-> PathDirection | `direction`: the direction for which to return the rotation
-> m Float | Returns: the angle between the tangent and the X axis, in degrees

Gets the direction of the tangent at a given point.

This is a convenience variant of `pathPointGetTangent` that returns the angle between the tangent and the X axis. The angle can e.g. be used in gtk_snapshot_rotate().

Since: 4.14

## getTangent

pathPointGetTangent Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PathPoint | `point`: a path point
-> Path | `path`: the path that `point` is on
-> PathDirection | `direction`: the direction for which to return the tangent
-> m 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, `pathPointGetRotation` may be more convenient to use.

Since: 4.14