gi-gsk-4.0.1: Gsk bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gsk.Structs.Transform

Description

The GskTransform structure contains only private data.

Synopsis

Exported types

newtype Transform Source #

Memory-managed wrapper type.

Instances

Instances details
Eq Transform Source # 
Instance details

Defined in GI.Gsk.Structs.Transform

BoxedObject Transform Source # 
Instance details

Defined in GI.Gsk.Structs.Transform

IsGValue Transform Source #

Convert Transform to and from GValue with toGValue and fromGValue.

Instance details

Defined in GI.Gsk.Structs.Transform

noTransform :: Maybe Transform Source #

A convenience alias for Nothing :: Maybe Transform.

Methods

Overloaded methods

equal

transformEqual Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

first: the first matrix

-> Transform

second: the second matrix

-> m Bool

Returns: True if the two matrices can be proven to be equal

Checks two matrices for equality. Note that matrices need to be literally identical in their operations, it is not enough that they return the same result in transformToMatrix.

getCategory

transformGetCategory Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

self: A Transform

-> m TransformCategory

Returns: The category of the transform

Returns the category this transform belongs to.

invert

transformInvert Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

self: Transform to invert

-> m Transform

Returns: The inverted transform or Nothing if the transform cannot be inverted.

Inverts the given transform.

If self is not invertible, Nothing is returned. Note that inverting Nothing also returns Nothing, which is the correct inverse of Nothing. If you need to differentiate between those cases, you should check self is not Nothing before calling this function.

matrix

transformMatrix Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

next: the next transform

-> Matrix

matrix: the matrix to multiply next with

-> m Transform

Returns: The new matrix

Multiplies next with the given matrix.

new

transformNew :: (HasCallStack, MonadIO m) => m Transform Source #

No description available in the introspection data.

nodeGetChild

transformNodeGetChild Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> RenderNode

node: a transform gskRenderNode

-> m RenderNode

Returns: The child that is getting transformed

Gets the child node that is getting transformed by the given node.

nodeGetTransform

transformNodeGetTransform :: (HasCallStack, MonadIO m) => RenderNode -> m Transform Source #

No description available in the introspection data.

nodeNew

transformNodeNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> RenderNode

child: The node to transform

-> Transform

transform: The transform to apply

-> m RenderNode

Returns: A new RenderNode

Creates a RenderNode that will transform the given child with the given transform.

parse

transformParse Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

string: the string to parse

-> m (Bool, Transform)

Returns: True if string described a valid transform.

Parses the given string into a transform and puts it in outTransform. Strings printed via transformToString can be read in again successfully using this function.

If string does not describe a valid transform, False is returned and Nothing is put in outTransform.

perspective

transformPerspective Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

next: the next transform

-> Float

depth: distance of the z=0 plane. Lower values give a more flattened pyramid and therefore a more pronounced perspective effect.

-> m Transform

Returns: The new matrix

Applies a perspective projection transform. This transform scales points in X and Y based on their Z value, scaling points with positive Z values away from the origin, and those with negative Z values towards the origin. Points on the z=0 plane are unchanged.

print

transformPrint Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

self: a Transform

-> String

string: The string to print into

-> m () 

Converts self into a human-readable string representation suitable for printing that can later be parsed with transformParse.

ref

transformRef Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

self: a Transform

-> m Transform

Returns: the Transform with an additional reference

Acquires a reference on the given Transform.

rotate

transformRotate Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

next: the next transform

-> Float

angle: the rotation angle, in degrees (clockwise)

-> m Transform

Returns: The new matrix

Rotates next angle degrees in 2D - or in 3Dspeak, around the z axis.

rotate3d

transformRotate3d Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

next: the next transform

-> Float

angle: the rotation angle, in degrees (clockwise)

-> Vec3

axis: The rotation axis

-> m Transform

Returns: The new matrix

Rotates next angle degrees around axis.

For a rotation in 2D space, use transformRotate.

scale

transformScale Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

next: the next transform

-> Float

factorX: scaling factor on the X axis

-> Float

factorY: scaling factor on the Y axis

-> m Transform

Returns: The new matrix

Scales next in 2-dimensional space by the given factors. Use transformScale3d to scale in all 3 dimensions.

scale3d

transformScale3d Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

next: the next transform

-> Float

factorX: scaling factor on the X axis

-> Float

factorY: scaling factor on the Y axis

-> Float

factorZ: scaling factor on the Z axis

-> m Transform

Returns: The new matrix

Scales next by the given factors.

to2d

transformTo2d Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

self: a 2D Transform

-> m (Float, Float, Float, Float, Float, Float) 

Converts a Transform to a 2D transformation matrix. self must be a 2D transformation. If you are not sure, use transformGetCategory >= TransformCategory2d to check.

The returned values have the following layout:

plain code

 | xx yx |   |  a  b  0 |
 | xy yy | = |  c  d  0 |
 | x0 y0 |   | tx ty  1 |

This function can be used to convert between a Transform and a matrix type from other 2D drawing libraries, in particular Cairo.

toAffine

transformToAffine Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

self: a Transform

-> m (Float, Float, Float, Float) 

Converts a Transform to 2D affine transformation factors. self must be a 2D transformation. If you are not sure, use transformGetCategory >= TransformCategory2dAffine to check.

toMatrix

transformToMatrix Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

self: a Transform

-> m Matrix 

Computes the actual value of self and stores it in outMatrix. The previous value of outMatrix will be ignored.

toString

transformToString Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

self: a Transform

-> m Text

Returns: A new string for self

Converts a matrix into a string that is suitable for printing and can later be parsed with transformParse.

This is a wrapper around transformPrint, see that function for details.

toTranslate

transformToTranslate Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

self: a Transform

-> m (Float, Float) 

Converts a Transform to a translation operation. self must be a 2D transformation. If you are not sure, use transformGetCategory >= TransformCategory2dTranslate to check.

transform

transformTransform Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

next: Transform to apply other to

-> Maybe Transform

other: Transform to apply

-> m Transform

Returns: The new matrix

Applies all the operations from other to next.

transformBounds

transformTransformBounds Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

self: a Transform

-> Rect

rect: a Rect

-> m Rect 

Transforms a Rect using the given matrix m. The result is the bounding box containing the coplanar quad.

translate

transformTranslate Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

next: the next transform

-> Point

point: the point to translate the matrix by

-> m Transform

Returns: The new matrix

Translates next in 2dimensional space by point.

translate3d

transformTranslate3d Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

next: the next transform

-> Point3D

point: the point to translate the matrix by

-> m Transform

Returns: The new matrix

Translates next by point.

unref

transformUnref Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Transform

self: a Transform

-> m () 

Releases a reference on the given Transform.

If the reference was the last, the resources associated to the self are freed.