{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gsk.Objects.TextureScaleNode
(
TextureScaleNode(..) ,
IsTextureScaleNode ,
toTextureScaleNode ,
#if defined(ENABLE_OVERLOADING)
ResolveTextureScaleNodeMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
TextureScaleNodeGetFilterMethodInfo ,
#endif
textureScaleNodeGetFilter ,
#if defined(ENABLE_OVERLOADING)
TextureScaleNodeGetTextureMethodInfo ,
#endif
textureScaleNodeGetTexture ,
textureScaleNodeNew ,
) 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 GI.Gdk.Objects.Texture as Gdk.Texture
import qualified GI.Graphene.Structs.Rect as Graphene.Rect
import {-# SOURCE #-} qualified GI.Gsk.Enums as Gsk.Enums
import {-# SOURCE #-} qualified GI.Gsk.Objects.RenderNode as Gsk.RenderNode
newtype TextureScaleNode = TextureScaleNode (SP.ManagedPtr TextureScaleNode)
deriving (TextureScaleNode -> TextureScaleNode -> Bool
(TextureScaleNode -> TextureScaleNode -> Bool)
-> (TextureScaleNode -> TextureScaleNode -> Bool)
-> Eq TextureScaleNode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TextureScaleNode -> TextureScaleNode -> Bool
== :: TextureScaleNode -> TextureScaleNode -> Bool
$c/= :: TextureScaleNode -> TextureScaleNode -> Bool
/= :: TextureScaleNode -> TextureScaleNode -> Bool
Eq)
instance SP.ManagedPtrNewtype TextureScaleNode where
toManagedPtr :: TextureScaleNode -> ManagedPtr TextureScaleNode
toManagedPtr (TextureScaleNode ManagedPtr TextureScaleNode
p) = ManagedPtr TextureScaleNode
p
foreign import ccall "gsk_texture_scale_node_get_type"
c_gsk_texture_scale_node_get_type :: IO B.Types.GType
instance B.Types.TypedObject TextureScaleNode where
glibType :: IO GType
glibType = IO GType
c_gsk_texture_scale_node_get_type
class (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf TextureScaleNode o) => IsTextureScaleNode o
instance (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf TextureScaleNode o) => IsTextureScaleNode o
instance O.HasParentTypes TextureScaleNode
type instance O.ParentTypes TextureScaleNode = '[Gsk.RenderNode.RenderNode]
toTextureScaleNode :: (MIO.MonadIO m, IsTextureScaleNode o) => o -> m TextureScaleNode
toTextureScaleNode :: forall (m :: * -> *) o.
(MonadIO m, IsTextureScaleNode o) =>
o -> m TextureScaleNode
toTextureScaleNode = IO TextureScaleNode -> m TextureScaleNode
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO TextureScaleNode -> m TextureScaleNode)
-> (o -> IO TextureScaleNode) -> o -> m TextureScaleNode
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr TextureScaleNode -> TextureScaleNode)
-> o -> IO TextureScaleNode
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr TextureScaleNode -> TextureScaleNode
TextureScaleNode
#if defined(ENABLE_OVERLOADING)
type family ResolveTextureScaleNodeMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveTextureScaleNodeMethod "draw" o = Gsk.RenderNode.RenderNodeDrawMethodInfo
ResolveTextureScaleNodeMethod "ref" o = Gsk.RenderNode.RenderNodeRefMethodInfo
ResolveTextureScaleNodeMethod "serialize" o = Gsk.RenderNode.RenderNodeSerializeMethodInfo
ResolveTextureScaleNodeMethod "unref" o = Gsk.RenderNode.RenderNodeUnrefMethodInfo
ResolveTextureScaleNodeMethod "writeToFile" o = Gsk.RenderNode.RenderNodeWriteToFileMethodInfo
ResolveTextureScaleNodeMethod "getBounds" o = Gsk.RenderNode.RenderNodeGetBoundsMethodInfo
ResolveTextureScaleNodeMethod "getFilter" o = TextureScaleNodeGetFilterMethodInfo
ResolveTextureScaleNodeMethod "getNodeType" o = Gsk.RenderNode.RenderNodeGetNodeTypeMethodInfo
ResolveTextureScaleNodeMethod "getTexture" o = TextureScaleNodeGetTextureMethodInfo
ResolveTextureScaleNodeMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveTextureScaleNodeMethod t TextureScaleNode, O.OverloadedMethod info TextureScaleNode p) => OL.IsLabel t (TextureScaleNode -> 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 ~ ResolveTextureScaleNodeMethod t TextureScaleNode, O.OverloadedMethod info TextureScaleNode p, R.HasField t TextureScaleNode p) => R.HasField t TextureScaleNode p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveTextureScaleNodeMethod t TextureScaleNode, O.OverloadedMethodInfo info TextureScaleNode) => OL.IsLabel t (O.MethodProxy info TextureScaleNode) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
instance BoxedPtr TextureScaleNode where
boxedPtrCopy :: TextureScaleNode -> IO TextureScaleNode
boxedPtrCopy = TextureScaleNode -> IO TextureScaleNode
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return
boxedPtrFree :: TextureScaleNode -> IO ()
boxedPtrFree = \TextureScaleNode
_x -> () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
foreign import ccall "gsk_texture_scale_node_new" gsk_texture_scale_node_new ::
Ptr Gdk.Texture.Texture ->
Ptr Graphene.Rect.Rect ->
CUInt ->
IO (Ptr TextureScaleNode)
textureScaleNodeNew ::
(B.CallStack.HasCallStack, MonadIO m, Gdk.Texture.IsTexture a) =>
a
-> Graphene.Rect.Rect
-> Gsk.Enums.ScalingFilter
-> m TextureScaleNode
textureScaleNodeNew :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsTexture a) =>
a -> Rect -> ScalingFilter -> m TextureScaleNode
textureScaleNodeNew a
texture Rect
bounds ScalingFilter
filter = IO TextureScaleNode -> m TextureScaleNode
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TextureScaleNode -> m TextureScaleNode)
-> IO TextureScaleNode -> m TextureScaleNode
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 Rect
bounds' <- Rect -> IO (Ptr Rect)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Rect
bounds
let filter' :: CUInt
filter' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (ScalingFilter -> Int) -> ScalingFilter -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ScalingFilter -> Int
forall a. Enum a => a -> Int
fromEnum) ScalingFilter
filter
Ptr TextureScaleNode
result <- Ptr Texture -> Ptr Rect -> CUInt -> IO (Ptr TextureScaleNode)
gsk_texture_scale_node_new Ptr Texture
texture' Ptr Rect
bounds' CUInt
filter'
Text -> Ptr TextureScaleNode -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"textureScaleNodeNew" Ptr TextureScaleNode
result
TextureScaleNode
result' <- ((ManagedPtr TextureScaleNode -> TextureScaleNode)
-> Ptr TextureScaleNode -> IO TextureScaleNode
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr TextureScaleNode -> TextureScaleNode
TextureScaleNode) Ptr TextureScaleNode
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
texture
Rect -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Rect
bounds
TextureScaleNode -> IO TextureScaleNode
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return TextureScaleNode
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gsk_texture_scale_node_get_filter" gsk_texture_scale_node_get_filter ::
Ptr TextureScaleNode ->
IO CUInt
textureScaleNodeGetFilter ::
(B.CallStack.HasCallStack, MonadIO m, IsTextureScaleNode a) =>
a
-> m Gsk.Enums.ScalingFilter
textureScaleNodeGetFilter :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsTextureScaleNode a) =>
a -> m ScalingFilter
textureScaleNodeGetFilter a
node = IO ScalingFilter -> m ScalingFilter
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ScalingFilter -> m ScalingFilter)
-> IO ScalingFilter -> m ScalingFilter
forall a b. (a -> b) -> a -> b
$ do
Ptr TextureScaleNode
node' <- a -> IO (Ptr TextureScaleNode)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
node
CUInt
result <- Ptr TextureScaleNode -> IO CUInt
gsk_texture_scale_node_get_filter Ptr TextureScaleNode
node'
let result' :: ScalingFilter
result' = (Int -> ScalingFilter
forall a. Enum a => Int -> a
toEnum (Int -> ScalingFilter) -> (CUInt -> Int) -> CUInt -> ScalingFilter
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
node
ScalingFilter -> IO ScalingFilter
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ScalingFilter
result'
#if defined(ENABLE_OVERLOADING)
data TextureScaleNodeGetFilterMethodInfo
instance (signature ~ (m Gsk.Enums.ScalingFilter), MonadIO m, IsTextureScaleNode a) => O.OverloadedMethod TextureScaleNodeGetFilterMethodInfo a signature where
overloadedMethod = textureScaleNodeGetFilter
instance O.OverloadedMethodInfo TextureScaleNodeGetFilterMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gsk.Objects.TextureScaleNode.textureScaleNodeGetFilter",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gsk-4.0.7/docs/GI-Gsk-Objects-TextureScaleNode.html#v:textureScaleNodeGetFilter"
})
#endif
foreign import ccall "gsk_texture_scale_node_get_texture" gsk_texture_scale_node_get_texture ::
Ptr TextureScaleNode ->
IO (Ptr Gdk.Texture.Texture)
textureScaleNodeGetTexture ::
(B.CallStack.HasCallStack, MonadIO m, IsTextureScaleNode a) =>
a
-> m Gdk.Texture.Texture
textureScaleNodeGetTexture :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsTextureScaleNode a) =>
a -> m Texture
textureScaleNodeGetTexture a
node = 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
Ptr TextureScaleNode
node' <- a -> IO (Ptr TextureScaleNode)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
node
Ptr Texture
result <- Ptr TextureScaleNode -> IO (Ptr Texture)
gsk_texture_scale_node_get_texture Ptr TextureScaleNode
node'
Text -> Ptr Texture -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"textureScaleNodeGetTexture" Ptr Texture
result
Texture
result' <- ((ManagedPtr Texture -> Texture) -> Ptr Texture -> IO Texture
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Texture -> Texture
Gdk.Texture.Texture) Ptr Texture
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
node
Texture -> IO Texture
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Texture
result'
#if defined(ENABLE_OVERLOADING)
data TextureScaleNodeGetTextureMethodInfo
instance (signature ~ (m Gdk.Texture.Texture), MonadIO m, IsTextureScaleNode a) => O.OverloadedMethod TextureScaleNodeGetTextureMethodInfo a signature where
overloadedMethod = textureScaleNodeGetTexture
instance O.OverloadedMethodInfo TextureScaleNodeGetTextureMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gsk.Objects.TextureScaleNode.textureScaleNodeGetTexture",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gsk-4.0.7/docs/GI-Gsk-Objects-TextureScaleNode.html#v:textureScaleNodeGetTexture"
})
#endif