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


{-# LINE 1 "src/WebP/Decode.chs" #-}
module WebP.Decode ( webPDecodeRGBA
                   , webPDecodeRGB
                   , webPDecodeYUV
                   , UInt8
                   ) where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.Ptr as C2HSImp



import Data.Coerce (coerce)
import Foreign.C.Types (CInt, CSize)
import Foreign.Marshal.Alloc (alloca)
import Foreign.Ptr (Ptr, castPtr)
import Foreign.Storable (peek)



type UInt8 = (C2HSImp.CUChar)
{-# LINE 15 "src/WebP/Decode.chs" #-}


-- see docs: https://developers.google.com/speed/webp/docs/api

webPDecodeRGBA :: (Ptr a) -> (CSize) -> IO ((Ptr UInt8), (CInt), (CInt))
webPDecodeRGBA :: forall a. Ptr a -> CSize -> IO (Ptr UInt8, CInt, CInt)
webPDecodeRGBA Ptr a
a1 CSize
a2 =
  let {a1' :: Ptr b
a1' = Ptr a -> Ptr b
forall a b. Ptr a -> Ptr b
castPtr Ptr a
a1} in 
  let {a2' = coerce a2} in 
  alloca $ \a3' -> 
  alloca $ \a4' -> 
  webPDecodeRGBA'_ a1' a2' a3' a4' >>= \res ->
  let {res' = id res} in
  peek  a3'>>= \a3'' -> 
  peek  Ptr CInt
a4'>>= \CInt
a4'' -> 
  (Ptr UInt8, CInt, CInt) -> IO (Ptr UInt8, CInt, CInt)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr UInt8
res', CInt
a3'', CInt
a4'')

{-# LINE 19 "src/WebP/Decode.chs" #-}

webPDecodeRGB :: (Ptr a) -> (CSize) -> IO ((Ptr UInt8), (CInt), (CInt))
webPDecodeRGB a1 a2 =
  let {a1' = castPtr a1} in 
  let {a2' = coerce a2} in 
  alloca $ \a3' -> 
  alloca $ \a4' -> 
  webPDecodeRGB'_ a1' a2' a3' a4' >>= \res ->
  let {res' = id res} in
  peek  a3'>>= \a3'' -> 
  peek  a4'>>= \a4'' -> 
  return (res', a3'', a4'')

{-# LINE 20 "src/WebP/Decode.chs" #-}


webPDecodeYUV :: (Ptr a) -> (CSize) -> IO ((Ptr UInt8), (CInt), (CInt), (Ptr UInt8), (Ptr UInt8), (CInt), (CInt))
webPDecodeYUV a1 a2 =
  let {a1' = castPtr a1} in 
  let {a2' = coerce a2} in 
  alloca $ \a3' -> 
  alloca $ \a4' -> 
  alloca $ \a5' -> 
  alloca $ \a6' -> 
  alloca $ \a7' -> 
  alloca $ \a8' -> 
  webPDecodeYUV'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
  let {res' = id res} in
  peek  a3'>>= \a3'' -> 
  peek  a4'>>= \a4'' -> 
  peek  a5'>>= \a5'' -> 
  peek  a6'>>= \a6'' -> 
  peek  a7'>>= \a7'' -> 
  peek  a8'>>= \a8'' -> 
  return (res', a3'', a4'', a5'', a6'', a7'', a8'')

{-# LINE 30 "src/WebP/Decode.chs" #-}


foreign import ccall safe "WebP/Decode.chs.h WebPDecodeRGBA"
  webPDecodeRGBA'_ :: ((C2HSImp.Ptr C2HSImp.CUChar) -> (C2HSImp.CULong -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr C2HSImp.CInt) -> (IO (C2HSImp.Ptr C2HSImp.CUChar))))))

foreign import ccall safe "WebP/Decode.chs.h WebPDecodeRGB"
  webPDecodeRGB'_ :: ((C2HSImp.Ptr C2HSImp.CUChar) -> (C2HSImp.CULong -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr C2HSImp.CInt) -> (IO (C2HSImp.Ptr C2HSImp.CUChar))))))

foreign import ccall safe "WebP/Decode.chs.h WebPDecodeYUV"
  webPDecodeYUV'_ :: ((C2HSImp.Ptr C2HSImp.CUChar) -> (C2HSImp.CULong -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CUChar)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CUChar)) -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr C2HSImp.CInt) -> (IO (C2HSImp.Ptr C2HSImp.CUChar))))))))))