| Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.Gsk.Structs.Transform
Description
The GskTransform structure contains only private data.
Synopsis
- newtype Transform = Transform (ManagedPtr Transform)
- noTransform :: Maybe Transform
- transformEqual :: (HasCallStack, MonadIO m) => Transform -> Transform -> m Bool
- transformGetCategory :: (HasCallStack, MonadIO m) => Transform -> m TransformCategory
- transformInvert :: (HasCallStack, MonadIO m) => Transform -> m Transform
- transformMatrix :: (HasCallStack, MonadIO m) => Transform -> Matrix -> m Transform
- transformNew :: (HasCallStack, MonadIO m) => m Transform
- transformNodeGetChild :: (HasCallStack, MonadIO m) => RenderNode -> m RenderNode
- transformNodeGetTransform :: (HasCallStack, MonadIO m) => RenderNode -> m Transform
- transformNodeNew :: (HasCallStack, MonadIO m) => RenderNode -> Transform -> m RenderNode
- transformParse :: (HasCallStack, MonadIO m) => Text -> m (Bool, Transform)
- transformPerspective :: (HasCallStack, MonadIO m) => Transform -> Float -> m Transform
- transformPrint :: (HasCallStack, MonadIO m) => Transform -> String -> m ()
- transformRef :: (HasCallStack, MonadIO m) => Transform -> m Transform
- transformRotate :: (HasCallStack, MonadIO m) => Transform -> Float -> m Transform
- transformRotate3d :: (HasCallStack, MonadIO m) => Transform -> Float -> Vec3 -> m Transform
- transformScale :: (HasCallStack, MonadIO m) => Transform -> Float -> Float -> m Transform
- transformScale3d :: (HasCallStack, MonadIO m) => Transform -> Float -> Float -> Float -> m Transform
- transformTo2d :: (HasCallStack, MonadIO m) => Transform -> m (Float, Float, Float, Float, Float, Float)
- transformToAffine :: (HasCallStack, MonadIO m) => Transform -> m (Float, Float, Float, Float)
- transformToMatrix :: (HasCallStack, MonadIO m) => Transform -> m Matrix
- transformToString :: (HasCallStack, MonadIO m) => Transform -> m Text
- transformToTranslate :: (HasCallStack, MonadIO m) => Transform -> m (Float, Float)
- transformTransform :: (HasCallStack, MonadIO m) => Transform -> Maybe Transform -> m Transform
- transformTransformBounds :: (HasCallStack, MonadIO m) => Transform -> Rect -> m Rect
- transformTranslate :: (HasCallStack, MonadIO m) => Transform -> Point -> m Transform
- transformTranslate3d :: (HasCallStack, MonadIO m) => Transform -> Point3D -> m Transform
- transformUnref :: (HasCallStack, MonadIO m) => Transform -> m ()
Exported types
Memory-managed wrapper type.
Constructors
| Transform (ManagedPtr Transform) |
Methods
Overloaded methods
equal
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Transform |
|
| -> Transform |
|
| -> m Bool | Returns: |
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
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Transform |
|
| -> m TransformCategory | Returns: The category of the transform |
Returns the category this transform belongs to.
invert
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Transform |
|
| -> m Transform | Returns: The inverted transform or |
matrix
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Transform |
|
| -> Matrix |
|
| -> 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 |
|
| -> 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
Arguments
| :: (HasCallStack, MonadIO m) | |
| => RenderNode |
|
| -> Transform |
|
| -> m RenderNode | Returns: A new |
Creates a RenderNode that will transform the given child
with the given transform.
parse
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Text |
|
| -> m (Bool, Transform) | Returns: |
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
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Transform |
|
| -> Float |
|
| -> 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.
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Transform |
|
| -> String |
|
| -> m () |
Converts self into a human-readable string representation suitable
for printing that can later be parsed with transformParse.
ref
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Transform |
|
| -> m Transform | Returns: the |
Acquires a reference on the given Transform.
rotate
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Transform |
|
| -> Float |
|
| -> m Transform | Returns: The new matrix |
Rotates next angle degrees in 2D - or in 3Dspeak, around the z axis.
rotate3d
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Transform |
|
| -> Float |
|
| -> Vec3 |
|
| -> m Transform | Returns: The new matrix |
Rotates next angle degrees around axis.
For a rotation in 2D space, use transformRotate.
scale
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Transform |
|
| -> Float |
|
| -> Float |
|
| -> 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
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Transform |
|
| -> Float |
|
| -> Float |
|
| -> Float |
|
| -> m Transform | Returns: The new matrix |
Scales next by the given factors.
to2d
Arguments
| :: (HasCallStack, MonadIO m) | |
| => 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
Arguments
| :: (HasCallStack, MonadIO m) | |
| => 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
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Transform |
|
| -> m Matrix |
Computes the actual value of self and stores it in outMatrix.
The previous value of outMatrix will be ignored.
toString
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Transform |
|
| -> m Text | Returns: A new string for |
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
Converts a Transform to a translation operation.
self must be a 2D transformation. If you are not
sure, use transformGetCategory >=
TransformCategory2dTranslate to check.
transform
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Transform |
|
| -> Maybe Transform |
|
| -> m Transform | Returns: The new matrix |
Applies all the operations from other to next.
transformBounds
transformTransformBounds Source #
Transforms a Rect using the given matrix m. The
result is the bounding box containing the coplanar quad.
translate
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Transform |
|
| -> Point |
|
| -> m Transform | Returns: The new matrix |
Translates next in 2dimensional space by point.
translate3d
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Transform |
|
| -> Point3D |
|
| -> m Transform | Returns: The new matrix |
Translates next by point.
unref
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Transform |
|
| -> m () |
Releases a reference on the given Transform.
If the reference was the last, the resources associated to the self are
freed.