gi-graphene-1.0.5: Graphene bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Graphene.Structs.Point

Description

A point with two coordinates.

Since: 1.0

Synopsis

Exported types

newtype Point Source #

Memory-managed wrapper type.

Constructors

Point (ManagedPtr Point) 

Instances

Instances details
Eq Point Source # 
Instance details

Defined in GI.Graphene.Structs.Point

Methods

(==) :: Point -> Point -> Bool #

(/=) :: Point -> Point -> Bool #

GBoxed Point Source # 
Instance details

Defined in GI.Graphene.Structs.Point

ManagedPtrNewtype Point Source # 
Instance details

Defined in GI.Graphene.Structs.Point

Methods

toManagedPtr :: Point -> ManagedPtr Point

TypedObject Point Source # 
Instance details

Defined in GI.Graphene.Structs.Point

Methods

glibType :: IO GType

HasParentTypes Point Source # 
Instance details

Defined in GI.Graphene.Structs.Point

tag ~ 'AttrSet => Constructible Point tag Source # 
Instance details

Defined in GI.Graphene.Structs.Point

Methods

new :: MonadIO m => (ManagedPtr Point -> Point) -> [AttrOp Point tag] -> m Point

IsGValue (Maybe Point) Source #

Convert Point to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Graphene.Structs.Point

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe Point -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe Point)

type ParentTypes Point Source # 
Instance details

Defined in GI.Graphene.Structs.Point

type ParentTypes Point = '[] :: [Type]

newZeroPoint :: MonadIO m => m Point Source #

Construct a Point struct initialized to zero.

Methods

Click to display all available methods, including inherited ones

Expand

Methods

distance, equal, free, init, initFromPoint, initFromVec2, interpolate, near, toVec2.

Getters

None.

Setters

None.

alloc

pointAlloc Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Point

Returns: the newly allocated Point. Use pointFree to free the resources allocated by this function.

Allocates a new Point structure.

The coordinates of the returned point are (0, 0).

It's possible to chain this function with pointInit or pointInitFromPoint, e.g.:

C code

 graphene_point_t *
 point_new (float x, float y)
 {
   return graphene_point_init (graphene_point_alloc (), x, y);
 }

 graphene_point_t *
 point_copy (const graphene_point_t *p)
 {
   return graphene_point_init_from_point (graphene_point_alloc (), p);
 }

Since: 1.0

distance

pointDistance Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Point

a: a Point

-> Point

b: a Point

-> m (Float, Float, Float)

Returns: the distance between the two points

Computes the distance between a and b.

Since: 1.0

equal

pointEqual Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Point

a: a Point

-> Point

b: a Point

-> m Bool

Returns: true if the points have the same coordinates

Checks if the two points a and b point to the same coordinates.

This function accounts for floating point fluctuations; if you want to control the fuzziness of the match, you can use pointNear instead.

Since: 1.0

free

pointFree Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Point

p: a Point

-> m () 

Frees the resources allocated by pointAlloc.

Since: 1.0

init

pointInit Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Point

p: a Point

-> Float

x: the X coordinate

-> Float

y: the Y coordinate

-> m Point

Returns: the initialized point

Initializes p to the given x and y coordinates.

It's safe to call this function multiple times.

Since: 1.0

initFromPoint

pointInitFromPoint Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Point

p: a Point

-> Point

src: the Point to use

-> m Point

Returns: the initialized point

Initializes p with the same coordinates of src.

Since: 1.0

initFromVec2

pointInitFromVec2 Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Point

p: the Point to initialize

-> Vec2

src: a Vec2

-> m Point

Returns: the initialized point

Initializes p with the coordinates inside the given Vec2.

Since: 1.4

interpolate

pointInterpolate Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Point

a: a Point

-> Point

b: a Point

-> Double

factor: the linear interpolation factor

-> m Point 

Linearly interpolates the coordinates of a and b using the given factor.

Since: 1.0

near

pointNear Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Point

a: a Point

-> Point

b: a Point

-> Float

epsilon: threshold between the two points

-> m Bool

Returns: true if the distance is within epsilon

Checks whether the two points a and b are within the threshold of epsilon.

Since: 1.0

toVec2

pointToVec2 Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Point

p: a Point

-> m Vec2 

Stores the coordinates of the given Point into a Vec2.

Since: 1.4

zero

pointZero Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Point

Returns: a fixed point

Returns a point fixed at (0, 0).

Since: 1.0

Properties

x

the X coordinate of the point

getPointX :: MonadIO m => Point -> m Float Source #

Get the value of the “x” field. When overloading is enabled, this is equivalent to

get point #x

setPointX :: MonadIO m => Point -> Float -> m () Source #

Set the value of the “x” field. When overloading is enabled, this is equivalent to

set point [ #x := value ]

y

the Y coordinate of the point

getPointY :: MonadIO m => Point -> m Float Source #

Get the value of the “y” field. When overloading is enabled, this is equivalent to

get point #y

setPointY :: MonadIO m => Point -> Float -> m () Source #

Set the value of the “y” field. When overloading is enabled, this is equivalent to

set point [ #y := value ]