{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Clutter.Objects.Image
(
Image(..) ,
IsImage ,
toImage ,
#if defined(ENABLE_OVERLOADING)
ResolveImageMethod ,
#endif
imageNew ,
#if defined(ENABLE_OVERLOADING)
ImageSetAreaMethodInfo ,
#endif
imageSetArea ,
#if defined(ENABLE_OVERLOADING)
ImageSetBytesMethodInfo ,
#endif
imageSetBytes ,
#if defined(ENABLE_OVERLOADING)
ImageSetDataMethodInfo ,
#endif
imageSetData ,
) 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 qualified GI.Cairo.Structs.RectangleInt as Cairo.RectangleInt
import {-# SOURCE #-} qualified GI.Clutter.Interfaces.Content as Clutter.Content
import qualified GI.Cogl.Enums as Cogl.Enums
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GObject.Objects.Object as GObject.Object
newtype Image = Image (SP.ManagedPtr Image)
deriving (Image -> Image -> Bool
(Image -> Image -> Bool) -> (Image -> Image -> Bool) -> Eq Image
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Image -> Image -> Bool
$c/= :: Image -> Image -> Bool
== :: Image -> Image -> Bool
$c== :: Image -> Image -> Bool
Eq)
instance SP.ManagedPtrNewtype Image where
toManagedPtr :: Image -> ManagedPtr Image
toManagedPtr (Image ManagedPtr Image
p) = ManagedPtr Image
p
foreign import ccall "clutter_image_get_type"
c_clutter_image_get_type :: IO B.Types.GType
instance B.Types.TypedObject Image where
glibType :: IO GType
glibType = IO GType
c_clutter_image_get_type
instance B.Types.GObject Image
class (SP.GObject o, O.IsDescendantOf Image o) => IsImage o
instance (SP.GObject o, O.IsDescendantOf Image o) => IsImage o
instance O.HasParentTypes Image
type instance O.ParentTypes Image = '[GObject.Object.Object, Clutter.Content.Content]
toImage :: (MIO.MonadIO m, IsImage o) => o -> m Image
toImage :: forall (m :: * -> *) o. (MonadIO m, IsImage o) => o -> m Image
toImage = IO Image -> m Image
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Image -> m Image) -> (o -> IO Image) -> o -> m Image
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Image -> Image) -> o -> IO Image
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Image -> Image
Image
instance B.GValue.IsGValue (Maybe Image) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_clutter_image_get_type
gvalueSet_ :: Ptr GValue -> Maybe Image -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Image
P.Nothing = Ptr GValue -> Ptr Image -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Image
forall a. Ptr a
FP.nullPtr :: FP.Ptr Image)
gvalueSet_ Ptr GValue
gv (P.Just Image
obj) = Image -> (Ptr Image -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Image
obj (Ptr GValue -> Ptr Image -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Image)
gvalueGet_ Ptr GValue
gv = do
Ptr Image
ptr <- Ptr GValue -> IO (Ptr Image)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Image)
if Ptr Image
ptr Ptr Image -> Ptr Image -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Image
forall a. Ptr a
FP.nullPtr
then Image -> Maybe Image
forall a. a -> Maybe a
P.Just (Image -> Maybe Image) -> IO Image -> IO (Maybe Image)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Image -> Image) -> Ptr Image -> IO Image
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Image -> Image
Image Ptr Image
ptr
else Maybe Image -> IO (Maybe Image)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Image
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveImageMethod (t :: Symbol) (o :: *) :: * where
ResolveImageMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveImageMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveImageMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveImageMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveImageMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveImageMethod "invalidate" o = Clutter.Content.ContentInvalidateMethodInfo
ResolveImageMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveImageMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveImageMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveImageMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveImageMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveImageMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveImageMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveImageMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveImageMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveImageMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveImageMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveImageMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveImageMethod "getPreferredSize" o = Clutter.Content.ContentGetPreferredSizeMethodInfo
ResolveImageMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveImageMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveImageMethod "setArea" o = ImageSetAreaMethodInfo
ResolveImageMethod "setBytes" o = ImageSetBytesMethodInfo
ResolveImageMethod "setData" o = ImageSetDataMethodInfo
ResolveImageMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveImageMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveImageMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveImageMethod t Image, O.OverloadedMethod info Image p) => OL.IsLabel t (Image -> 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 ~ ResolveImageMethod t Image, O.OverloadedMethod info Image p, R.HasField t Image p) => R.HasField t Image p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveImageMethod t Image, O.OverloadedMethodInfo info Image) => OL.IsLabel t (O.MethodProxy info Image) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Image
type instance O.AttributeList Image = ImageAttributeList
type ImageAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Image = ImageSignalList
type ImageSignalList = ('[ '("attached", Clutter.Content.ContentAttachedSignalInfo), '("detached", Clutter.Content.ContentDetachedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "clutter_image_set_area" clutter_image_set_area ::
Ptr Image ->
Ptr Word8 ->
CUInt ->
Ptr Cairo.RectangleInt.RectangleInt ->
Word32 ->
Ptr (Ptr GError) ->
IO CInt
imageSetArea ::
(B.CallStack.HasCallStack, MonadIO m, IsImage a) =>
a
-> Ptr Word8
-> Cogl.Enums.PixelFormat
-> Cairo.RectangleInt.RectangleInt
-> Word32
-> m ()
imageSetArea :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
a -> Ptr Word8 -> PixelFormat -> RectangleInt -> Word32 -> m ()
imageSetArea a
image Ptr Word8
data_ PixelFormat
pixelFormat RectangleInt
rect Word32
rowStride = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Image
image' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
image
let pixelFormat' :: CUInt
pixelFormat' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (PixelFormat -> Int) -> PixelFormat -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PixelFormat -> Int
forall a. Enum a => a -> Int
fromEnum) PixelFormat
pixelFormat
Ptr RectangleInt
rect' <- RectangleInt -> IO (Ptr RectangleInt)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RectangleInt
rect
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Image
-> Ptr Word8
-> CUInt
-> Ptr RectangleInt
-> Word32
-> Ptr (Ptr GError)
-> IO CInt
clutter_image_set_area Ptr Image
image' Ptr Word8
data_ CUInt
pixelFormat' Ptr RectangleInt
rect' Word32
rowStride
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
image
RectangleInt -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RectangleInt
rect
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data ImageSetAreaMethodInfo
instance (signature ~ (Ptr Word8 -> Cogl.Enums.PixelFormat -> Cairo.RectangleInt.RectangleInt -> Word32 -> m ()), MonadIO m, IsImage a) => O.OverloadedMethod ImageSetAreaMethodInfo a signature where
overloadedMethod = imageSetArea
instance O.OverloadedMethodInfo ImageSetAreaMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Clutter.Objects.Image.imageSetArea",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-clutter-1.0.2/docs/GI-Clutter-Objects-Image.html#v:imageSetArea"
})
#endif
foreign import ccall "clutter_image_set_bytes" clutter_image_set_bytes ::
Ptr Image ->
Ptr GLib.Bytes.Bytes ->
CUInt ->
Word32 ->
Word32 ->
Word32 ->
Ptr (Ptr GError) ->
IO CInt
imageSetBytes ::
(B.CallStack.HasCallStack, MonadIO m, IsImage a) =>
a
-> GLib.Bytes.Bytes
-> Cogl.Enums.PixelFormat
-> Word32
-> Word32
-> Word32
-> m ()
imageSetBytes :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
a -> Bytes -> PixelFormat -> Word32 -> Word32 -> Word32 -> m ()
imageSetBytes a
image Bytes
data_ PixelFormat
pixelFormat Word32
width Word32
height Word32
rowStride = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Image
image' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
image
Ptr Bytes
data_' <- Bytes -> IO (Ptr Bytes)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Bytes
data_
let pixelFormat' :: CUInt
pixelFormat' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (PixelFormat -> Int) -> PixelFormat -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PixelFormat -> Int
forall a. Enum a => a -> Int
fromEnum) PixelFormat
pixelFormat
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Image
-> Ptr Bytes
-> CUInt
-> Word32
-> Word32
-> Word32
-> Ptr (Ptr GError)
-> IO CInt
clutter_image_set_bytes Ptr Image
image' Ptr Bytes
data_' CUInt
pixelFormat' Word32
width Word32
height Word32
rowStride
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
image
Bytes -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Bytes
data_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data ImageSetBytesMethodInfo
instance (signature ~ (GLib.Bytes.Bytes -> Cogl.Enums.PixelFormat -> Word32 -> Word32 -> Word32 -> m ()), MonadIO m, IsImage a) => O.OverloadedMethod ImageSetBytesMethodInfo a signature where
overloadedMethod = imageSetBytes
instance O.OverloadedMethodInfo ImageSetBytesMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Clutter.Objects.Image.imageSetBytes",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-clutter-1.0.2/docs/GI-Clutter-Objects-Image.html#v:imageSetBytes"
})
#endif
foreign import ccall "clutter_image_set_data" clutter_image_set_data ::
Ptr Image ->
Ptr Word8 ->
CUInt ->
Word32 ->
Word32 ->
Word32 ->
Ptr (Ptr GError) ->
IO CInt
imageSetData ::
(B.CallStack.HasCallStack, MonadIO m, IsImage a) =>
a
-> Ptr Word8
-> Cogl.Enums.PixelFormat
-> Word32
-> Word32
-> Word32
-> m ()
imageSetData :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
a -> Ptr Word8 -> PixelFormat -> Word32 -> Word32 -> Word32 -> m ()
imageSetData a
image Ptr Word8
data_ PixelFormat
pixelFormat Word32
width Word32
height Word32
rowStride = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Image
image' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
image
let pixelFormat' :: CUInt
pixelFormat' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (PixelFormat -> Int) -> PixelFormat -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PixelFormat -> Int
forall a. Enum a => a -> Int
fromEnum) PixelFormat
pixelFormat
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Image
-> Ptr Word8
-> CUInt
-> Word32
-> Word32
-> Word32
-> Ptr (Ptr GError)
-> IO CInt
clutter_image_set_data Ptr Image
image' Ptr Word8
data_ CUInt
pixelFormat' Word32
width Word32
height Word32
rowStride
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
image
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data ImageSetDataMethodInfo
instance (signature ~ (Ptr Word8 -> Cogl.Enums.PixelFormat -> Word32 -> Word32 -> Word32 -> m ()), MonadIO m, IsImage a) => O.OverloadedMethod ImageSetDataMethodInfo a signature where
overloadedMethod = imageSetData
instance O.OverloadedMethodInfo ImageSetDataMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Clutter.Objects.Image.imageSetData",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-clutter-1.0.2/docs/GI-Clutter-Objects-Image.html#v:imageSetData"
})
#endif
foreign import ccall "clutter_image_new" clutter_image_new ::
IO (Ptr Clutter.Content.Content)
imageNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Clutter.Content.Content
imageNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Content
imageNew = IO Content -> m Content
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Content -> m Content) -> IO Content -> m Content
forall a b. (a -> b) -> a -> b
$ do
Ptr Content
result <- IO (Ptr Content)
clutter_image_new
Text -> Ptr Content -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"imageNew" Ptr Content
result
Content
result' <- ((ManagedPtr Content -> Content) -> Ptr Content -> IO Content
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Content -> Content
Clutter.Content.Content) Ptr Content
result
Content -> IO Content
forall (m :: * -> *) a. Monad m => a -> m a
return Content
result'
#if defined(ENABLE_OVERLOADING)
#endif