{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- A GdkTexture representing a GL texture object.

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Gdk.Objects.GLTexture
    ( 

-- * Exported types
    GLTexture(..)                           ,
    IsGLTexture                             ,
    toGLTexture                             ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [computeConcreteSize]("GI.Gdk.Interfaces.Paintable#g:method:computeConcreteSize"), [download]("GI.Gdk.Objects.Texture#g:method:download"), [equal]("GI.Gio.Interfaces.Icon#g:method:equal"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [invalidateContents]("GI.Gdk.Interfaces.Paintable#g:method:invalidateContents"), [invalidateSize]("GI.Gdk.Interfaces.Paintable#g:method:invalidateSize"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [load]("GI.Gio.Interfaces.LoadableIcon#g:method:load"), [loadAsync]("GI.Gio.Interfaces.LoadableIcon#g:method:loadAsync"), [loadFinish]("GI.Gio.Interfaces.LoadableIcon#g:method:loadFinish"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [release]("GI.Gdk.Objects.GLTexture#g:method:release"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [saveToPng]("GI.Gdk.Objects.Texture#g:method:saveToPng"), [saveToPngBytes]("GI.Gdk.Objects.Texture#g:method:saveToPngBytes"), [saveToTiff]("GI.Gdk.Objects.Texture#g:method:saveToTiff"), [saveToTiffBytes]("GI.Gdk.Objects.Texture#g:method:saveToTiffBytes"), [serialize]("GI.Gio.Interfaces.Icon#g:method:serialize"), [snapshot]("GI.Gdk.Interfaces.Paintable#g:method:snapshot"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [toString]("GI.Gio.Interfaces.Icon#g:method:toString"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getCurrentImage]("GI.Gdk.Interfaces.Paintable#g:method:getCurrentImage"), [getData]("GI.GObject.Objects.Object#g:method:getData"), [getFlags]("GI.Gdk.Interfaces.Paintable#g:method:getFlags"), [getHeight]("GI.Gdk.Objects.Texture#g:method:getHeight"), [getIntrinsicAspectRatio]("GI.Gdk.Interfaces.Paintable#g:method:getIntrinsicAspectRatio"), [getIntrinsicHeight]("GI.Gdk.Interfaces.Paintable#g:method:getIntrinsicHeight"), [getIntrinsicWidth]("GI.Gdk.Interfaces.Paintable#g:method:getIntrinsicWidth"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getWidth]("GI.Gdk.Objects.Texture#g:method:getWidth").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveGLTextureMethod                  ,
#endif

-- ** new #method:new#

    gLTextureNew                            ,


-- ** release #method:release#

#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.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.GHashTable as B.GHT
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 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
import qualified GI.Gio.Interfaces.Icon as Gio.Icon
import qualified GI.Gio.Interfaces.LoadableIcon as Gio.LoadableIcon

-- | Memory-managed wrapper type.
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
$c== :: GLTexture -> GLTexture -> Bool
== :: GLTexture -> GLTexture -> Bool
$c/= :: GLTexture -> GLTexture -> Bool
/= :: 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

-- | Type class for types which can be safely cast to `GLTexture`, for instance with `toGLTexture`.
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, Gio.Icon.Icon, Gio.LoadableIcon.LoadableIcon]

-- | Cast to `GLTexture`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toGLTexture :: (MIO.MonadIO m, IsGLTexture o) => o -> m GLTexture
toGLTexture :: forall (m :: * -> *) o.
(MonadIO m, IsGLTexture o) =>
o -> m GLTexture
toGLTexture = IO GLTexture -> m GLTexture
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.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'
B.ManagedPtr.unsafeCastTo ManagedPtr GLTexture -> GLTexture
GLTexture

-- | Convert 'GLTexture' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe GLTexture) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gdk_gl_texture_get_type
    gvalueSet_ :: Ptr GValue -> Maybe GLTexture -> IO ()
gvalueSet_ Ptr GValue
gv Maybe GLTexture
P.Nothing = Ptr GValue -> Ptr GLTexture -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr GLTexture
forall a. Ptr a
FP.nullPtr :: FP.Ptr GLTexture)
    gvalueSet_ Ptr GValue
gv (P.Just GLTexture
obj) = GLTexture -> (Ptr GLTexture -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr GLTexture
obj (Ptr GValue -> Ptr GLTexture -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe GLTexture)
gvalueGet_ Ptr GValue
gv = do
        Ptr GLTexture
ptr <- Ptr GValue -> IO (Ptr GLTexture)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr GLTexture)
        if Ptr GLTexture
ptr Ptr GLTexture -> Ptr GLTexture -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr GLTexture
forall a. Ptr a
FP.nullPtr
        then GLTexture -> Maybe GLTexture
forall a. a -> Maybe a
P.Just (GLTexture -> Maybe GLTexture)
-> IO GLTexture -> IO (Maybe GLTexture)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (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
        else Maybe GLTexture -> IO (Maybe GLTexture)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe GLTexture
forall a. Maybe a
P.Nothing
        
    

#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 "equal" o = Gio.Icon.IconEqualMethodInfo
    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 "load" o = Gio.LoadableIcon.LoadableIconLoadMethodInfo
    ResolveGLTextureMethod "loadAsync" o = Gio.LoadableIcon.LoadableIconLoadAsyncMethodInfo
    ResolveGLTextureMethod "loadFinish" o = Gio.LoadableIcon.LoadableIconLoadFinishMethodInfo
    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 "saveToPngBytes" o = Gdk.Texture.TextureSaveToPngBytesMethodInfo
    ResolveGLTextureMethod "saveToTiff" o = Gdk.Texture.TextureSaveToTiffMethodInfo
    ResolveGLTextureMethod "saveToTiffBytes" o = Gdk.Texture.TextureSaveToTiffBytesMethodInfo
    ResolveGLTextureMethod "serialize" o = Gio.Icon.IconSerializeMethodInfo
    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 "toString" o = Gio.Icon.IconToStringMethodInfo
    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.OverloadedMethod 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

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveGLTextureMethod t GLTexture, O.OverloadedMethod info GLTexture p, R.HasField t GLTexture p) => R.HasField t GLTexture p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveGLTextureMethod t GLTexture, O.OverloadedMethodInfo info GLTexture) => OL.IsLabel t (O.MethodProxy info GLTexture) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#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

-- method GLTexture::new
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "context"
--           , argType =
--               TInterface Name { namespace = "Gdk" , name = "GLContext" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a `GdkGLContext`" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "id"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the ID of a texture that was created with @context"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "width"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the nominal width of the texture"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "height"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the nominal height of the texture"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "destroy"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "DestroyNotify" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a destroy notify that will be called when the GL resources\n  are released"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data that gets passed to @destroy"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gdk" , name = "GLTexture" })
-- throws : False
-- Skip return : False

foreign import ccall "gdk_gl_texture_new" gdk_gl_texture_new :: 
    Ptr Gdk.GLContext.GLContext ->          -- context : TInterface (Name {namespace = "Gdk", name = "GLContext"})
    Word32 ->                               -- id : TBasicType TUInt
    Int32 ->                                -- width : TBasicType TInt
    Int32 ->                                -- height : TBasicType TInt
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- destroy : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    Ptr () ->                               -- data : TBasicType TPtr
    IO (Ptr GLTexture)

-- | Creates a new texture for an existing GL texture.
-- 
-- Note that the GL texture must not be modified until /@destroy@/ is called,
-- which will happen when the GdkTexture object is finalized, or due to
-- an explicit call of 'GI.Gdk.Objects.GLTexture.gLTextureRelease'.
gLTextureNew ::
    (B.CallStack.HasCallStack, MonadIO m, Gdk.GLContext.IsGLContext a) =>
    a
    -- ^ /@context@/: a @GdkGLContext@
    -> Word32
    -- ^ /@id@/: the ID of a texture that was created with /@context@/
    -> Int32
    -- ^ /@width@/: the nominal width of the texture
    -> Int32
    -- ^ /@height@/: the nominal height of the texture
    -> GLib.Callbacks.DestroyNotify
    -- ^ /@destroy@/: a destroy notify that will be called when the GL resources
    --   are released
    -> Ptr ()
    -- ^ /@data@/: data that gets passed to /@destroy@/
    -> m GLTexture
    -- ^ __Returns:__ A newly-created
    --   @GdkTexture@
gLTextureNew :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsGLContext a) =>
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 a. IO a -> m a
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 a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return GLTexture
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method GLTexture::release
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Gdk" , name = "GLTexture" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a `GdkTexture` wrapping a GL texture"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gdk_gl_texture_release" gdk_gl_texture_release :: 
    Ptr GLTexture ->                        -- self : TInterface (Name {namespace = "Gdk", name = "GLTexture"})
    IO ()

-- | Releases the GL resources held by a @GdkGLTexture@.
-- 
-- The texture contents are still available via the
-- 'GI.Gdk.Objects.Texture.textureDownload' function, after this
-- function has been called.
gLTextureRelease ::
    (B.CallStack.HasCallStack, MonadIO m, IsGLTexture a) =>
    a
    -- ^ /@self@/: a @GdkTexture@ wrapping a GL texture
    -> m ()
gLTextureRelease :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsGLTexture a) =>
a -> m ()
gLTextureRelease a
self = IO () -> m ()
forall a. IO a -> m a
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 a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data GLTextureReleaseMethodInfo
instance (signature ~ (m ()), MonadIO m, IsGLTexture a) => O.OverloadedMethod GLTextureReleaseMethodInfo a signature where
    overloadedMethod = gLTextureRelease

instance O.OverloadedMethodInfo GLTextureReleaseMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gdk.Objects.GLTexture.gLTextureRelease",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.5/docs/GI-Gdk-Objects-GLTexture.html#v:gLTextureRelease"
        })


#endif