| 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 | 
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
- newtype Matrix = Matrix (ManagedPtr Matrix)
 - newZeroMatrix :: MonadIO m => m Matrix
 - matrixConcat :: (HasCallStack, MonadIO m) => Matrix -> Matrix -> m ()
 - matrixCopy :: (HasCallStack, MonadIO m) => Maybe Matrix -> m (Maybe Matrix)
 - matrixFree :: (HasCallStack, MonadIO m) => Maybe Matrix -> m ()
 - matrixGetFontScaleFactor :: (HasCallStack, MonadIO m) => Maybe Matrix -> m Double
 - matrixGetFontScaleFactors :: (HasCallStack, MonadIO m) => Maybe Matrix -> m (Double, Double)
 - matrixGetSlantRatio :: (HasCallStack, MonadIO m) => Matrix -> m Double
 - matrixRotate :: (HasCallStack, MonadIO m) => Matrix -> Double -> m ()
 - matrixScale :: (HasCallStack, MonadIO m) => Matrix -> Double -> Double -> m ()
 - matrixTransformDistance :: (HasCallStack, MonadIO m) => Maybe Matrix -> Double -> Double -> m (Double, Double)
 - matrixTransformPixelRectangle :: (HasCallStack, MonadIO m) => Maybe Matrix -> Maybe Rectangle -> m ()
 - matrixTransformPoint :: (HasCallStack, MonadIO m) => Maybe 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 Methods 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 # | |
| IsGValue (Maybe Matrix) Source # | Convert   | 
Defined in GI.Pango.Structs.Matrix Methods gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Matrix -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe 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, getSlantRatio.
Setters
None.
concat
Arguments
| :: (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
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Maybe Matrix | 
  | 
| -> m (Maybe Matrix) | Returns: the newly allocated   | 
Copies a PangoMatrix.
Since: 1.6
free
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Maybe Matrix | 
  | 
| -> m () | 
Free a PangoMatrix.
Since: 1.6
getFontScaleFactor
matrixGetFontScaleFactor Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Maybe 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 #
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
getSlantRatio
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Matrix | 
  | 
| -> m Double | Returns: the slant ratio of   | 
Gets the slant ratio of a matrix.
For a simple shear matrix in the form:
1 λ 0 1
this is simply λ.
Since: 1.50
rotate
Arguments
| :: (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
Arguments
| :: (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 #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Maybe 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 #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Maybe 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
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Maybe Matrix | 
  | 
| -> Double | 
  | 
| -> Double | 
  | 
| -> m (Double, Double) | 
Transforms the point (x, y) by matrix.
Since: 1.16
translate
Arguments
| :: (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
setmatrix [ #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
setmatrix [ #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
setmatrix [ #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
setmatrix [ #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
setmatrix [ #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
setmatrix [ #yy:=value ]