gi-pango-1.0.25: Pango bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Pango.Structs.Matrix

Description

A PangoMatrix specifies a transformation between user-space and device coordinates.

The transformation is given by

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

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 #

GBoxed Matrix Source # 
Instance details

Defined in GI.Pango.Structs.Matrix

ManagedPtrNewtype Matrix Source # 
Instance details

Defined in GI.Pango.Structs.Matrix

TypedObject Matrix Source # 
Instance details

Defined in GI.Pango.Structs.Matrix

Methods

glibType :: IO GType #

HasParentTypes Matrix Source # 
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 #

IsGValue (Maybe Matrix) Source #

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

Instance details

Defined in GI.Pango.Structs.Matrix

type ParentTypes Matrix Source # 
Instance details

Defined in GI.Pango.Structs.Matrix

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

newZeroMatrix :: MonadIO m => m Matrix Source #

Construct a Matrix struct initialized to zero.

Methods

Click to display all available methods, including inherited ones

Expand

Methods

concat, copy, free, rotate, scale, transformDistance, transformPixelRectangle, transformPoint, translate.

Getters

getFontScaleFactor, getFontScaleFactors.

Setters

None.

concat

matrixConcat Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Matrix

matrix: a PangoMatrix

-> Matrix

newMatrix: a PangoMatrix

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

-> m (Maybe Matrix)

Returns: the newly allocated PangoMatrix

Copies a PangoMatrix.

Since: 1.6

free

matrixFree Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Matrix

matrix: a PangoMatrix, may be Nothing

-> m () 

Free a PangoMatrix.

Since: 1.6

getFontScaleFactor

matrixGetFontScaleFactor Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Matrix

matrix: a PangoMatrix, 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 PangoMatrix

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

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

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

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

dx2 = dx1 * xx + dy1 * xy;
dy2 = dx1 * yx + dy1 * yy;

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 PangoMatrix

-> Maybe Rectangle

rect: in/out bounding box in device units

-> m () 

First transforms the rect using matrix, then calculates the bounding box of the transformed rectangle.

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 [funcextentsToPixels]'s first argument.

Since: 1.16

transformPoint

matrixTransformPoint Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Matrix

matrix: a PangoMatrix

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

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