Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
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>
- newtype Matrix = Matrix (ManagedPtr Matrix)
- newZeroMatrix :: MonadIO m => m Matrix
- noMatrix :: Maybe Matrix
- data MatrixConcatMethodInfo
- matrixConcat :: (HasCallStack, MonadIO m) => Matrix -> Matrix -> m ()
- data MatrixCopyMethodInfo
- matrixCopy :: (HasCallStack, MonadIO m) => Matrix -> m (Maybe Matrix)
- data MatrixFreeMethodInfo
- matrixFree :: (HasCallStack, MonadIO m) => Matrix -> m ()
- data MatrixGetFontScaleFactorMethodInfo
- matrixGetFontScaleFactor :: (HasCallStack, MonadIO m) => Matrix -> m Double
- data MatrixGetFontScaleFactorsMethodInfo
- matrixGetFontScaleFactors :: (HasCallStack, MonadIO m) => Matrix -> m (Double, Double)
- data MatrixRotateMethodInfo
- matrixRotate :: (HasCallStack, MonadIO m) => Matrix -> Double -> m ()
- data MatrixScaleMethodInfo
- matrixScale :: (HasCallStack, MonadIO m) => Matrix -> Double -> Double -> m ()
- data MatrixTransformDistanceMethodInfo
- matrixTransformDistance :: (HasCallStack, MonadIO m) => Matrix -> Double -> Double -> m (Double, Double)
- data MatrixTransformPixelRectangleMethodInfo
- matrixTransformPixelRectangle :: (HasCallStack, MonadIO m) => Matrix -> Maybe Rectangle -> m ()
- data MatrixTransformPointMethodInfo
- matrixTransformPoint :: (HasCallStack, MonadIO m) => Matrix -> Double -> Double -> m (Double, Double)
- data MatrixTranslateMethodInfo
- matrixTranslate :: (HasCallStack, MonadIO m) => Matrix -> Double -> Double -> m ()
- getMatrixX0 :: MonadIO m => Matrix -> m Double
- matrix_x0 :: AttrLabelProxy "x0"
- setMatrixX0 :: MonadIO m => Matrix -> Double -> m ()
- getMatrixXx :: MonadIO m => Matrix -> m Double
- matrix_xx :: AttrLabelProxy "xx"
- setMatrixXx :: MonadIO m => Matrix -> Double -> m ()
- getMatrixXy :: MonadIO m => Matrix -> m Double
- matrix_xy :: AttrLabelProxy "xy"
- setMatrixXy :: MonadIO m => Matrix -> Double -> m ()
- getMatrixY0 :: MonadIO m => Matrix -> m Double
- matrix_y0 :: AttrLabelProxy "y0"
- setMatrixY0 :: MonadIO m => Matrix -> Double -> m ()
- getMatrixYx :: MonadIO m => Matrix -> m Double
- matrix_yx :: AttrLabelProxy "yx"
- setMatrixYx :: MonadIO m => Matrix -> Double -> m ()
- getMatrixYy :: MonadIO m => Matrix -> m Double
- matrix_yy :: AttrLabelProxy "yy"
- setMatrixYy :: MonadIO m => Matrix -> Double -> m ()
Exported types
Methods
concat
data MatrixConcatMethodInfo Source #
((~) * signature (Matrix -> m ()), MonadIO m) => MethodInfo * MatrixConcatMethodInfo Matrix signature Source # | |
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 #
((~) * signature (m (Maybe Matrix)), MonadIO m) => MethodInfo * MatrixCopyMethodInfo Matrix signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Matrix | |
-> m (Maybe Matrix) | Returns: the newly allocated |
Copies a Matrix
.
Since: 1.6
free
data MatrixFreeMethodInfo Source #
((~) * signature (m ()), MonadIO m) => MethodInfo * MatrixFreeMethodInfo Matrix signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> Matrix | |
-> m () |
Free a Matrix
created with matrixCopy
.
Since: 1.6
getFontScaleFactor
data MatrixGetFontScaleFactorMethodInfo Source #
((~) * signature (m Double), MonadIO m) => MethodInfo * MatrixGetFontScaleFactorMethodInfo Matrix signature Source # | |
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
data MatrixGetFontScaleFactorsMethodInfo Source #
((~) * signature (m (Double, Double)), MonadIO m) => MethodInfo * MatrixGetFontScaleFactorsMethodInfo Matrix signature Source # | |
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
rotate
data MatrixRotateMethodInfo Source #
((~) * signature (Double -> m ()), MonadIO m) => MethodInfo * MatrixRotateMethodInfo Matrix signature Source # | |
:: (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
data MatrixScaleMethodInfo Source #
((~) * signature (Double -> Double -> m ()), MonadIO m) => MethodInfo * MatrixScaleMethodInfo Matrix signature Source # | |
:: (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:
<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
data MatrixTransformPixelRectangleMethodInfo Source #
((~) * signature (Maybe Rectangle -> m ()), MonadIO m) => MethodInfo * MatrixTransformPixelRectangleMethodInfo Matrix signature Source # | |
matrixTransformPixelRectangle Source #
:: (HasCallStack, MonadIO m) | |
=> Matrix | |
-> Maybe Rectangle |
|
-> 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
:: (HasCallStack, MonadIO m) | |
=> Matrix | |
-> Double |
|
-> Double |
|
-> m (Double, Double) |
Transforms the point (x
, y
) by matrix
.
Since: 1.16
translate
data MatrixTranslateMethodInfo Source #
((~) * signature (Double -> Double -> m ()), MonadIO m) => MethodInfo * MatrixTranslateMethodInfo Matrix signature Source # | |
:: (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
matrix_x0 :: AttrLabelProxy "x0" Source #
xx
matrix_xx :: AttrLabelProxy "xx" Source #
xy
matrix_xy :: AttrLabelProxy "xy" Source #
y0
matrix_y0 :: AttrLabelProxy "y0" Source #
yx
matrix_yx :: AttrLabelProxy "yx" Source #
yy
matrix_yy :: AttrLabelProxy "yy" Source #