Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- newtype Matrix = Matrix (ManagedPtr Matrix)
- newZeroMatrix :: MonadIO m => m Matrix
- matrixConcat :: (HasCallStack, MonadIO m) => Matrix -> Matrix -> m ()
- matrixCopy :: (HasCallStack, MonadIO m) => Matrix -> m (Maybe Matrix)
- matrixFree :: (HasCallStack, MonadIO m) => Matrix -> m ()
- matrixGetFontScaleFactor :: (HasCallStack, MonadIO m) => Matrix -> m Double
- matrixGetFontScaleFactors :: (HasCallStack, MonadIO m) => Matrix -> m (Double, Double)
- matrixRotate :: (HasCallStack, MonadIO m) => Matrix -> Double -> m ()
- matrixScale :: (HasCallStack, MonadIO m) => Matrix -> Double -> Double -> m ()
- matrixTransformDistance :: (HasCallStack, MonadIO m) => Matrix -> Double -> Double -> m (Double, Double)
- matrixTransformPixelRectangle :: (HasCallStack, MonadIO m) => Matrix -> Maybe Rectangle -> m ()
- matrixTransformPoint :: (HasCallStack, MonadIO m) => Matrix -> Double -> Double -> m (Double, Double)
- matrixTranslate :: (HasCallStack, MonadIO m) => Matrix -> Double -> Double -> m ()
- getMatrixX0 :: MonadIO m => Matrix -> m Double
- setMatrixX0 :: MonadIO m => Matrix -> Double -> m ()
- getMatrixXx :: MonadIO m => Matrix -> m Double
- setMatrixXx :: MonadIO m => Matrix -> Double -> m ()
- getMatrixXy :: MonadIO m => Matrix -> m Double
- setMatrixXy :: MonadIO m => Matrix -> Double -> m ()
- getMatrixY0 :: MonadIO m => Matrix -> m Double
- setMatrixY0 :: MonadIO m => Matrix -> Double -> m ()
- getMatrixYx :: MonadIO m => Matrix -> m Double
- setMatrixYx :: MonadIO m => Matrix -> Double -> m ()
- getMatrixYy :: MonadIO m => Matrix -> m Double
- setMatrixYy :: MonadIO m => Matrix -> Double -> m ()
Exported types
Memory-managed wrapper type.
Instances
Eq Matrix Source # | |
GBoxed Matrix Source # | |
Defined in GI.Pango.Structs.Matrix | |
ManagedPtrNewtype Matrix Source # | |
Defined in GI.Pango.Structs.Matrix toManagedPtr :: Matrix -> ManagedPtr Matrix # | |
TypedObject Matrix Source # | |
Defined in GI.Pango.Structs.Matrix | |
HasParentTypes Matrix Source # | |
Defined in GI.Pango.Structs.Matrix | |
tag ~ 'AttrSet => Constructible Matrix tag Source # | |
Defined in GI.Pango.Structs.Matrix | |
IsGValue (Maybe Matrix) Source # | Convert |
Defined in GI.Pango.Structs.Matrix | |
type ParentTypes Matrix Source # | |
Defined in GI.Pango.Structs.Matrix |
Methods
Click to display all available methods, including inherited ones
Methods
concat, copy, free, rotate, scale, transformDistance, transformPixelRectangle, transformPoint, translate.
Getters
getFontScaleFactor, getFontScaleFactors.
Setters
None.
concat
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> 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
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m (Maybe Matrix) | Returns: the newly allocated |
Copies a PangoMatrix
.
Since: 1.6
free
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m () |
Free a PangoMatrix
.
Since: 1.6
getFontScaleFactor
matrixGetFontScaleFactor Source #
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m Double | Returns: the scale factor of |
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 #
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> 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
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Double |
|
-> 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
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Double |
|
-> Double |
|
-> 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 #
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Double |
|
-> Double |
|
-> 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 #
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Maybe Rectangle |
|
-> 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
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Double |
|
-> Double |
|
-> m (Double, Double) |
Transforms the point (x
, y
) by matrix
.
Since: 1.16
translate
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Double |
|
-> Double |
|
-> 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 ]