{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gdk.Objects.MemoryTexture
(
MemoryTexture(..) ,
IsMemoryTexture ,
toMemoryTexture ,
#if defined(ENABLE_OVERLOADING)
ResolveMemoryTextureMethod ,
#endif
memoryTextureNew ,
) 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.Kind as DK
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 Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gdk.Enums as Gdk.Enums
import {-# SOURCE #-} qualified GI.Gdk.Flags as Gdk.Flags
import {-# SOURCE #-} qualified GI.Gdk.Interfaces.Paintable as Gdk.Paintable
import {-# SOURCE #-} qualified GI.Gdk.Objects.Snapshot as Gdk.Snapshot
import {-# SOURCE #-} qualified GI.Gdk.Objects.Texture as Gdk.Texture
import qualified GI.GdkPixbuf.Objects.Pixbuf as GdkPixbuf.Pixbuf
import qualified GI.Gio.Interfaces.File as Gio.File
import qualified GI.Gio.Interfaces.Icon as Gio.Icon
import qualified GI.Gio.Interfaces.LoadableIcon as Gio.LoadableIcon
#else
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gdk.Enums as Gdk.Enums
import {-# SOURCE #-} qualified GI.Gdk.Interfaces.Paintable as Gdk.Paintable
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
#endif
newtype MemoryTexture = MemoryTexture (SP.ManagedPtr MemoryTexture)
deriving (MemoryTexture -> MemoryTexture -> Bool
(MemoryTexture -> MemoryTexture -> Bool)
-> (MemoryTexture -> MemoryTexture -> Bool) -> Eq MemoryTexture
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MemoryTexture -> MemoryTexture -> Bool
== :: MemoryTexture -> MemoryTexture -> Bool
$c/= :: MemoryTexture -> MemoryTexture -> Bool
/= :: MemoryTexture -> MemoryTexture -> Bool
Eq)
instance SP.ManagedPtrNewtype MemoryTexture where
toManagedPtr :: MemoryTexture -> ManagedPtr MemoryTexture
toManagedPtr (MemoryTexture ManagedPtr MemoryTexture
p) = ManagedPtr MemoryTexture
p
foreign import ccall "gdk_memory_texture_get_type"
c_gdk_memory_texture_get_type :: IO B.Types.GType
instance B.Types.TypedObject MemoryTexture where
glibType :: IO GType
glibType = IO GType
c_gdk_memory_texture_get_type
instance B.Types.GObject MemoryTexture
class (SP.GObject o, O.IsDescendantOf MemoryTexture o) => IsMemoryTexture o
instance (SP.GObject o, O.IsDescendantOf MemoryTexture o) => IsMemoryTexture o
instance O.HasParentTypes MemoryTexture
type instance O.ParentTypes MemoryTexture = '[Gdk.Texture.Texture, GObject.Object.Object, Gdk.Paintable.Paintable, Gio.Icon.Icon, Gio.LoadableIcon.LoadableIcon]
toMemoryTexture :: (MIO.MonadIO m, IsMemoryTexture o) => o -> m MemoryTexture
toMemoryTexture :: forall (m :: * -> *) o.
(MonadIO m, IsMemoryTexture o) =>
o -> m MemoryTexture
toMemoryTexture = IO MemoryTexture -> m MemoryTexture
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO MemoryTexture -> m MemoryTexture)
-> (o -> IO MemoryTexture) -> o -> m MemoryTexture
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr MemoryTexture -> MemoryTexture)
-> o -> IO MemoryTexture
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr MemoryTexture -> MemoryTexture
MemoryTexture
instance B.GValue.IsGValue (Maybe MemoryTexture) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gdk_memory_texture_get_type
gvalueSet_ :: Ptr GValue -> Maybe MemoryTexture -> IO ()
gvalueSet_ Ptr GValue
gv Maybe MemoryTexture
P.Nothing = Ptr GValue -> Ptr MemoryTexture -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr MemoryTexture
forall a. Ptr a
FP.nullPtr :: FP.Ptr MemoryTexture)
gvalueSet_ Ptr GValue
gv (P.Just MemoryTexture
obj) = MemoryTexture -> (Ptr MemoryTexture -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr MemoryTexture
obj (Ptr GValue -> Ptr MemoryTexture -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe MemoryTexture)
gvalueGet_ Ptr GValue
gv = do
ptr <- Ptr GValue -> IO (Ptr MemoryTexture)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr MemoryTexture)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newObject MemoryTexture ptr
else return P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveMemoryTextureMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveMemoryTextureMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveMemoryTextureMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveMemoryTextureMethod "computeConcreteSize" o = Gdk.Paintable.PaintableComputeConcreteSizeMethodInfo
ResolveMemoryTextureMethod "download" o = Gdk.Texture.TextureDownloadMethodInfo
ResolveMemoryTextureMethod "equal" o = Gio.Icon.IconEqualMethodInfo
ResolveMemoryTextureMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveMemoryTextureMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveMemoryTextureMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveMemoryTextureMethod "hash" o = Gio.Icon.IconHashMethodInfo
ResolveMemoryTextureMethod "invalidateContents" o = Gdk.Paintable.PaintableInvalidateContentsMethodInfo
ResolveMemoryTextureMethod "invalidateSize" o = Gdk.Paintable.PaintableInvalidateSizeMethodInfo
ResolveMemoryTextureMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveMemoryTextureMethod "load" o = Gio.LoadableIcon.LoadableIconLoadMethodInfo
ResolveMemoryTextureMethod "loadAsync" o = Gio.LoadableIcon.LoadableIconLoadAsyncMethodInfo
ResolveMemoryTextureMethod "loadFinish" o = Gio.LoadableIcon.LoadableIconLoadFinishMethodInfo
ResolveMemoryTextureMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveMemoryTextureMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveMemoryTextureMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveMemoryTextureMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveMemoryTextureMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveMemoryTextureMethod "saveToPng" o = Gdk.Texture.TextureSaveToPngMethodInfo
ResolveMemoryTextureMethod "saveToPngBytes" o = Gdk.Texture.TextureSaveToPngBytesMethodInfo
ResolveMemoryTextureMethod "saveToTiff" o = Gdk.Texture.TextureSaveToTiffMethodInfo
ResolveMemoryTextureMethod "saveToTiffBytes" o = Gdk.Texture.TextureSaveToTiffBytesMethodInfo
ResolveMemoryTextureMethod "serialize" o = Gio.Icon.IconSerializeMethodInfo
ResolveMemoryTextureMethod "snapshot" o = Gdk.Paintable.PaintableSnapshotMethodInfo
ResolveMemoryTextureMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveMemoryTextureMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveMemoryTextureMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveMemoryTextureMethod "toString" o = Gio.Icon.IconToStringMethodInfo
ResolveMemoryTextureMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveMemoryTextureMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveMemoryTextureMethod "getCurrentImage" o = Gdk.Paintable.PaintableGetCurrentImageMethodInfo
ResolveMemoryTextureMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveMemoryTextureMethod "getFlags" o = Gdk.Paintable.PaintableGetFlagsMethodInfo
ResolveMemoryTextureMethod "getFormat" o = Gdk.Texture.TextureGetFormatMethodInfo
ResolveMemoryTextureMethod "getHeight" o = Gdk.Texture.TextureGetHeightMethodInfo
ResolveMemoryTextureMethod "getIntrinsicAspectRatio" o = Gdk.Paintable.PaintableGetIntrinsicAspectRatioMethodInfo
ResolveMemoryTextureMethod "getIntrinsicHeight" o = Gdk.Paintable.PaintableGetIntrinsicHeightMethodInfo
ResolveMemoryTextureMethod "getIntrinsicWidth" o = Gdk.Paintable.PaintableGetIntrinsicWidthMethodInfo
ResolveMemoryTextureMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveMemoryTextureMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveMemoryTextureMethod "getWidth" o = Gdk.Texture.TextureGetWidthMethodInfo
ResolveMemoryTextureMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveMemoryTextureMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveMemoryTextureMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveMemoryTextureMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveMemoryTextureMethod t MemoryTexture, O.OverloadedMethod info MemoryTexture p) => OL.IsLabel t (MemoryTexture -> 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 ~ ResolveMemoryTextureMethod t MemoryTexture, O.OverloadedMethod info MemoryTexture p, R.HasField t MemoryTexture p) => R.HasField t MemoryTexture p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveMemoryTextureMethod t MemoryTexture, O.OverloadedMethodInfo info MemoryTexture) => OL.IsLabel t (O.MethodProxy info MemoryTexture) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList MemoryTexture
type instance O.AttributeList MemoryTexture = MemoryTextureAttributeList
type MemoryTextureAttributeList = ('[ '("height", Gdk.Texture.TextureHeightPropertyInfo), '("width", Gdk.Texture.TextureWidthPropertyInfo)] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList MemoryTexture = MemoryTextureSignalList
type MemoryTextureSignalList = ('[ '("invalidateContents", Gdk.Paintable.PaintableInvalidateContentsSignalInfo), '("invalidateSize", Gdk.Paintable.PaintableInvalidateSizeSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "gdk_memory_texture_new" gdk_memory_texture_new ::
Int32 ->
Int32 ->
CUInt ->
Ptr GLib.Bytes.Bytes ->
FCT.CSize ->
IO (Ptr MemoryTexture)
memoryTextureNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
Int32
-> Int32
-> Gdk.Enums.MemoryFormat
-> GLib.Bytes.Bytes
-> FCT.CSize
-> m MemoryTexture
memoryTextureNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Int32 -> Int32 -> MemoryFormat -> Bytes -> CSize -> m MemoryTexture
memoryTextureNew Int32
width Int32
height MemoryFormat
format Bytes
bytes CSize
stride = IO MemoryTexture -> m MemoryTexture
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MemoryTexture -> m MemoryTexture)
-> IO MemoryTexture -> m MemoryTexture
forall a b. (a -> b) -> a -> b
$ do
let format' :: CUInt
format' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (MemoryFormat -> Int) -> MemoryFormat -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MemoryFormat -> Int
forall a. Enum a => a -> Int
fromEnum) MemoryFormat
format
bytes' <- Bytes -> IO (Ptr Bytes)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Bytes
bytes
result <- gdk_memory_texture_new width height format' bytes' stride
checkUnexpectedReturnNULL "memoryTextureNew" result
result' <- (wrapObject MemoryTexture) result
touchManagedPtr bytes
return result'
#if defined(ENABLE_OVERLOADING)
#endif