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


{-# LINE 1 "src/WebP/Decode.chs" #-}
module WebP.Decode ( webPDecodeRGBA
                   , webPDecodeRGB
                   , 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 14 "src/WebP/Decode.chs" #-}


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

webPDecodeRGBA :: (Ptr a) -> (CSize) -> IO ((Ptr UInt8), (CInt), (CInt))
webPDecodeRGBA a1 a2 =
  let {a1' = castPtr 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  a4'>>= \a4'' -> 
  return (res', a3'', a4'')

{-# LINE 18 "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 19 "src/WebP/Decode.chs" #-}


-- WebPDecodeYUV

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))))))