gi-pango-1.0.11: Pango bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Pango.Structs.Matrix

Contents

Description

A structure specifying a transformation between user-space coordinates and device coordinates. The transformation is given by

<programlisting> x_device = x_user * matrix->xx + y_user * matrix->xy + matrix->x0; y_device = x_user * matrix->yx + y_user * matrix->yy + matrix->y0; </programlisting>

Synopsis

Exported types

newtype Matrix Source #

Constructors

Matrix (ManagedPtr Matrix) 

Instances

BoxedObject Matrix Source # 

Methods

boxedType :: Matrix -> IO GType #

(~) AttrOpTag tag AttrSet => Constructible Matrix tag Source # 

Methods

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

((~) * info (ResolveMatrixMethod t Matrix), MethodInfo * info Matrix p) => IsLabel t (Matrix -> p) Source # 

Methods

fromLabel :: Proxy# Symbol t -> Matrix -> p #

((~) * info (ResolveMatrixMethod t Matrix), MethodInfo * info Matrix p) => IsLabelProxy t (Matrix -> p) Source # 

Methods

fromLabelProxy :: Proxy Symbol t -> Matrix -> p #

HasAttributeList * Matrix Source # 
((~) * signature (Double -> Double -> m ()), MonadIO m) => MethodInfo * MatrixTranslateMethodInfo Matrix signature Source # 
((~) * signature (Double -> Double -> m (Double, Double)), MonadIO m) => MethodInfo * MatrixTransformPointMethodInfo Matrix signature Source # 
((~) * signature (Maybe Rectangle -> m ()), MonadIO m) => MethodInfo * MatrixTransformPixelRectangleMethodInfo Matrix signature Source # 
((~) * signature (Double -> Double -> m (Double, Double)), MonadIO m) => MethodInfo * MatrixTransformDistanceMethodInfo Matrix signature Source # 
((~) * signature (Double -> Double -> m ()), MonadIO m) => MethodInfo * MatrixScaleMethodInfo Matrix signature Source # 
((~) * signature (Double -> m ()), MonadIO m) => MethodInfo * MatrixRotateMethodInfo Matrix signature Source # 
((~) * signature (m (Double, Double)), MonadIO m) => MethodInfo * MatrixGetFontScaleFactorsMethodInfo Matrix signature Source # 
((~) * signature (m Double), MonadIO m) => MethodInfo * MatrixGetFontScaleFactorMethodInfo Matrix signature Source # 
((~) * signature (m ()), MonadIO m) => MethodInfo * MatrixFreeMethodInfo Matrix signature Source # 
((~) * signature (m (Maybe Matrix)), MonadIO m) => MethodInfo * MatrixCopyMethodInfo Matrix signature Source # 
((~) * signature (Matrix -> m ()), MonadIO m) => MethodInfo * MatrixConcatMethodInfo Matrix signature Source # 
type AttributeList Matrix Source # 

newZeroMatrix :: MonadIO m => m Matrix Source #

Construct a Matrix struct initialized to zero.

Methods

concat

data MatrixConcatMethodInfo Source #

Instances

((~) * signature (Matrix -> m ()), MonadIO m) => MethodInfo * MatrixConcatMethodInfo Matrix signature Source # 

matrixConcat Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Matrix

matrix: a Matrix

-> Matrix

newMatrix: a Matrix

-> m () 

Changes the transformation represented by matrix to be the transformation given by first applying transformation given by newMatrix then applying the original transformation.

Since: 1.6

copy

data MatrixCopyMethodInfo Source #

Instances

((~) * signature (m (Maybe Matrix)), MonadIO m) => MethodInfo * MatrixCopyMethodInfo Matrix signature Source # 

matrixCopy Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Matrix

matrix: a Matrix, may be Nothing

-> m (Maybe Matrix)

Returns: the newly allocated Matrix, which should be freed with matrixFree, or Nothing if matrix was Nothing.

Copies a Matrix.

Since: 1.6

free

data MatrixFreeMethodInfo Source #

Instances

((~) * signature (m ()), MonadIO m) => MethodInfo * MatrixFreeMethodInfo Matrix signature Source # 

