{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gdk.Objects.GLTexture
(
GLTexture(..) ,
IsGLTexture ,
toGLTexture ,
#if defined(ENABLE_OVERLOADING)
ResolveGLTextureMethod ,
#endif
gLTextureNew ,
#if defined(ENABLE_OVERLOADING)
GLTextureReleaseMethodInfo ,
#endif
gLTextureRelease ,
) 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.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.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 GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gdk.Interfaces.Paintable as Gdk.Paintable
import {-# SOURCE #-} qualified GI.Gdk.Objects.GLContext as Gdk.GLContext
import {-# SOURCE #-} qualified GI.Gdk.Objects.Texture as Gdk.Texture
newtype GLTexture = GLTexture (SP.ManagedPtr GLTexture)
deriving (GLTexture -> GLTexture -> Bool
(GLTexture -> GLTexture -> Bool)
-> (GLTexture -> GLTexture -> Bool) -> Eq GLTexture
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GLTexture -> GLTexture -> Bool
$c/= :: GLTexture -> GLTexture -> Bool
== :: GLTexture -> GLTexture -> Bool
$c== :: GLTexture -> GLTexture -> Bool
Eq)
instance SP.ManagedPtrNewtype GLTexture where
toManagedPtr :: GLTexture -> ManagedPtr GLTexture
toManagedPtr (GLTexture ManagedPtr GLTexture
p) = ManagedPtr GLTexture
p
foreign import ccall "gdk_gl_texture_get_type"
c_gdk_gl_texture_get_type :: IO B.Types.GType
instance B.Types.TypedObject GLTexture where
glibType :: IO GType
glibType = IO GType
c_gdk_gl_texture_get_type
instance B.Types.GObject GLTexture
instance B.GValue.IsGValue GLTexture where
toGValue :: GLTexture -> IO GValue
toGValue GLTexture
o = do
GType
gtype <- IO GType
c_gdk_gl_texture_get_type
GLTexture -> (Ptr GLTexture -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr GLTexture
o (GType
-> (GValue -> Ptr GLTexture -> IO ()) -> Ptr GLTexture -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr GLTexture -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO GLTexture
fromGValue GValue
gv = do
Ptr GLTexture
ptr <- GValue -> IO (Ptr GLTexture)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr GLTexture)
(ManagedPtr GLTexture -> GLTexture)
-> Ptr GLTexture -> IO GLTexture
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr GLTexture -> GLTexture
GLTexture Ptr GLTexture
ptr
class (SP.GObject o, O.IsDescendantOf GLTexture o) => IsGLTexture o
instance (SP.GObject o, O.IsDescendantOf GLTexture o) => IsGLTexture o
instance O.HasParentTypes GLTexture
type instance O.ParentTypes GLTexture = '[Gdk.Texture.Texture, GObject.Object.Object, Gdk.Paintable.Paintable]
toGLTexture :: (MonadIO m, IsGLTexture o) => o -> m GLTexture
toGLTexture :: o -> m GLTexture
toGLTexture = IO GLTexture -> m GLTexture
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GLTexture -> m GLTexture)
-> (o -> IO GLTexture) -> o -> m GLTexture
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr GLTexture -> GLTexture) -> o -> IO GLTexture
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr GLTexture -> GLTexture
GLTexture
#if defined(ENABLE_OVERLOADING)
type family ResolveGLTextureMethod (t :: Symbol) (o :: *) :: * where
ResolveGLTextureMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveGLTextureMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveGLTextureMethod "computeConcreteSize" o = Gdk.Paintable.PaintableComputeConcreteSizeMethodInfo
ResolveGLTextureMethod "download" o = Gdk.Texture.TextureDownloadMethodInfo
ResolveGLTextureMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveGLTextureMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveGLTextureMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveGLTextureMethod "invalidateContents" o = Gdk.Paintable.PaintableInvalidateContentsMethodInfo
ResolveGLTextureMethod "invalidateSize" o = Gdk.Paintable.PaintableInvalidateSizeMethodInfo
ResolveGLTextureMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveGLTextureMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveGLTextureMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveGLTextureMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveGLTextureMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveGLTextureMethod "release" o = GLTextureReleaseMethodInfo
ResolveGLTextureMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveGLTextureMethod "saveToPng" o = Gdk.Texture.TextureSaveToPngMethodInfo
ResolveGLTextureMethod "snapshot" o = Gdk.Paintable.PaintableSnapshotMethodInfo
ResolveGLTextureMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveGLTextureMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveGLTextureMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveGLTextureMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveGLTextureMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveGLTextureMethod "getCurrentImage" o = Gdk.Paintable.PaintableGetCurrentImageMethodInfo
ResolveGLTextureMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveGLTextureMethod "getFlags" o = Gdk.Paintable.PaintableGetFlagsMethodInfo
ResolveGLTextureMethod "getHeight" o = Gdk.Texture.TextureGetHeightMethodInfo
ResolveGLTextureMethod "getIntrinsicAspectRatio" o = Gdk.Paintable.PaintableGetIntrinsicAspectRatioMethodInfo
ResolveGLTextureMethod "getIntrinsicHeight" o = Gdk.Paintable.PaintableGetIntrinsicHeightMethodInfo
ResolveGLTextureMethod "getIntrinsicWidth" o = Gdk.Paintable.PaintableGetIntrinsicWidthMethodInfo
ResolveGLTextureMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveGLTextureMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveGLTextureMethod "getWidth" o = Gdk.Texture.TextureGetWidthMethodInfo
ResolveGLTextureMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveGLTextureMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveGLTextureMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveGLTextureMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveGLTextureMethod t GLTexture, O.MethodInfo info GLTexture p) => OL.IsLabel t (GLTexture -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList GLTexture
type instance O.AttributeList GLTexture = GLTextureAttributeList
type GLTextureAttributeList = ('[ '("height", Gdk.Texture.TextureHeightPropertyInfo), '("width", Gdk.Texture.TextureWidthPropertyInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList GLTexture = GLTextureSignalList
type GLTextureSignalList = ('[ '("invalidateContents", Gdk.Paintable.PaintableInvalidateContentsSignalInfo), '("invalidateSize", Gdk.Paintable.PaintableInvalidateSizeSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "gdk_gl_texture_new" gdk_gl_texture_new ::
Ptr Gdk.GLContext.GLContext ->
Word32 ->
Int32 ->
Int32 ->
FunPtr GLib.Callbacks.C_DestroyNotify ->
Ptr () ->
IO (Ptr GLTexture)
gLTextureNew ::
(B.CallStack.HasCallStack, MonadIO m, Gdk.GLContext.IsGLContext a) =>
a
-> Word32
-> Int32
-> Int32
-> GLib.Callbacks.DestroyNotify
-> Ptr ()
-> m GLTexture
gLTextureNew :: a
-> Word32
-> Int32
-> Int32
-> DestroyNotify
-> Ptr ()
-> m GLTexture
gLTextureNew a
context Word32
id Int32
width Int32
height DestroyNotify
destroy Ptr ()
data_ = IO GLTexture -> m GLTexture
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GLTexture -> m GLTexture) -> IO GLTexture -> m GLTexture
forall a b. (a -> b) -> a -> b
$ do
Ptr GLContext
context' <- a -> IO (Ptr GLContext)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
context
Ptr (FunPtr DestroyNotify)
ptrdestroy <- IO (Ptr (FunPtr DestroyNotify))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr GLib.Callbacks.C_DestroyNotify))
FunPtr DestroyNotify
destroy' <- DestroyNotify -> IO (FunPtr DestroyNotify)
GLib.Callbacks.mk_DestroyNotify (Maybe (Ptr (FunPtr DestroyNotify))
-> DestroyNotify -> DestroyNotify
GLib.Callbacks.wrap_DestroyNotify (Ptr (FunPtr DestroyNotify) -> Maybe (Ptr (FunPtr DestroyNotify))
forall a. a -> Maybe a
Just Ptr (FunPtr DestroyNotify)
ptrdestroy) DestroyNotify
destroy)
Ptr (FunPtr DestroyNotify) -> FunPtr DestroyNotify -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr DestroyNotify)
ptrdestroy FunPtr DestroyNotify
destroy'
Ptr GLTexture
result <- Ptr GLContext
-> Word32
-> Int32
-> Int32
-> FunPtr DestroyNotify
-> Ptr ()
-> IO (Ptr GLTexture)
gdk_gl_texture_new Ptr GLContext
context' Word32
id Int32
width Int32
height FunPtr DestroyNotify
destroy' Ptr ()
data_
Text -> Ptr GLTexture -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"gLTextureNew" Ptr GLTexture
result
GLTexture
result' <- ((ManagedPtr GLTexture -> GLTexture)
-> Ptr GLTexture -> IO GLTexture
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr GLTexture -> GLTexture
GLTexture) Ptr GLTexture
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
context
GLTexture -> IO GLTexture
forall (m :: * -> *) a. Monad m => a -> m a
return GLTexture
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gdk_gl_texture_release" gdk_gl_texture_release ::
Ptr GLTexture ->
IO ()
gLTextureRelease ::
(B.CallStack.HasCallStack, MonadIO m, IsGLTexture a) =>
a
-> m ()
gLTextureRelease :: a -> m ()
gLTextureRelease a
self = 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 GLTexture
self' <- a -> IO (Ptr GLTexture)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
Ptr GLTexture -> IO ()
gdk_gl_texture_release Ptr GLTexture
self'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data GLTextureReleaseMethodInfo
instance (signature ~ (m ()), MonadIO m, IsGLTexture a) => O.MethodInfo GLTextureReleaseMethodInfo a signature where
overloadedMethod = gLTextureRelease
#endif