cairo-0.13.10.0: Binding to the Cairo library.

Copyright | (c) Paolo Martini 2005
License | BSD-style (see cairo/COPYRIGHT)
Maintainer | p.martini@neuralnoise.com
Stability | experimental
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell98

Graphics.Rendering.Cairo.Matrix

Description

Matrix math

Synopsis

- data Matrix = Matrix !Double !Double !Double !Double !Double !Double
- type MatrixPtr = Ptr Matrix
- identity :: Matrix
- translate :: Double -> Double -> Matrix -> Matrix
- scale :: Double -> Double -> Matrix -> Matrix
- rotate :: Double -> Matrix -> Matrix
- transformDistance :: Matrix -> (Double, Double) -> (Double, Double)
- transformPoint :: Matrix -> (Double, Double) -> (Double, Double)
- scalarMultiply :: Double -> Matrix -> Matrix
- adjoint :: Matrix -> Matrix
- invert :: Matrix -> Matrix

# Documentation

data Matrix Source #

Representation of a 2-D affine transformation.

The Matrix type represents a 2x2 transformation matrix along with a translation vector. `Matrix a1 a2 b1 b2 c1 c2` describes the transformation of a point with coordinates x,y that is defined by

      / x' \  =  / a1 b1 \  / x \  + / c1 \
      \ y' /     \ a2 b2 /  \ y /    \ c2 /

or

      x' =  a1 * x + b1 * y + c1
      y' =  a2 * x + b2 * y + c2

Constructors

Matrix !Double !Double !Double !Double !Double !Double |

#### Instances

Instances details

Storable Matrix Source # |

Instance details

Defined in Graphics.Rendering.Cairo.Matrix

Methods

sizeOf :: Matrix -> Int Source #

alignment :: Matrix -> Int Source #

peekElemOff :: Ptr Matrix -> Int -> IO Matrix Source #

pokeElemOff :: Ptr Matrix -> Int -> Matrix -> IO () Source #

peekByteOff :: Ptr b -> Int -> IO Matrix Source #

pokeByteOff :: Ptr b -> Int -> Matrix -> IO () Source #

peek :: Ptr Matrix -> IO Matrix Source #

poke :: Ptr Matrix -> Matrix -> IO () Source #

Num Matrix Source # |
Instance details Defined in Graphics.Rendering.Cairo.Matrix Methods (+) :: Matrix -> Matrix -> Matrix Source # (-) :: Matrix -> Matrix -> Matrix Source # (*) :: Matrix -> Matrix -> Matrix Source # negate :: Matrix -> Matrix Source # abs :: Matrix -> Matrix Source # signum :: Matrix -> Matrix Source # fromInteger :: Integer -> Matrix Source #
Show Matrix Source # |
Instance details Defined in Graphics.Rendering.Cairo.Matrix Methods showsPrec :: Int -> Matrix -> ShowS Source # show :: Matrix -> String Source # showList :: [Matrix] -> ShowS Source #
Eq Matrix Source # |
Instance details Defined in Graphics.Rendering.Cairo.Matrix Methods (==) :: Matrix -> Matrix -> Bool Source # (/=) :: Matrix -> Matrix -> Bool Source #

type MatrixPtr = Ptr Matrix Source #

identity :: Matrix Source #

translate :: Double -> Double -> Matrix -> Matrix Source #

scale :: Double -> Double -> Matrix -> Matrix Source #

rotate :: Double -> Matrix -> Matrix Source #

transformDistance :: Matrix -> (Double, Double) -> (Double, Double) Source #

transformPoint :: Matrix -> (Double, Double) -> (Double, Double) Source #

scalarMultiply :: Double -> Matrix -> Matrix Source #

adjoint :: Matrix -> Matrix Source #

invert :: Matrix -> Matrix Source #