matrixFree Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Matrix

matrix: a Matrix, may be Nothing

-> m () 

Free a Matrix created with matrixCopy.

Since: 1.6

getFontScaleFactor

matrixGetFontScaleFactor Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Matrix

matrix: a Matrix, may be Nothing

-> m Double

Returns: the scale factor of matrix on the height of the font, or 1.0 if matrix is Nothing.

Returns the scale factor of a matrix on the height of the font. That is, the scale factor in the direction perpendicular to the vector that the X coordinate is mapped to. If the scale in the X coordinate is needed as well, use matrixGetFontScaleFactors.

Since: 1.12

getFontScaleFactors

matrixGetFontScaleFactors Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Matrix

matrix: a Matrix, or Nothing

-> m (Double, Double) 

Calculates the scale factor of a matrix on the width and height of the font. That is, xscale is the scale factor in the direction of the X coordinate, and yscale is the scale factor in the direction perpendicular to the vector that the X coordinate is mapped to.

Note that output numbers will always be non-negative.

Since: 1.38

rotate

data MatrixRotateMethodInfo Source #

Instances

((~) * signature (Double -> m ()), MonadIO m) => MethodInfo * MatrixRotateMethodInfo Matrix signature Source # 

matrixRotate Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Matrix

matrix: a Matrix

-> Double

degrees: degrees to rotate counter-clockwise

-> m () 

Changes the transformation represented by matrix to be the transformation given by first rotating by degrees degrees counter-clockwise then applying the original transformation.

Since: 1.6

scale

data MatrixScaleMethodInfo Source #

Instances

((~) * signature (Double -> Double -> m ()), MonadIO m) => MethodInfo * MatrixScaleMethodInfo Matrix signature Source # 

matrixScale Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Matrix

matrix: a Matrix

-> Double

scaleX: amount to scale by in X direction

-> Double

scaleY: amount to scale by in Y direction

-> m () 

Changes the transformation represented by matrix to be the transformation given by first scaling by sx in the X direction and sy in the Y direction then applying the original transformation.

Since: 1.6

transformDistance

matrixTransformDistance Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Matrix

matrix: a Matrix, or Nothing

-> Double

dx: in/out X component of a distance vector

-> Double

dy: in/out Y component of a distance vector

-> m (Double, Double) 

Transforms the distance vector (dx,dy) by matrix. This is similar to matrixTransformPoint except that the translation components of the transformation are ignored. The calculation of the returned vector is as follows:

<programlisting> dx2 = dx1 * xx + dy1 * xy; dy2 = dx1 * yx + dy1 * yy; </programlisting>

Affine transformations are position invariant, so the same vector always transforms to the same vector. If (x1,y1) transforms to (x2,y2) then (x1+dx1,y1+dy1) will transform to (x1+dx2,y1+dy2) for all values of x1 and x2.

Since: 1.16

transformPixelRectangle

matrixTransformPixelRectangle Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Matrix

matrix: a Matrix, or Nothing

-> Maybe Rectangle

rect: in/out bounding box in device units, or Nothing

-> m () 

First transforms the rect using matrix, then calculates the bounding box of the transformed rectangle. The rectangle should be in device units (pixels).

This function is useful for example when you want to draw a rotated pangoLayout to an image buffer, and want to know how large the image should be and how much you should shift the layout when rendering.

For better accuracy, you should use matrixTransformRectangle on original rectangle in Pango units and convert to pixels afterward using 'GI.Pango.Functions.extentsToPixels'\'s first argument.

Since: 1.16

transformPoint

matrixTransformPoint Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Matrix

matrix: a Matrix, or Nothing

-> Double

x: in/out X position

-> Double

y: in/out Y position

-> m (Double, Double) 

Transforms the point (x, y) by matrix.

Since: 1.16

translate

matrixTranslate Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Matrix

matrix: a Matrix

-> Double

tx: amount to translate in the X direction

-> Double

ty: amount to translate in the Y direction

-> m () 

Changes the transformation represented by matrix to be the transformation given by first translating by (tx, ty) then applying the original transformation.

Since: 1.6

Properties

x0

xx

xy

y0

yx

yy