{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Cogl.Objects.Offscreen
(
Offscreen(..) ,
IsOffscreen ,
toOffscreen ,
#if defined(ENABLE_OVERLOADING)
ResolveOffscreenMethod ,
#endif
offscreenNewToTexture ,
offscreenNewWithTexture ,
offscreenRef ,
offscreenUnref ,
) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
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 Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
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
import qualified GHC.Records as R
import {-# SOURCE #-} qualified GI.Cogl.Interfaces.Texture as Cogl.Texture
newtype Offscreen = Offscreen (SP.ManagedPtr Offscreen)
deriving (Offscreen -> Offscreen -> Bool
(Offscreen -> Offscreen -> Bool)
-> (Offscreen -> Offscreen -> Bool) -> Eq Offscreen
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Offscreen -> Offscreen -> Bool
$c/= :: Offscreen -> Offscreen -> Bool
== :: Offscreen -> Offscreen -> Bool
$c== :: Offscreen -> Offscreen -> Bool
Eq)
instance SP.ManagedPtrNewtype Offscreen where
toManagedPtr :: Offscreen -> ManagedPtr Offscreen
toManagedPtr (Offscreen ManagedPtr Offscreen
p) = ManagedPtr Offscreen
p
foreign import ccall "cogl_offscreen_get_gtype"
c_cogl_offscreen_get_gtype :: IO B.Types.GType
instance B.Types.TypedObject Offscreen where
glibType :: IO GType
glibType = IO GType
c_cogl_offscreen_get_gtype
class (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf Offscreen o) => IsOffscreen o
instance (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf Offscreen o) => IsOffscreen o
instance O.HasParentTypes Offscreen
type instance O.ParentTypes Offscreen = '[]
toOffscreen :: (MIO.MonadIO m, IsOffscreen o) => o -> m Offscreen
toOffscreen :: forall (m :: * -> *) o.
(MonadIO m, IsOffscreen o) =>
o -> m Offscreen
toOffscreen = IO Offscreen -> m Offscreen
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Offscreen -> m Offscreen)
-> (o -> IO Offscreen) -> o -> m Offscreen
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Offscreen -> Offscreen) -> o -> IO Offscreen
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Offscreen -> Offscreen
Offscreen
#if defined(ENABLE_OVERLOADING)
type family ResolveOffscreenMethod (t :: Symbol) (o :: *) :: * where
ResolveOffscreenMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveOffscreenMethod t Offscreen, O.OverloadedMethod info Offscreen p) => OL.IsLabel t (Offscreen -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveOffscreenMethod t Offscreen, O.OverloadedMethod info Offscreen p, R.HasField t Offscreen p) => R.HasField t Offscreen p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveOffscreenMethod t Offscreen, O.OverloadedMethodInfo info Offscreen) => OL.IsLabel t (O.MethodProxy info Offscreen) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
instance BoxedPtr Offscreen where
boxedPtrCopy :: Offscreen -> IO Offscreen
boxedPtrCopy = Offscreen -> IO Offscreen
forall (m :: * -> *) a. Monad m => a -> m a
return
boxedPtrFree :: Offscreen -> IO ()
boxedPtrFree = \Offscreen
_x -> () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
foreign import ccall "cogl_offscreen_new_to_texture" cogl_offscreen_new_to_texture ::
Ptr Cogl.Texture.Texture ->
IO (Ptr Offscreen)
{-# DEPRECATED offscreenNewToTexture ["(Since version 1.16)","Use cogl_offscreen_new_with_texture instead."] #-}
offscreenNewToTexture ::
(B.CallStack.HasCallStack, MonadIO m, Cogl.Texture.IsTexture a) =>
a
-> m Offscreen
offscreenNewToTexture :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsTexture a) =>
a -> m Offscreen
offscreenNewToTexture a
texture = IO Offscreen -> m Offscreen
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Offscreen -> m Offscreen) -> IO Offscreen -> m Offscreen
forall a b. (a -> b) -> a -> b
$ do
Ptr Texture
texture' <- a -> IO (Ptr Texture)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
texture
Ptr Offscreen
result <- Ptr Texture -> IO (Ptr Offscreen)
cogl_offscreen_new_to_texture Ptr Texture
texture'
Text -> Ptr Offscreen -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"offscreenNewToTexture" Ptr Offscreen
result
Offscreen
result' <- ((ManagedPtr Offscreen -> Offscreen)
-> Ptr Offscreen -> IO Offscreen
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr Offscreen -> Offscreen
Offscreen) Ptr Offscreen
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
texture
Offscreen -> IO Offscreen
forall (m :: * -> *) a. Monad m => a -> m a
return Offscreen
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "cogl_offscreen_new_with_texture" cogl_offscreen_new_with_texture ::
Ptr Cogl.Texture.Texture ->
IO (Ptr Offscreen)
offscreenNewWithTexture ::
(B.CallStack.HasCallStack, MonadIO m, Cogl.Texture.IsTexture a) =>
a
-> m Offscreen
offscreenNewWithTexture :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsTexture a) =>
a -> m Offscreen
offscreenNewWithTexture a
texture = IO Offscreen -> m Offscreen
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Offscreen -> m Offscreen) -> IO Offscreen -> m Offscreen
forall a b. (a -> b) -> a -> b
$ do
Ptr Texture
texture' <- a -> IO (Ptr Texture)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
texture
Ptr Offscreen
result <- Ptr Texture -> IO (Ptr Offscreen)
cogl_offscreen_new_with_texture Ptr Texture
texture'
Text -> Ptr Offscreen -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"offscreenNewWithTexture" Ptr Offscreen
result
Offscreen
result' <- ((ManagedPtr Offscreen -> Offscreen)
-> Ptr Offscreen -> IO Offscreen
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr Offscreen -> Offscreen
Offscreen) Ptr Offscreen
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
texture
Offscreen -> IO Offscreen
forall (m :: * -> *) a. Monad m => a -> m a
return Offscreen
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "cogl_offscreen_ref" cogl_offscreen_ref ::
Ptr () ->
IO (Ptr ())
{-# DEPRECATED offscreenRef ["(Since version 1.2)","@/cogl_object_ref()/@ should be used in new code."] #-}
offscreenRef ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ptr ()
-> m (Ptr ())
offscreenRef :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Ptr () -> m (Ptr ())
offscreenRef Ptr ()
offscreen = IO (Ptr ()) -> m (Ptr ())
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ())
forall a b. (a -> b) -> a -> b
$ do
Ptr ()
result <- Ptr () -> IO (Ptr ())
cogl_offscreen_ref Ptr ()
offscreen
Ptr () -> IO (Ptr ())
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ()
result
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "cogl_offscreen_unref" cogl_offscreen_unref ::
Ptr () ->
IO ()
{-# DEPRECATED offscreenUnref ["(Since version 1.2)","@/cogl_object_unref()/@ should be used in new code."] #-}
offscreenUnref ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ptr ()
-> m ()
offscreenUnref :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Ptr () -> m ()
offscreenUnref Ptr ()
offscreen = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr () -> IO ()
cogl_offscreen_unref Ptr ()
offscreen
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
#endif