gi-pango-1.0.22: Pango bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Pango.Structs.Matrix

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>

Since: 1.6

Synopsis

Exported types

newtype Matrix Source #

Memory-managed wrapper type.

Constructors

Matrix (ManagedPtr Matrix) 

Instances

Instances details
Eq Matrix Source # 
Instance details

Defined in GI.Pango.Structs.Matrix

Methods

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

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

BoxedObject Matrix Source # 
Instance details

Defined in GI.Pango.Structs.Matrix

Methods

boxedType :: Matrix -> IO GType #

IsGValue Matrix Source #

Convert Matrix to and from GValue with toGValue and fromGValue.

Instance details

Defined in GI.Pango.Structs.Matrix

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

Defined in GI.Pango.Structs.Matrix

Methods

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

newZeroMatrix :: MonadIO m => m Matrix Source #

Construct a Matrix struct initialized to zero.

noMatrix :: Maybe Matrix Source #

A convenience alias for Nothing :: Maybe Matrix.

Methods

Overloaded methods

concat

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

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

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

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

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 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

x translation

getMatrixX0 :: MonadIO m => Matrix -> m Double Source #

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

get matrix #x0

setMatrixX0 :: MonadIO m => Matrix -> Double -> m () Source #

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

set matrix [ #x0 := value ]

xx

1st component of the transformation matrix

getMatrixXx :: MonadIO m => Matrix -> m Double Source #

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

get matrix #xx

setMatrixXx :: MonadIO m => Matrix -> Double -> m () Source #

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

set matrix [ #xx := value ]

xy

2nd component of the transformation matrix

getMatrixXy :: MonadIO m => Matrix -> m Double Source #

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

get matrix #xy

setMatrixXy :: MonadIO m => Matrix -> Double -> m () Source #

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

set matrix [ #xy := value ]

y0

y translation

getMatrixY0 :: MonadIO m => Matrix -> m Double Source #

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

get matrix #y0

setMatrixY0 :: MonadIO m => Matrix -> Double -> m () Source #

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

set matrix [ #y0 := value ]

yx

3rd component of the transformation matrix

getMatrixYx :: MonadIO m => Matrix -> m Double Source #

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

get matrix #yx

setMatrixYx :: MonadIO m => Matrix -> Double -> m () Source #

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

set matrix [ #yx := value ]

yy

4th component of the transformation matrix

getMatrixYy :: MonadIO m => Matrix -> m Double Source #

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

get matrix #yy

setMatrixYy :: MonadIO m => Matrix -> Double -> m () Source #

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

set matrix [ #yy := value ]