#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.GdkPixbuf.Callbacks
(
C_PixbufDestroyNotify ,
PixbufDestroyNotify ,
PixbufDestroyNotify_WithClosures ,
drop_closures_PixbufDestroyNotify ,
dynamic_PixbufDestroyNotify ,
genClosure_PixbufDestroyNotify ,
mk_PixbufDestroyNotify ,
noPixbufDestroyNotify ,
noPixbufDestroyNotify_WithClosures ,
wrap_PixbufDestroyNotify ,
C_PixbufSaveFunc ,
PixbufSaveFunc ,
PixbufSaveFunc_WithClosures ,
drop_closures_PixbufSaveFunc ,
dynamic_PixbufSaveFunc ,
genClosure_PixbufSaveFunc ,
mk_PixbufSaveFunc ,
noPixbufSaveFunc ,
noPixbufSaveFunc_WithClosures ,
wrap_PixbufSaveFunc ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
type C_PixbufSaveFunc =
Ptr Word8 ->
Word64 ->
Ptr (Ptr GError) ->
Ptr () ->
IO CInt
foreign import ccall "dynamic" __dynamic_C_PixbufSaveFunc :: FunPtr C_PixbufSaveFunc -> C_PixbufSaveFunc
dynamic_PixbufSaveFunc ::
(B.CallStack.HasCallStack, MonadIO m) =>
FunPtr C_PixbufSaveFunc
-> ByteString
-> Ptr ()
-> m ((Bool, GError))
dynamic_PixbufSaveFunc :: FunPtr C_PixbufSaveFunc -> ByteString -> Ptr () -> m (Bool, GError)
dynamic_PixbufSaveFunc __funPtr :: FunPtr C_PixbufSaveFunc
__funPtr buf :: ByteString
buf data_ :: Ptr ()
data_ = IO (Bool, GError) -> m (Bool, GError)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, GError) -> m (Bool, GError))
-> IO (Bool, GError) -> m (Bool, GError)
forall a b. (a -> b) -> a -> b
$ do
let count :: Word64
count = Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word64) -> Int -> Word64
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
buf
Ptr Word8
buf' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
buf
Ptr (Ptr GError)
error_ <- IO (Ptr (Ptr GError))
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr (Ptr GError))
CInt
result <- (FunPtr C_PixbufSaveFunc -> C_PixbufSaveFunc
__dynamic_C_PixbufSaveFunc FunPtr C_PixbufSaveFunc
__funPtr) Ptr Word8
buf' Word64
count Ptr (Ptr GError)
error_ Ptr ()
data_
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
Ptr GError
error_' <- Ptr (Ptr GError) -> IO (Ptr GError)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr GError)
error_
GError
error_'' <- ((ManagedPtr GError -> GError) -> Ptr GError -> IO GError
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr GError -> GError
GError) Ptr GError
error_'
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
buf'
Ptr (Ptr GError) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr GError)
error_
(Bool, GError) -> IO (Bool, GError)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', GError
error_'')
foreign import ccall "wrapper"
mk_PixbufSaveFunc :: C_PixbufSaveFunc -> IO (FunPtr C_PixbufSaveFunc)
type PixbufSaveFunc =
ByteString
-> IO ((Bool, GError))
noPixbufSaveFunc :: Maybe PixbufSaveFunc
noPixbufSaveFunc :: Maybe PixbufSaveFunc
noPixbufSaveFunc = Maybe PixbufSaveFunc
forall a. Maybe a
Nothing
type PixbufSaveFunc_WithClosures =
ByteString
-> Ptr ()
-> IO ((Bool, GError))
noPixbufSaveFunc_WithClosures :: Maybe PixbufSaveFunc_WithClosures
noPixbufSaveFunc_WithClosures :: Maybe PixbufSaveFunc_WithClosures
noPixbufSaveFunc_WithClosures = Maybe PixbufSaveFunc_WithClosures
forall a. Maybe a
Nothing
drop_closures_PixbufSaveFunc :: PixbufSaveFunc -> PixbufSaveFunc_WithClosures
drop_closures_PixbufSaveFunc :: PixbufSaveFunc -> PixbufSaveFunc_WithClosures
drop_closures_PixbufSaveFunc _f :: PixbufSaveFunc
_f buf :: ByteString
buf _ = PixbufSaveFunc
_f ByteString
buf
genClosure_PixbufSaveFunc :: MonadIO m => PixbufSaveFunc -> m (GClosure C_PixbufSaveFunc)
genClosure_PixbufSaveFunc :: PixbufSaveFunc -> m (GClosure C_PixbufSaveFunc)
genClosure_PixbufSaveFunc cb :: PixbufSaveFunc
cb = IO (GClosure C_PixbufSaveFunc) -> m (GClosure C_PixbufSaveFunc)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_PixbufSaveFunc) -> m (GClosure C_PixbufSaveFunc))
-> IO (GClosure C_PixbufSaveFunc) -> m (GClosure C_PixbufSaveFunc)
forall a b. (a -> b) -> a -> b
$ do
let cb' :: PixbufSaveFunc_WithClosures
cb' = PixbufSaveFunc -> PixbufSaveFunc_WithClosures
drop_closures_PixbufSaveFunc PixbufSaveFunc
cb
let cb'' :: C_PixbufSaveFunc
cb'' = Maybe (Ptr (FunPtr C_PixbufSaveFunc))
-> PixbufSaveFunc_WithClosures -> C_PixbufSaveFunc
wrap_PixbufSaveFunc Maybe (Ptr (FunPtr C_PixbufSaveFunc))
forall a. Maybe a
Nothing PixbufSaveFunc_WithClosures
cb'
C_PixbufSaveFunc -> IO (FunPtr C_PixbufSaveFunc)
mk_PixbufSaveFunc C_PixbufSaveFunc
cb'' IO (FunPtr C_PixbufSaveFunc)
-> (FunPtr C_PixbufSaveFunc -> IO (GClosure C_PixbufSaveFunc))
-> IO (GClosure C_PixbufSaveFunc)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_PixbufSaveFunc -> IO (GClosure C_PixbufSaveFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure
wrap_PixbufSaveFunc ::
Maybe (Ptr (FunPtr C_PixbufSaveFunc)) ->
PixbufSaveFunc_WithClosures ->
C_PixbufSaveFunc
wrap_PixbufSaveFunc :: Maybe (Ptr (FunPtr C_PixbufSaveFunc))
-> PixbufSaveFunc_WithClosures -> C_PixbufSaveFunc
wrap_PixbufSaveFunc funptrptr :: Maybe (Ptr (FunPtr C_PixbufSaveFunc))
funptrptr _cb :: PixbufSaveFunc_WithClosures
_cb buf :: Ptr Word8
buf count :: Word64
count error_ :: Ptr (Ptr GError)
error_ data_ :: Ptr ()
data_ = do
ByteString
buf' <- (Word64 -> Ptr Word8 -> IO ByteString
forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Word64
count) Ptr Word8
buf
(result :: Bool
result, outerror_ :: GError
outerror_) <- PixbufSaveFunc_WithClosures
_cb ByteString
buf' Ptr ()
data_
Ptr GError
outerror_' <- GError -> IO (Ptr GError)
forall a. (HasCallStack, BoxedObject a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed GError
outerror_
Ptr (Ptr GError) -> Ptr GError -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (Ptr GError)
error_ Ptr GError
outerror_'
Maybe (Ptr (FunPtr C_PixbufSaveFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_PixbufSaveFunc))
funptrptr
let result' :: CInt
result' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
result
CInt -> IO CInt
forall (m :: * -> *) a. Monad m => a -> m a
return CInt
result'
type C_PixbufDestroyNotify =
Ptr Word8 ->
Ptr () ->
IO ()
foreign import ccall "dynamic" __dynamic_C_PixbufDestroyNotify :: FunPtr C_PixbufDestroyNotify -> C_PixbufDestroyNotify
dynamic_PixbufDestroyNotify ::
(B.CallStack.HasCallStack, MonadIO m) =>
FunPtr C_PixbufDestroyNotify
-> Ptr Word8
-> Ptr ()
-> m ()
dynamic_PixbufDestroyNotify :: FunPtr C_PixbufDestroyNotify -> Ptr Word8 -> Ptr () -> m ()
dynamic_PixbufDestroyNotify __funPtr :: FunPtr C_PixbufDestroyNotify
__funPtr pixels :: Ptr Word8
pixels data_ :: Ptr ()
data_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
(FunPtr C_PixbufDestroyNotify -> C_PixbufDestroyNotify
__dynamic_C_PixbufDestroyNotify FunPtr C_PixbufDestroyNotify
__funPtr) Ptr Word8
pixels Ptr ()
data_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
foreign import ccall "wrapper"
mk_PixbufDestroyNotify :: C_PixbufDestroyNotify -> IO (FunPtr C_PixbufDestroyNotify)
type PixbufDestroyNotify =
Ptr Word8
-> IO ()
noPixbufDestroyNotify :: Maybe PixbufDestroyNotify
noPixbufDestroyNotify :: Maybe (Ptr Word8 -> IO ())
noPixbufDestroyNotify = Maybe (Ptr Word8 -> IO ())
forall a. Maybe a
Nothing
type PixbufDestroyNotify_WithClosures =
Ptr Word8
-> Ptr ()
-> IO ()
noPixbufDestroyNotify_WithClosures :: Maybe PixbufDestroyNotify_WithClosures
noPixbufDestroyNotify_WithClosures :: Maybe C_PixbufDestroyNotify
noPixbufDestroyNotify_WithClosures = Maybe C_PixbufDestroyNotify
forall a. Maybe a
Nothing
drop_closures_PixbufDestroyNotify :: PixbufDestroyNotify -> PixbufDestroyNotify_WithClosures
drop_closures_PixbufDestroyNotify :: (Ptr Word8 -> IO ()) -> C_PixbufDestroyNotify
drop_closures_PixbufDestroyNotify _f :: Ptr Word8 -> IO ()
_f pixels :: Ptr Word8
pixels _ = Ptr Word8 -> IO ()
_f Ptr Word8
pixels
genClosure_PixbufDestroyNotify :: MonadIO m => PixbufDestroyNotify -> m (GClosure C_PixbufDestroyNotify)
genClosure_PixbufDestroyNotify :: (Ptr Word8 -> IO ()) -> m (GClosure C_PixbufDestroyNotify)
genClosure_PixbufDestroyNotify cb :: Ptr Word8 -> IO ()
cb = IO (GClosure C_PixbufDestroyNotify)
-> m (GClosure C_PixbufDestroyNotify)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_PixbufDestroyNotify)
-> m (GClosure C_PixbufDestroyNotify))
-> IO (GClosure C_PixbufDestroyNotify)
-> m (GClosure C_PixbufDestroyNotify)
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_PixbufDestroyNotify
cb' = (Ptr Word8 -> IO ()) -> C_PixbufDestroyNotify
drop_closures_PixbufDestroyNotify Ptr Word8 -> IO ()
cb
let cb'' :: C_PixbufDestroyNotify
cb'' = Maybe (Ptr (FunPtr C_PixbufDestroyNotify))
-> C_PixbufDestroyNotify -> C_PixbufDestroyNotify
wrap_PixbufDestroyNotify Maybe (Ptr (FunPtr C_PixbufDestroyNotify))
forall a. Maybe a
Nothing C_PixbufDestroyNotify
cb'
C_PixbufDestroyNotify -> IO (FunPtr C_PixbufDestroyNotify)
mk_PixbufDestroyNotify C_PixbufDestroyNotify
cb'' IO (FunPtr C_PixbufDestroyNotify)
-> (FunPtr C_PixbufDestroyNotify
-> IO (GClosure C_PixbufDestroyNotify))
-> IO (GClosure C_PixbufDestroyNotify)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_PixbufDestroyNotify -> IO (GClosure C_PixbufDestroyNotify)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure
wrap_PixbufDestroyNotify ::
Maybe (Ptr (FunPtr C_PixbufDestroyNotify)) ->
PixbufDestroyNotify_WithClosures ->
C_PixbufDestroyNotify
wrap_PixbufDestroyNotify :: Maybe (Ptr (FunPtr C_PixbufDestroyNotify))
-> C_PixbufDestroyNotify -> C_PixbufDestroyNotify
wrap_PixbufDestroyNotify funptrptr :: Maybe (Ptr (FunPtr C_PixbufDestroyNotify))
funptrptr _cb :: C_PixbufDestroyNotify
_cb pixels :: Ptr Word8
pixels data_ :: Ptr ()
data_ = do
C_PixbufDestroyNotify
_cb Ptr Word8
pixels Ptr ()
data_
Maybe (Ptr (FunPtr C_PixbufDestroyNotify)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_PixbufDestroyNotify))
funptrptr