{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Clutter.Objects.TextureNode
(
TextureNode(..) ,
IsTextureNode ,
toTextureNode ,
#if defined(ENABLE_OVERLOADING)
ResolveTextureNodeMethod ,
#endif
textureNodeNew ,
) 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.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 {-# SOURCE #-} qualified GI.Clutter.Enums as Clutter.Enums
import {-# SOURCE #-} qualified GI.Clutter.Objects.PaintNode as Clutter.PaintNode
import {-# SOURCE #-} qualified GI.Clutter.Objects.PipelineNode as Clutter.PipelineNode
import {-# SOURCE #-} qualified GI.Clutter.Structs.Color as Clutter.Color
import qualified GI.Cogl.Interfaces.Texture as Cogl.Texture
newtype TextureNode = TextureNode (SP.ManagedPtr TextureNode)
deriving (TextureNode -> TextureNode -> Bool
(TextureNode -> TextureNode -> Bool)
-> (TextureNode -> TextureNode -> Bool) -> Eq TextureNode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextureNode -> TextureNode -> Bool
$c/= :: TextureNode -> TextureNode -> Bool
== :: TextureNode -> TextureNode -> Bool
$c== :: TextureNode -> TextureNode -> Bool
Eq)
instance SP.ManagedPtrNewtype TextureNode where
toManagedPtr :: TextureNode -> ManagedPtr TextureNode
toManagedPtr (TextureNode ManagedPtr TextureNode
p) = ManagedPtr TextureNode
p
foreign import ccall "clutter_texture_node_get_type"
c_clutter_texture_node_get_type :: IO B.Types.GType
instance B.Types.TypedObject TextureNode where
glibType :: IO GType
glibType = IO GType
c_clutter_texture_node_get_type
class (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf TextureNode o) => IsTextureNode o
instance (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf TextureNode o) => IsTextureNode o
instance O.HasParentTypes TextureNode
type instance O.ParentTypes TextureNode = '[Clutter.PipelineNode.PipelineNode, Clutter.PaintNode.PaintNode]
toTextureNode :: (MIO.MonadIO m, IsTextureNode o) => o -> m TextureNode
toTextureNode :: forall (m :: * -> *) o.
(MonadIO m, IsTextureNode o) =>
o -> m TextureNode
toTextureNode = IO TextureNode -> m TextureNode
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO TextureNode -> m TextureNode)
-> (o -> IO TextureNode) -> o -> m TextureNode
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr TextureNode -> TextureNode) -> o -> IO TextureNode
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr TextureNode -> TextureNode
TextureNode
#if defined(ENABLE_OVERLOADING)
type family ResolveTextureNodeMethod (t :: Symbol) (o :: *) :: * where
ResolveTextureNodeMethod "addChild" o = Clutter.PaintNode.PaintNodeAddChildMethodInfo
ResolveTextureNodeMethod "addRectangle" o = Clutter.PaintNode.PaintNodeAddRectangleMethodInfo
ResolveTextureNodeMethod "addTextureRectangle" o = Clutter.PaintNode.PaintNodeAddTextureRectangleMethodInfo
ResolveTextureNodeMethod "ref" o = Clutter.PaintNode.PaintNodeRefMethodInfo
ResolveTextureNodeMethod "unref" o = Clutter.PaintNode.PaintNodeUnrefMethodInfo
ResolveTextureNodeMethod "setName" o = Clutter.PaintNode.PaintNodeSetNameMethodInfo
ResolveTextureNodeMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveTextureNodeMethod t TextureNode, O.OverloadedMethod info TextureNode p) => OL.IsLabel t (TextureNode -> 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 ~ ResolveTextureNodeMethod t TextureNode, O.OverloadedMethod info TextureNode p, R.HasField t TextureNode p) => R.HasField t TextureNode p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveTextureNodeMethod t TextureNode, O.OverloadedMethodInfo info TextureNode) => OL.IsLabel t (O.MethodProxy info TextureNode) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
instance BoxedPtr TextureNode where
boxedPtrCopy :: TextureNode -> IO TextureNode
boxedPtrCopy = TextureNode -> IO TextureNode
forall (m :: * -> *) a. Monad m => a -> m a
return
boxedPtrFree :: TextureNode -> IO ()
boxedPtrFree = \TextureNode
_x -> () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
foreign import ccall "clutter_texture_node_new" clutter_texture_node_new ::
Ptr Cogl.Texture.Texture ->
Ptr Clutter.Color.Color ->
CUInt ->
CUInt ->
IO (Ptr Clutter.PaintNode.PaintNode)
textureNodeNew ::
(B.CallStack.HasCallStack, MonadIO m, Cogl.Texture.IsTexture a) =>
a
-> Maybe (Clutter.Color.Color)
-> Clutter.Enums.ScalingFilter
-> Clutter.Enums.ScalingFilter
-> m Clutter.PaintNode.PaintNode
textureNodeNew :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsTexture a) =>
a -> Maybe Color -> ScalingFilter -> ScalingFilter -> m PaintNode
textureNodeNew a
texture Maybe Color
color ScalingFilter
minFilter ScalingFilter
magFilter = IO PaintNode -> m PaintNode
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO PaintNode -> m PaintNode) -> IO PaintNode -> m PaintNode
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 Color
maybeColor <- case Maybe Color
color of
Maybe Color
Nothing -> Ptr Color -> IO (Ptr Color)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Color
forall a. Ptr a
nullPtr
Just Color
jColor -> do
Ptr Color
jColor' <- Color -> IO (Ptr Color)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Color
jColor
Ptr Color -> IO (Ptr Color)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Color
jColor'
let minFilter' :: CUInt
minFilter' = (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
minFilter
let magFilter' :: CUInt
magFilter' = (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
magFilter
Ptr PaintNode
result <- Ptr Texture -> Ptr Color -> CUInt -> CUInt -> IO (Ptr PaintNode)
clutter_texture_node_new Ptr Texture
texture' Ptr Color
maybeColor CUInt
minFilter' CUInt
magFilter'
Text -> Ptr PaintNode -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"textureNodeNew" Ptr PaintNode
result
PaintNode
result' <- ((ManagedPtr PaintNode -> PaintNode)
-> Ptr PaintNode -> IO PaintNode
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr PaintNode -> PaintNode
Clutter.PaintNode.PaintNode) Ptr PaintNode
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
texture
Maybe Color -> (Color -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Color
color Color -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
PaintNode -> IO PaintNode
forall (m :: * -> *) a. Monad m => a -> m a
return PaintNode
result'
#if defined(ENABLE_OVERLOADING)
#endif