{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gdk.Objects.Texture
(
Texture(..) ,
IsTexture ,
toTexture ,
#if defined(ENABLE_OVERLOADING)
ResolveTextureMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
TextureDownloadMethodInfo ,
#endif
textureDownload ,
#if defined(ENABLE_OVERLOADING)
TextureGetFormatMethodInfo ,
#endif
textureGetFormat ,
#if defined(ENABLE_OVERLOADING)
TextureGetHeightMethodInfo ,
#endif
textureGetHeight ,
#if defined(ENABLE_OVERLOADING)
TextureGetWidthMethodInfo ,
#endif
textureGetWidth ,
textureNewForPixbuf ,
textureNewFromBytes ,
textureNewFromFile ,
textureNewFromFilename ,
textureNewFromResource ,
#if defined(ENABLE_OVERLOADING)
TextureSaveToPngMethodInfo ,
#endif
textureSaveToPng ,
#if defined(ENABLE_OVERLOADING)
TextureSaveToPngBytesMethodInfo ,
#endif
textureSaveToPngBytes ,
#if defined(ENABLE_OVERLOADING)
TextureSaveToTiffMethodInfo ,
#endif
textureSaveToTiff ,
#if defined(ENABLE_OVERLOADING)
TextureSaveToTiffBytesMethodInfo ,
#endif
textureSaveToTiffBytes ,
#if defined(ENABLE_OVERLOADING)
TextureHeightPropertyInfo ,
#endif
constructTextureHeight ,
getTextureHeight ,
#if defined(ENABLE_OVERLOADING)
textureHeight ,
#endif
#if defined(ENABLE_OVERLOADING)
TextureWidthPropertyInfo ,
#endif
constructTextureWidth ,
getTextureWidth ,
#if defined(ENABLE_OVERLOADING)
textureWidth ,
#endif
) 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 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 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
#endif
newtype Texture = Texture (SP.ManagedPtr Texture)
deriving (Texture -> Texture -> Bool
(Texture -> Texture -> Bool)
-> (Texture -> Texture -> Bool) -> Eq Texture
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Texture -> Texture -> Bool
== :: Texture -> Texture -> Bool
$c/= :: Texture -> Texture -> Bool
/= :: Texture -> Texture -> Bool
Eq)
instance SP.ManagedPtrNewtype Texture where
toManagedPtr :: Texture -> ManagedPtr Texture
toManagedPtr (Texture ManagedPtr Texture
p) = ManagedPtr Texture
p
foreign import ccall "gdk_texture_get_type"
c_gdk_texture_get_type :: IO B.Types.GType
instance B.Types.TypedObject Texture where
glibType :: IO GType
glibType = IO GType
c_gdk_texture_get_type
instance B.Types.GObject Texture
class (SP.GObject o, O.IsDescendantOf Texture o) => IsTexture o
instance (SP.GObject o, O.IsDescendantOf Texture o) => IsTexture o
instance O.HasParentTypes Texture
type instance O.ParentTypes Texture = '[GObject.Object.Object, Gdk.Paintable.Paintable, Gio.Icon.Icon, Gio.LoadableIcon.LoadableIcon]
toTexture :: (MIO.MonadIO m, IsTexture o) => o -> m Texture
toTexture :: forall (m :: * -> *) o. (MonadIO m, IsTexture o) => o -> m Texture
toTexture = IO Texture -> m Texture
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Texture -> m Texture) -> (o -> IO Texture) -> o -> m Texture
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Texture -> Texture) -> o -> IO Texture
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Texture -> Texture
Texture
instance B.GValue.IsGValue (Maybe Texture) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gdk_texture_get_type
gvalueSet_ :: Ptr GValue -> Maybe Texture -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Texture
P.Nothing = Ptr GValue -> Ptr Texture -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Texture
forall a. Ptr a
FP.nullPtr :: FP.Ptr Texture)
gvalueSet_ Ptr GValue
gv (P.Just Texture
obj) = Texture -> (Ptr Texture -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Texture
obj (Ptr GValue -> Ptr Texture -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Texture)
gvalueGet_ Ptr GValue
gv = do
ptr <- Ptr GValue -> IO (Ptr Texture)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Texture)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newObject Texture ptr
else return P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveTextureMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveTextureMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveTextureMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveTextureMethod "computeConcreteSize" o = Gdk.Paintable.PaintableComputeConcreteSizeMethodInfo
ResolveTextureMethod "download" o = TextureDownloadMethodInfo
ResolveTextureMethod "equal" o = Gio.Icon.IconEqualMethodInfo
ResolveTextureMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveTextureMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveTextureMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveTextureMethod "hash" o = Gio.Icon.IconHashMethodInfo
ResolveTextureMethod "invalidateContents" o = Gdk.Paintable.PaintableInvalidateContentsMethodInfo
ResolveTextureMethod "invalidateSize" o = Gdk.Paintable.PaintableInvalidateSizeMethodInfo
ResolveTextureMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveTextureMethod "load" o = Gio.LoadableIcon.LoadableIconLoadMethodInfo
ResolveTextureMethod "loadAsync" o = Gio.LoadableIcon.LoadableIconLoadAsyncMethodInfo
ResolveTextureMethod "loadFinish" o = Gio.LoadableIcon.LoadableIconLoadFinishMethodInfo
ResolveTextureMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveTextureMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveTextureMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveTextureMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveTextureMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveTextureMethod "saveToPng" o = TextureSaveToPngMethodInfo
ResolveTextureMethod "saveToPngBytes" o = TextureSaveToPngBytesMethodInfo
ResolveTextureMethod "saveToTiff" o = TextureSaveToTiffMethodInfo
ResolveTextureMethod "saveToTiffBytes" o = TextureSaveToTiffBytesMethodInfo
ResolveTextureMethod "serialize" o = Gio.Icon.IconSerializeMethodInfo
ResolveTextureMethod "snapshot" o = Gdk.Paintable.PaintableSnapshotMethodInfo
ResolveTextureMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveTextureMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveTextureMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveTextureMethod "toString" o = Gio.Icon.IconToStringMethodInfo
ResolveTextureMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveTextureMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveTextureMethod "getCurrentImage" o = Gdk.Paintable.PaintableGetCurrentImageMethodInfo
ResolveTextureMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveTextureMethod "getFlags" o = Gdk.Paintable.PaintableGetFlagsMethodInfo
ResolveTextureMethod "getFormat" o = TextureGetFormatMethodInfo
ResolveTextureMethod "getHeight" o = TextureGetHeightMethodInfo
ResolveTextureMethod "getIntrinsicAspectRatio" o = Gdk.Paintable.PaintableGetIntrinsicAspectRatioMethodInfo
ResolveTextureMethod "getIntrinsicHeight" o = Gdk.Paintable.PaintableGetIntrinsicHeightMethodInfo
ResolveTextureMethod "getIntrinsicWidth" o = Gdk.Paintable.PaintableGetIntrinsicWidthMethodInfo
ResolveTextureMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveTextureMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveTextureMethod "getWidth" o = TextureGetWidthMethodInfo
ResolveTextureMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveTextureMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveTextureMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveTextureMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveTextureMethod t Texture, O.OverloadedMethod info Texture p) => OL.IsLabel t (Texture -> 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 ~ ResolveTextureMethod t Texture, O.OverloadedMethod info Texture p, R.HasField t Texture p) => R.HasField t Texture p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveTextureMethod t Texture, O.OverloadedMethodInfo info Texture) => OL.IsLabel t (O.MethodProxy info Texture) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
getTextureHeight :: (MonadIO m, IsTexture o) => o -> m Int32
getTextureHeight :: forall (m :: * -> *) o. (MonadIO m, IsTexture o) => o -> m Int32
getTextureHeight o
obj = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Int32
forall a. GObject a => a -> String -> IO Int32
B.Properties.getObjectPropertyInt32 o
obj String
"height"
constructTextureHeight :: (IsTexture o, MIO.MonadIO m) => Int32 -> m (GValueConstruct o)
constructTextureHeight :: forall o (m :: * -> *).
(IsTexture o, MonadIO m) =>
Int32 -> m (GValueConstruct o)
constructTextureHeight Int32
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Int32 -> IO (GValueConstruct o)
forall o. String -> Int32 -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyInt32 String
"height" Int32
val
#if defined(ENABLE_OVERLOADING)
data TextureHeightPropertyInfo
instance AttrInfo TextureHeightPropertyInfo where
type AttrAllowedOps TextureHeightPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint TextureHeightPropertyInfo = IsTexture
type AttrSetTypeConstraint TextureHeightPropertyInfo = (~) Int32
type AttrTransferTypeConstraint TextureHeightPropertyInfo = (~) Int32
type AttrTransferType TextureHeightPropertyInfo = Int32
type AttrGetType TextureHeightPropertyInfo = Int32
type AttrLabel TextureHeightPropertyInfo = "height"
type AttrOrigin TextureHeightPropertyInfo = Texture
attrGet = getTextureHeight
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructTextureHeight
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Objects.Texture.height"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Objects-Texture.html#g:attr:height"
})
#endif
getTextureWidth :: (MonadIO m, IsTexture o) => o -> m Int32
getTextureWidth :: forall (m :: * -> *) o. (MonadIO m, IsTexture o) => o -> m Int32
getTextureWidth o
obj = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Int32
forall a. GObject a => a -> String -> IO Int32
B.Properties.getObjectPropertyInt32 o
obj String
"width"
constructTextureWidth :: (IsTexture o, MIO.MonadIO m) => Int32 -> m (GValueConstruct o)
constructTextureWidth :: forall o (m :: * -> *).
(IsTexture o, MonadIO m) =>
Int32 -> m (GValueConstruct o)
constructTextureWidth Int32
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Int32 -> IO (GValueConstruct o)
forall o. String -> Int32 -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyInt32 String
"width" Int32
val
#if defined(ENABLE_OVERLOADING)
data TextureWidthPropertyInfo
instance AttrInfo TextureWidthPropertyInfo where
type AttrAllowedOps TextureWidthPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint TextureWidthPropertyInfo = IsTexture
type AttrSetTypeConstraint TextureWidthPropertyInfo = (~) Int32
type AttrTransferTypeConstraint TextureWidthPropertyInfo = (~) Int32
type AttrTransferType TextureWidthPropertyInfo = Int32
type AttrGetType TextureWidthPropertyInfo = Int32
type AttrLabel TextureWidthPropertyInfo = "width"
type AttrOrigin TextureWidthPropertyInfo = Texture
attrGet = getTextureWidth
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructTextureWidth
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Objects.Texture.width"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Objects-Texture.html#g:attr:width"
})
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Texture
type instance O.AttributeList Texture = TextureAttributeList
type TextureAttributeList = ('[ '("height", TextureHeightPropertyInfo), '("width", TextureWidthPropertyInfo)] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
textureHeight :: AttrLabelProxy "height"
textureHeight = AttrLabelProxy
textureWidth :: AttrLabelProxy "width"
textureWidth = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Texture = TextureSignalList
type TextureSignalList = ('[ '("invalidateContents", Gdk.Paintable.PaintableInvalidateContentsSignalInfo), '("invalidateSize", Gdk.Paintable.PaintableInvalidateSizeSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "gdk_texture_new_for_pixbuf" gdk_texture_new_for_pixbuf ::
Ptr GdkPixbuf.Pixbuf.Pixbuf ->
IO (Ptr Texture)
textureNewForPixbuf ::
(B.CallStack.HasCallStack, MonadIO m, GdkPixbuf.Pixbuf.IsPixbuf a) =>
a
-> m Texture
textureNewForPixbuf :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsPixbuf a) =>
a -> m Texture
textureNewForPixbuf a
pixbuf = IO Texture -> m Texture
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Texture -> m Texture) -> IO Texture -> m Texture
forall a b. (a -> b) -> a -> b
$ do
pixbuf' <- a -> IO (Ptr Pixbuf)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pixbuf
result <- gdk_texture_new_for_pixbuf pixbuf'
checkUnexpectedReturnNULL "textureNewForPixbuf" result
result' <- (wrapObject Texture) result
touchManagedPtr pixbuf
return result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gdk_texture_new_from_bytes" gdk_texture_new_from_bytes ::
Ptr GLib.Bytes.Bytes ->
Ptr (Ptr GError) ->
IO (Ptr Texture)
textureNewFromBytes ::
(B.CallStack.HasCallStack, MonadIO m) =>
GLib.Bytes.Bytes
-> m Texture
textureNewFromBytes :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Bytes -> m Texture
textureNewFromBytes Bytes
bytes = IO Texture -> m Texture
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Texture -> m Texture) -> IO Texture -> m Texture
forall a b. (a -> b) -> a -> b
$ do
bytes' <- Bytes -> IO (Ptr Bytes)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Bytes
bytes
onException (do
result <- propagateGError $ gdk_texture_new_from_bytes bytes'
checkUnexpectedReturnNULL "textureNewFromBytes" result
result' <- (wrapObject Texture) result
touchManagedPtr bytes
return result'
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gdk_texture_new_from_file" gdk_texture_new_from_file ::
Ptr Gio.File.File ->
Ptr (Ptr GError) ->
IO (Ptr Texture)
textureNewFromFile ::
(B.CallStack.HasCallStack, MonadIO m, Gio.File.IsFile a) =>
a
-> m Texture
textureNewFromFile :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFile a) =>
a -> m Texture
textureNewFromFile a
file = IO Texture -> m Texture
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Texture -> m Texture) -> IO Texture -> m Texture
forall a b. (a -> b) -> a -> b
$ do
file' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
file
onException (do
result <- propagateGError $ gdk_texture_new_from_file file'
checkUnexpectedReturnNULL "textureNewFromFile" result
result' <- (wrapObject Texture) result
touchManagedPtr file
return result'
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gdk_texture_new_from_filename" gdk_texture_new_from_filename ::
CString ->
Ptr (Ptr GError) ->
IO (Ptr Texture)
textureNewFromFilename ::
(B.CallStack.HasCallStack, MonadIO m) =>
[Char]
-> m Texture
textureNewFromFilename :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
String -> m Texture
textureNewFromFilename String
path = IO Texture -> m Texture
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Texture -> m Texture) -> IO Texture -> m Texture
forall a b. (a -> b) -> a -> b
$ do
path' <- String -> IO CString
stringToCString String
path
onException (do
result <- propagateGError $ gdk_texture_new_from_filename path'
checkUnexpectedReturnNULL "textureNewFromFilename" result
result' <- (wrapObject Texture) result
freeMem path'
return result'
) (do
freeMem path'
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gdk_texture_new_from_resource" gdk_texture_new_from_resource ::
CString ->
IO (Ptr Texture)
textureNewFromResource ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m Texture
textureNewFromResource :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> m Texture
textureNewFromResource Text
resourcePath = IO Texture -> m Texture
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Texture -> m Texture) -> IO Texture -> m Texture
forall a b. (a -> b) -> a -> b
$ do
resourcePath' <- Text -> IO CString
textToCString Text
resourcePath
result <- gdk_texture_new_from_resource resourcePath'
checkUnexpectedReturnNULL "textureNewFromResource" result
result' <- (wrapObject Texture) result
freeMem resourcePath'
return result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gdk_texture_download" gdk_texture_download ::
Ptr Texture ->
Ptr Word8 ->
FCT.CSize ->
IO ()
textureDownload ::
(B.CallStack.HasCallStack, MonadIO m, IsTexture a) =>
a
-> Ptr Word8
-> FCT.CSize
-> m ()
textureDownload :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsTexture a) =>
a -> Ptr Word8 -> CSize -> m ()
textureDownload a
texture Ptr Word8
data_ CSize
stride = 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
texture' <- a -> IO (Ptr Texture)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
texture
gdk_texture_download texture' data_ stride
touchManagedPtr texture
return ()
#if defined(ENABLE_OVERLOADING)
data TextureDownloadMethodInfo
instance (signature ~ (Ptr Word8 -> FCT.CSize -> m ()), MonadIO m, IsTexture a) => O.OverloadedMethod TextureDownloadMethodInfo a signature where
overloadedMethod = textureDownload
instance O.OverloadedMethodInfo TextureDownloadMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Objects.Texture.textureDownload",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Objects-Texture.html#v:textureDownload"
})
#endif
foreign import ccall "gdk_texture_get_format" gdk_texture_get_format ::
Ptr Texture ->
IO CUInt
textureGetFormat ::
(B.CallStack.HasCallStack, MonadIO m, IsTexture a) =>
a
-> m Gdk.Enums.MemoryFormat
textureGetFormat :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsTexture a) =>
a -> m MemoryFormat
textureGetFormat a
self = IO MemoryFormat -> m MemoryFormat
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MemoryFormat -> m MemoryFormat)
-> IO MemoryFormat -> m MemoryFormat
forall a b. (a -> b) -> a -> b
$ do
self' <- a -> IO (Ptr Texture)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
result <- gdk_texture_get_format self'
let result' = (Int -> MemoryFormat
forall a. Enum a => Int -> a
toEnum (Int -> MemoryFormat) -> (CUInt -> Int) -> CUInt -> MemoryFormat
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
touchManagedPtr self
return result'
#if defined(ENABLE_OVERLOADING)
data TextureGetFormatMethodInfo
instance (signature ~ (m Gdk.Enums.MemoryFormat), MonadIO m, IsTexture a) => O.OverloadedMethod TextureGetFormatMethodInfo a signature where
overloadedMethod = textureGetFormat
instance O.OverloadedMethodInfo TextureGetFormatMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Objects.Texture.textureGetFormat",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Objects-Texture.html#v:textureGetFormat"
})
#endif
foreign import ccall "gdk_texture_get_height" gdk_texture_get_height ::
Ptr Texture ->
IO Int32
textureGetHeight ::
(B.CallStack.HasCallStack, MonadIO m, IsTexture a) =>
a
-> m Int32
textureGetHeight :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsTexture a) =>
a -> m Int32
textureGetHeight a
texture = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
texture' <- a -> IO (Ptr Texture)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
texture
result <- gdk_texture_get_height texture'
touchManagedPtr texture
return result
#if defined(ENABLE_OVERLOADING)
data TextureGetHeightMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsTexture a) => O.OverloadedMethod TextureGetHeightMethodInfo a signature where
overloadedMethod = textureGetHeight
instance O.OverloadedMethodInfo TextureGetHeightMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Objects.Texture.textureGetHeight",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Objects-Texture.html#v:textureGetHeight"
})
#endif
foreign import ccall "gdk_texture_get_width" gdk_texture_get_width ::
Ptr Texture ->
IO Int32
textureGetWidth ::
(B.CallStack.HasCallStack, MonadIO m, IsTexture a) =>
a
-> m Int32
textureGetWidth :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsTexture a) =>
a -> m Int32
textureGetWidth a
texture = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
texture' <- a -> IO (Ptr Texture)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
texture
result <- gdk_texture_get_width texture'
touchManagedPtr texture
return result
#if defined(ENABLE_OVERLOADING)
data TextureGetWidthMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsTexture a) => O.OverloadedMethod TextureGetWidthMethodInfo a signature where
overloadedMethod = textureGetWidth
instance O.OverloadedMethodInfo TextureGetWidthMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Objects.Texture.textureGetWidth",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Objects-Texture.html#v:textureGetWidth"
})
#endif
foreign import ccall "gdk_texture_save_to_png" gdk_texture_save_to_png ::
Ptr Texture ->
CString ->
IO CInt
textureSaveToPng ::
(B.CallStack.HasCallStack, MonadIO m, IsTexture a) =>
a
-> [Char]
-> m Bool
textureSaveToPng :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsTexture a) =>
a -> String -> m Bool
textureSaveToPng a
texture String
filename = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
texture' <- a -> IO (Ptr Texture)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
texture
filename' <- stringToCString filename
result <- gdk_texture_save_to_png texture' filename'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr texture
freeMem filename'
return result'
#if defined(ENABLE_OVERLOADING)
data TextureSaveToPngMethodInfo
instance (signature ~ ([Char] -> m Bool), MonadIO m, IsTexture a) => O.OverloadedMethod TextureSaveToPngMethodInfo a signature where
overloadedMethod = textureSaveToPng
instance O.OverloadedMethodInfo TextureSaveToPngMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Objects.Texture.textureSaveToPng",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Objects-Texture.html#v:textureSaveToPng"
})
#endif
foreign import ccall "gdk_texture_save_to_png_bytes" gdk_texture_save_to_png_bytes ::
Ptr Texture ->
IO (Ptr GLib.Bytes.Bytes)
textureSaveToPngBytes ::
(B.CallStack.HasCallStack, MonadIO m, IsTexture a) =>
a
-> m GLib.Bytes.Bytes
textureSaveToPngBytes :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsTexture a) =>
a -> m Bytes
textureSaveToPngBytes a
texture = IO Bytes -> m Bytes
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bytes -> m Bytes) -> IO Bytes -> m Bytes
forall a b. (a -> b) -> a -> b
$ do
texture' <- a -> IO (Ptr Texture)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
texture
result <- gdk_texture_save_to_png_bytes texture'
checkUnexpectedReturnNULL "textureSaveToPngBytes" result
result' <- (wrapBoxed GLib.Bytes.Bytes) result
touchManagedPtr texture
return result'
#if defined(ENABLE_OVERLOADING)
data TextureSaveToPngBytesMethodInfo
instance (signature ~ (m GLib.Bytes.Bytes), MonadIO m, IsTexture a) => O.OverloadedMethod TextureSaveToPngBytesMethodInfo a signature where
overloadedMethod = textureSaveToPngBytes
instance O.OverloadedMethodInfo TextureSaveToPngBytesMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Objects.Texture.textureSaveToPngBytes",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Objects-Texture.html#v:textureSaveToPngBytes"
})
#endif
foreign import ccall "gdk_texture_save_to_tiff" gdk_texture_save_to_tiff ::
Ptr Texture ->
CString ->
IO CInt
textureSaveToTiff ::
(B.CallStack.HasCallStack, MonadIO m, IsTexture a) =>
a
-> [Char]
-> m Bool
textureSaveToTiff :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsTexture a) =>
a -> String -> m Bool
textureSaveToTiff a
texture String
filename = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
texture' <- a -> IO (Ptr Texture)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
texture
filename' <- stringToCString filename
result <- gdk_texture_save_to_tiff texture' filename'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr texture
freeMem filename'
return result'
#if defined(ENABLE_OVERLOADING)
data TextureSaveToTiffMethodInfo
instance (signature ~ ([Char] -> m Bool), MonadIO m, IsTexture a) => O.OverloadedMethod TextureSaveToTiffMethodInfo a signature where
overloadedMethod = textureSaveToTiff
instance O.OverloadedMethodInfo TextureSaveToTiffMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Objects.Texture.textureSaveToTiff",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Objects-Texture.html#v:textureSaveToTiff"
})
#endif
foreign import ccall "gdk_texture_save_to_tiff_bytes" gdk_texture_save_to_tiff_bytes ::
Ptr Texture ->
IO (Ptr GLib.Bytes.Bytes)
textureSaveToTiffBytes ::
(B.CallStack.HasCallStack, MonadIO m, IsTexture a) =>
a
-> m GLib.Bytes.Bytes
textureSaveToTiffBytes :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsTexture a) =>
a -> m Bytes
textureSaveToTiffBytes a
texture = IO Bytes -> m Bytes
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bytes -> m Bytes) -> IO Bytes -> m Bytes
forall a b. (a -> b) -> a -> b
$ do
texture' <- a -> IO (Ptr Texture)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
texture
result <- gdk_texture_save_to_tiff_bytes texture'
checkUnexpectedReturnNULL "textureSaveToTiffBytes" result
result' <- (wrapBoxed GLib.Bytes.Bytes) result
touchManagedPtr texture
return result'
#if defined(ENABLE_OVERLOADING)
data TextureSaveToTiffBytesMethodInfo
instance (signature ~ (m GLib.Bytes.Bytes), MonadIO m, IsTexture a) => O.OverloadedMethod TextureSaveToTiffBytesMethodInfo a signature where
overloadedMethod = textureSaveToTiffBytes
instance O.OverloadedMethodInfo TextureSaveToTiffBytesMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Objects.Texture.textureSaveToTiffBytes",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Objects-Texture.html#v:textureSaveToTiffBytes"
})
#endif