module Graphics.PS.Transform where
import qualified Data.CG.Minus as CG
import qualified Graphics.PS.Path as P
import qualified Graphics.PS.Image as I
class Transformable t where
mtransform :: CG.Matrix Double -> t -> t
translate :: Transformable t => Double -> Double -> t -> t
translate x = mtransform . CG.mx_translation x
scale :: Transformable t => Double -> Double -> t -> t
scale x = mtransform . CG.mx_scaling x
rotate :: Transformable t => Double -> t -> t
rotate = mtransform . CG.mx_rotation
instance Transformable I.Image where
mtransform = I.ITransform
instance Transformable P.Path where
mtransform = P.PTransform
instance Transformable (CG.Pt Double) where
mtransform = CG.pt_transform