-- GENERATED by C->Haskell Compiler, version 0.28.3 Switcheroo, 25 November 2017 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "src/NanoVG/Internal/Path.chs" #-}
module NanoVG.Internal.Path where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.Ptr as C2HSImp



import Foreign.C.Types

import NanoVG.Internal.Context




{-# LINE 9 "src/NanoVG/Internal/Path.chs" #-}


data Winding = CCW
             | CW
  deriving (Show,Read,Eq,Ord)
instance Enum Winding where
  succ CCW = CW
  succ CW = error "Winding.succ: CW has no successor"

  pred CW = CCW
  pred CCW = error "Winding.pred: CCW has no predecessor"

  enumFromTo from to = go from
    where
      end = fromEnum to
      go v = case compare (fromEnum v) end of
                 LT -> v : go (succ v)
                 EQ -> [v]
                 GT -> []

  enumFrom from = enumFromTo from CW

  fromEnum CCW = 1
  fromEnum CW = 2

  toEnum 1 = CCW
  toEnum 2 = CW
  toEnum unmatched = error ("Winding.toEnum: Cannot match " ++ show unmatched)

{-# LINE 13 "src/NanoVG/Internal/Path.chs" #-}


-- | Clears the current path and sub-paths.
beginPath :: (Context) -> IO ()
beginPath a1 =
  let {a1' = id a1} in
  beginPath'_ a1' >>
  return ()

{-# LINE 17 "src/NanoVG/Internal/Path.chs" #-}


-- | Starts new sub-path with specified point as first point.
moveTo :: (Context) -> (CFloat) -> (CFloat) -> IO ()
moveTo a1 a2 a3 =
  let {a1' = id a1} in
  let {a2' = realToFrac a2} in
  let {a3' = realToFrac a3} in
  moveTo'_ a1' a2' a3' >>
  return ()

{-# LINE 21 "src/NanoVG/Internal/Path.chs" #-}


-- | Adds line segment from the last point in the path to the specified point.
lineTo :: (Context) -> (CFloat) -> (CFloat) -> IO ()
lineTo a1 a2 a3 =
  let {a1' = id a1} in
  let {a2' = realToFrac a2} in
  let {a3' = realToFrac a3} in
  lineTo'_ a1' a2' a3' >>
  return ()

{-# LINE 25 "src/NanoVG/Internal/Path.chs" #-}


-- | Adds cubic bezier segment from last point in the path via two control points to the specified point.
bezierTo :: (Context) -> (CFloat) -> (CFloat) -> (CFloat) -> (CFloat) -> (CFloat) -> (CFloat) -> IO ()
bezierTo a1 a2 a3 a4 a5 a6 a7 =
  let {a1' = id a1} in
  let {a2' = realToFrac a2} in
  let {a3' = realToFrac a3} in
  let {a4' = realToFrac a4} in
  let {a5' = realToFrac a5} in
  let {a6' = realToFrac a6} in
  let {a7' = realToFrac a7} in
  bezierTo'_ a1' a2' a3' a4' a5' a6' a7' >>
  return ()

{-# LINE 29 "src/NanoVG/Internal/Path.chs" #-}


-- | Adds quadratic bezier segment from last point in the path via a control point to the specified point
quadTo :: (Context) -> (CFloat) -> (CFloat) -> (CFloat) -> (CFloat) -> IO ()
quadTo a1 a2 a3 a4 a5 =
  let {a1' = id a1} in
  let {a2' = realToFrac a2} in
  let {a3' = realToFrac a3} in
  let {a4' = realToFrac a4} in
  let {a5' = realToFrac a5} in
  quadTo'_ a1' a2' a3' a4' a5' >>
  return ()

{-# LINE 33 "src/NanoVG/Internal/Path.chs" #-}


-- | Adds an arc segment at the corner defined by the last path point, and two specified points.
arcTo :: (Context) -> (CFloat) -> (CFloat) -> (CFloat) -> (CFloat) -> (CFloat) -> IO ()
arcTo a1 a2 a3 a4 a5 a6 =
  let {a1' = id a1} in
  let {a2' = realToFrac a2} in
  let {a3' = realToFrac a3} in
  let {a4' = realToFrac a4} in
  let {a5' = realToFrac a5} in
  let {a6' = realToFrac a6} in
  arcTo'_ a1' a2' a3' a4' a5' a6' >>
  return ()

{-# LINE 37 "src/NanoVG/Internal/Path.chs" #-}


-- | Closes current sub-path with a line segment.
closePath :: (Context) -> IO ()
closePath a1 =
  let {a1' = id a1} in
  closePath'_ a1' >>
  return ()

{-# LINE 41 "src/NanoVG/Internal/Path.chs" #-}


-- | Sets the current sub-path winding, see NVGwinding and NVGsolidity. 
pathWinding :: (Context) -> (CInt) -> IO ()
pathWinding a1 a2 =
  let {a1' = id a1} in
  let {a2' = fromIntegral a2} in
  pathWinding'_ a1' a2' >>
  return ()

{-# LINE 45 "src/NanoVG/Internal/Path.chs" #-}


-- | Creates new circle arc shaped sub-path. The arc center is at cx,cy, the arc radius is r,
-- and the arc is drawn from angle a0 to a1, and swept in direction dir (NVG_CCW, or NVG_CW).
-- Angles are specified in radians.
arc :: (Context) -> (CFloat) -> (CFloat) -> (CFloat) -> (CFloat) -> (CFloat) -> (Winding) -> IO ()
arc a1 a2 a3 a4 a5 a6 a7 =
  let {a1' = id a1} in
  let {a2' = realToFrac a2} in
  let {a3' = realToFrac a3} in
  let {a4' = realToFrac a4} in
  let {a5' = realToFrac a5} in
  let {a6' = realToFrac a6} in
  let {a7' = (fromIntegral . fromEnum) a7} in
  arc'_ a1' a2' a3' a4' a5' a6' a7' >>
  return ()

{-# LINE 51 "src/NanoVG/Internal/Path.chs" #-}


-- | Creates new rectangle shaped sub-path.
rect :: (Context) -> (CFloat) -> (CFloat) -> (CFloat) -> (CFloat) -> IO ()
rect a1 a2 a3 a4 a5 =
  let {a1' = id a1} in
  let {a2' = realToFrac a2} in
  let {a3' = realToFrac a3} in
  let {a4' = realToFrac a4} in
  let {a5' = realToFrac a5} in
  rect'_ a1' a2' a3' a4' a5' >>
  return ()

{-# LINE 55 "src/NanoVG/Internal/Path.chs" #-}


-- | Creates new rounded rectangle shaped sub-path.
roundedRect :: (Context) -> (CFloat) -> (CFloat) -> (CFloat) -> (CFloat) -> (CFloat) -> IO ()
roundedRect a1 a2 a3 a4 a5 a6 =
  let {a1' = id a1} in
  let {a2' = realToFrac a2} in
  let {a3' = realToFrac a3} in
  let {a4' = realToFrac a4} in
  let {a5' = realToFrac a5} in
  let {a6' = realToFrac a6} in
  roundedRect'_ a1' a2' a3' a4' a5' a6' >>
  return ()

{-# LINE 59 "src/NanoVG/Internal/Path.chs" #-}


-- | Creates new ellipse shaped sub-path.
ellipse :: (Context) -> (CFloat) -> (CFloat) -> (CFloat) -> (CFloat) -> IO ()
ellipse a1 a2 a3 a4 a5 =
  let {a1' = id a1} in
  let {a2' = realToFrac a2} in
  let {a3' = realToFrac a3} in
  let {a4' = realToFrac a4} in
  let {a5' = realToFrac a5} in
  ellipse'_ a1' a2' a3' a4' a5' >>
  return ()

{-# LINE 63 "src/NanoVG/Internal/Path.chs" #-}


-- | Creates new circle shaped sub-path. 
circle :: (Context) -> (CFloat) -> (CFloat) -> (CFloat) -> IO ()
circle a1 a2 a3 a4 =
  let {a1' = id a1} in
  let {a2' = realToFrac a2} in
  let {a3' = realToFrac a3} in
  let {a4' = realToFrac a4} in
  circle'_ a1' a2' a3' a4' >>
  return ()

{-# LINE 67 "src/NanoVG/Internal/Path.chs" #-}


-- | Fills the current path with current fill style.
fill :: (Context) -> IO ()
fill a1 =
  let {a1' = id a1} in
  fill'_ a1' >>
  return ()

{-# LINE 71 "src/NanoVG/Internal/Path.chs" #-}


-- | Fills the current path with current stroke style.
stroke :: (Context) -> IO ()
stroke a1 =
  let {a1' = id a1} in
  stroke'_ a1' >>
  return ()

{-# LINE 75 "src/NanoVG/Internal/Path.chs" #-}


foreign import ccall unsafe "NanoVG/Internal/Path.chs.h nvgBeginPath"
  beginPath'_ :: ((Context) -> (IO ()))

foreign import ccall unsafe "NanoVG/Internal/Path.chs.h nvgMoveTo"
  moveTo'_ :: ((Context) -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (IO ()))))

foreign import ccall unsafe "NanoVG/Internal/Path.chs.h nvgLineTo"
  lineTo'_ :: ((Context) -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (IO ()))))

foreign import ccall unsafe "NanoVG/Internal/Path.chs.h nvgBezierTo"
  bezierTo'_ :: ((Context) -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (IO ()))))))))

foreign import ccall unsafe "NanoVG/Internal/Path.chs.h nvgQuadTo"
  quadTo'_ :: ((Context) -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (IO ()))))))

foreign import ccall unsafe "NanoVG/Internal/Path.chs.h nvgArcTo"
  arcTo'_ :: ((Context) -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (IO ())))))))

foreign import ccall unsafe "NanoVG/Internal/Path.chs.h nvgClosePath"
  closePath'_ :: ((Context) -> (IO ()))

foreign import ccall unsafe "NanoVG/Internal/Path.chs.h nvgPathWinding"
  pathWinding'_ :: ((Context) -> (C2HSImp.CInt -> (IO ())))

foreign import ccall unsafe "NanoVG/Internal/Path.chs.h nvgArc"
  arc'_ :: ((Context) -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CInt -> (IO ()))))))))

foreign import ccall unsafe "NanoVG/Internal/Path.chs.h nvgRect"
  rect'_ :: ((Context) -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (IO ()))))))

foreign import ccall unsafe "NanoVG/Internal/Path.chs.h nvgRoundedRect"
  roundedRect'_ :: ((Context) -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (IO ())))))))

foreign import ccall unsafe "NanoVG/Internal/Path.chs.h nvgEllipse"
  ellipse'_ :: ((Context) -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (IO ()))))))

foreign import ccall unsafe "NanoVG/Internal/Path.chs.h nvgCircle"
  circle'_ :: ((Context) -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (IO ())))))

foreign import ccall unsafe "NanoVG/Internal/Path.chs.h nvgFill"
  fill'_ :: ((Context) -> (IO ()))

foreign import ccall unsafe "NanoVG/Internal/Path.chs.h nvgStroke"
  stroke'_ :: ((Context) -> (IO ()))