-- GENERATED by C->Haskell Compiler, version 0.13.13 (gtk2hs branch) "Bin IO", 27 May 2012 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "./Graphics/Rendering/Cairo/Internal/Drawing/Transformations.chs" #-}
-----------------------------------------------------------------------------
-- |
-- Module      :  Graphics.Rendering.Cairo.Internal.Drawing.Tranformations
-- Copyright   :  (c) Paolo Martini 2005
-- License     :  BSD-style (see cairo/COPYRIGHT)
--
-- Maintainer  :  p.martini@neuralnoise.com
-- Stability   :  experimental
-- Portability :  portable
--
-- Manipulating the current transformation matrix.
-----------------------------------------------------------------------------

module Graphics.Rendering.Cairo.Internal.Drawing.Transformations where

import Graphics.Rendering.Cairo.Types
{-# LINE 16 "./Graphics/Rendering/Cairo/Internal/Drawing/Transformations.chs" #-}

import Foreign hiding (rotate)
import Foreign.C


{-# LINE 21 "./Graphics/Rendering/Cairo/Internal/Drawing/Transformations.chs" #-}

translate :: Cairo -> Double -> Double -> IO ()
translate a1 a2 a3 =
  let {a1' = unCairo a1} in 
  let {a2' = cFloatConv a2} in 
  let {a3' = cFloatConv a3} in 
  translate'_ a1' a2' a3' >>= \res ->
  return ()
{-# LINE 23 "./Graphics/Rendering/Cairo/Internal/Drawing/Transformations.chs" #-}
scale :: Cairo -> Double -> Double -> IO ()
scale a1 a2 a3 =
  let {a1' = unCairo a1} in 
  let {a2' = cFloatConv a2} in 
  let {a3' = cFloatConv a3} in 
  scale'_ a1' a2' a3' >>= \res ->
  return ()
{-# LINE 24 "./Graphics/Rendering/Cairo/Internal/Drawing/Transformations.chs" #-}
rotate :: Cairo -> Double -> IO ()
rotate a1 a2 =
  let {a1' = unCairo a1} in 
  let {a2' = cFloatConv a2} in 
  rotate'_ a1' a2' >>= \res ->
  return ()
{-# LINE 25 "./Graphics/Rendering/Cairo/Internal/Drawing/Transformations.chs" #-}
transform :: Cairo -> Matrix -> IO ()
transform a1 a2 =
  let {a1' = unCairo a1} in 
  with a2 $ \a2' -> 
  transform'_ a1' a2' >>= \res ->
  return ()
{-# LINE 26 "./Graphics/Rendering/Cairo/Internal/Drawing/Transformations.chs" #-}
setMatrix :: Cairo -> Matrix -> IO ()
setMatrix a1 a2 =
  let {a1' = unCairo a1} in 
  with a2 $ \a2' -> 
  setMatrix'_ a1' a2' >>= \res ->
  return ()
{-# LINE 27 "./Graphics/Rendering/Cairo/Internal/Drawing/Transformations.chs" #-}
getMatrix :: Cairo -> IO (Matrix)
getMatrix a1 =
  let {a1' = unCairo a1} in 
  alloca $ \a2' -> 
  getMatrix'_ a1' a2' >>= \res ->
  peek a2'>>= \a2'' -> 
  return (a2'')
{-# LINE 28 "./Graphics/Rendering/Cairo/Internal/Drawing/Transformations.chs" #-}
identityMatrix :: Cairo -> IO ()
identityMatrix a1 =
  let {a1' = unCairo a1} in 
  identityMatrix'_ a1' >>= \res ->
  return ()
{-# LINE 29 "./Graphics/Rendering/Cairo/Internal/Drawing/Transformations.chs" #-}
userToDevice :: Cairo -> Double -> Double -> IO (Double, Double)
userToDevice a1 a2 a3 =
  let {a1' = unCairo a1} in 
  withFloatConv a2 $ \a2' -> 
  withFloatConv a3 $ \a3' -> 
  userToDevice'_ a1' a2' a3' >>= \res ->
  peekFloatConv a2'>>= \a2'' -> 
  peekFloatConv a3'>>= \a3'' -> 
  return (a2'', a3'')
{-# LINE 30 "./Graphics/Rendering/Cairo/Internal/Drawing/Transformations.chs" #-}
userToDeviceDistance :: Cairo -> Double -> Double -> IO (Double, Double)
userToDeviceDistance a1 a2 a3 =
  let {a1' = unCairo a1} in 
  withFloatConv a2 $ \a2' -> 
  withFloatConv a3 $ \a3' -> 
  userToDeviceDistance'_ a1' a2' a3' >>= \res ->
  peekFloatConv a2'>>= \a2'' -> 
  peekFloatConv a3'>>= \a3'' -> 
  return (a2'', a3'')
{-# LINE 31 "./Graphics/Rendering/Cairo/Internal/Drawing/Transformations.chs" #-}
deviceToUser :: Cairo -> Double -> Double -> IO (Double, Double)
deviceToUser a1 a2 a3 =
  let {a1' = unCairo a1} in 
  withFloatConv a2 $ \a2' -> 
  withFloatConv a3 $ \a3' -> 
  deviceToUser'_ a1' a2' a3' >>= \res ->
  peekFloatConv a2'>>= \a2'' -> 
  peekFloatConv a3'>>= \a3'' -> 
  return (a2'', a3'')
{-# LINE 32 "./Graphics/Rendering/Cairo/Internal/Drawing/Transformations.chs" #-}
deviceToUserDistance :: Cairo -> Double -> Double -> IO (Double, Double)
deviceToUserDistance a1 a2 a3 =
  let {a1' = unCairo a1} in 
  withFloatConv a2 $ \a2' -> 
  withFloatConv a3 $ \a3' -> 
  deviceToUserDistance'_ a1' a2' a3' >>= \res ->
  peekFloatConv a2'>>= \a2'' -> 
  peekFloatConv a3'>>= \a3'' -> 
  return (a2'', a3'')
{-# LINE 33 "./Graphics/Rendering/Cairo/Internal/Drawing/Transformations.chs" #-}

foreign import ccall safe "cairo_translate"
  translate'_ :: ((Ptr Cairo) -> (CDouble -> (CDouble -> (IO ()))))

foreign import ccall safe "cairo_scale"
  scale'_ :: ((Ptr Cairo) -> (CDouble -> (CDouble -> (IO ()))))

foreign import ccall safe "cairo_rotate"
  rotate'_ :: ((Ptr Cairo) -> (CDouble -> (IO ())))

foreign import ccall safe "cairo_transform"
  transform'_ :: ((Ptr Cairo) -> ((Ptr Matrix) -> (IO ())))

foreign import ccall safe "cairo_set_matrix"
  setMatrix'_ :: ((Ptr Cairo) -> ((Ptr Matrix) -> (IO ())))

foreign import ccall safe "cairo_get_matrix"
  getMatrix'_ :: ((Ptr Cairo) -> ((Ptr Matrix) -> (IO ())))

foreign import ccall safe "cairo_identity_matrix"
  identityMatrix'_ :: ((Ptr Cairo) -> (IO ()))

foreign import ccall safe "cairo_user_to_device"
  userToDevice'_ :: ((Ptr Cairo) -> ((Ptr CDouble) -> ((Ptr CDouble) -> (IO ()))))

foreign import ccall safe "cairo_user_to_device_distance"
  userToDeviceDistance'_ :: ((Ptr Cairo) -> ((Ptr CDouble) -> ((Ptr CDouble) -> (IO ()))))

foreign import ccall safe "cairo_device_to_user"
  deviceToUser'_ :: ((Ptr Cairo) -> ((Ptr CDouble) -> ((Ptr CDouble) -> (IO ()))))

foreign import ccall safe "cairo_device_to_user_distance"
  deviceToUserDistance'_ :: ((Ptr Cairo) -> ((Ptr CDouble) -> ((Ptr CDouble) -> (IO ()))))