{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gdk.Structs.RGBA
(
RGBA(..) ,
newZeroRGBA ,
#if defined(ENABLE_OVERLOADING)
ResolveRGBAMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
RGBACopyMethodInfo ,
#endif
rGBACopy ,
#if defined(ENABLE_OVERLOADING)
RGBAEqualMethodInfo ,
#endif
rGBAEqual ,
#if defined(ENABLE_OVERLOADING)
RGBAFreeMethodInfo ,
#endif
rGBAFree ,
#if defined(ENABLE_OVERLOADING)
RGBAHashMethodInfo ,
#endif
rGBAHash ,
#if defined(ENABLE_OVERLOADING)
RGBAParseMethodInfo ,
#endif
rGBAParse ,
#if defined(ENABLE_OVERLOADING)
RGBAToStringMethodInfo ,
#endif
rGBAToString ,
getRGBAAlpha ,
#if defined(ENABLE_OVERLOADING)
rGBA_alpha ,
#endif
setRGBAAlpha ,
getRGBABlue ,
#if defined(ENABLE_OVERLOADING)
rGBA_blue ,
#endif
setRGBABlue ,
getRGBAGreen ,
#if defined(ENABLE_OVERLOADING)
rGBA_green ,
#endif
setRGBAGreen ,
getRGBARed ,
#if defined(ENABLE_OVERLOADING)
rGBA_red ,
#endif
setRGBARed ,
) 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.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.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
newtype RGBA = RGBA (SP.ManagedPtr RGBA)
deriving (RGBA -> RGBA -> Bool
(RGBA -> RGBA -> Bool) -> (RGBA -> RGBA -> Bool) -> Eq RGBA
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RGBA -> RGBA -> Bool
$c/= :: RGBA -> RGBA -> Bool
== :: RGBA -> RGBA -> Bool
$c== :: RGBA -> RGBA -> Bool
Eq)
instance SP.ManagedPtrNewtype RGBA where
toManagedPtr :: RGBA -> ManagedPtr RGBA
toManagedPtr (RGBA ManagedPtr RGBA
p) = ManagedPtr RGBA
p
foreign import ccall "gdk_rgba_get_type" c_gdk_rgba_get_type ::
IO GType
type instance O.ParentTypes RGBA = '[]
instance O.HasParentTypes RGBA
instance B.Types.TypedObject RGBA where
glibType :: IO GType
glibType = IO GType
c_gdk_rgba_get_type
instance B.Types.GBoxed RGBA
instance B.GValue.IsGValue RGBA where
toGValue :: RGBA -> IO GValue
toGValue RGBA
o = do
GType
gtype <- IO GType
c_gdk_rgba_get_type
RGBA -> (Ptr RGBA -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr RGBA
o (GType -> (GValue -> Ptr RGBA -> IO ()) -> Ptr RGBA -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr RGBA -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
fromGValue :: GValue -> IO RGBA
fromGValue GValue
gv = do
Ptr RGBA
ptr <- GValue -> IO (Ptr RGBA)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr RGBA)
(ManagedPtr RGBA -> RGBA) -> Ptr RGBA -> IO RGBA
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr RGBA -> RGBA
RGBA Ptr RGBA
ptr
newZeroRGBA :: MonadIO m => m RGBA
newZeroRGBA :: m RGBA
newZeroRGBA = IO RGBA -> m RGBA
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO RGBA -> m RGBA) -> IO RGBA -> m RGBA
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr RGBA)
forall a. GBoxed a => Int -> IO (Ptr a)
callocBoxedBytes Int
32 IO (Ptr RGBA) -> (Ptr RGBA -> IO RGBA) -> IO RGBA
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr RGBA -> RGBA) -> Ptr RGBA -> IO RGBA
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr RGBA -> RGBA
RGBA
instance tag ~ 'AttrSet => Constructible RGBA tag where
new :: (ManagedPtr RGBA -> RGBA) -> [AttrOp RGBA tag] -> m RGBA
new ManagedPtr RGBA -> RGBA
_ [AttrOp RGBA tag]
attrs = do
RGBA
o <- m RGBA
forall (m :: * -> *). MonadIO m => m RGBA
newZeroRGBA
RGBA -> [AttrOp RGBA 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set RGBA
o [AttrOp RGBA tag]
[AttrOp RGBA 'AttrSet]
attrs
RGBA -> m RGBA
forall (m :: * -> *) a. Monad m => a -> m a
return RGBA
o
getRGBARed :: MonadIO m => RGBA -> m Double
getRGBARed :: RGBA -> m Double
getRGBARed RGBA
s = IO Double -> m Double
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Double -> m Double) -> IO Double -> m Double
forall a b. (a -> b) -> a -> b
$ RGBA -> (Ptr RGBA -> IO Double) -> IO Double
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr RGBA
s ((Ptr RGBA -> IO Double) -> IO Double)
-> (Ptr RGBA -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr RGBA
ptr -> do
CDouble
val <- Ptr CDouble -> IO CDouble
forall a. Storable a => Ptr a -> IO a
peek (Ptr RGBA
ptr Ptr RGBA -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO CDouble
let val' :: Double
val' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
val
Double -> IO Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
val'
setRGBARed :: MonadIO m => RGBA -> Double -> m ()
setRGBARed :: RGBA -> Double -> m ()
setRGBARed RGBA
s Double
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ RGBA -> (Ptr RGBA -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr RGBA
s ((Ptr RGBA -> IO ()) -> IO ()) -> (Ptr RGBA -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr RGBA
ptr -> do
let val' :: CDouble
val' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
val
Ptr CDouble -> CDouble -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RGBA
ptr Ptr RGBA -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (CDouble
val' :: CDouble)
#if defined(ENABLE_OVERLOADING)
data RGBARedFieldInfo
instance AttrInfo RGBARedFieldInfo where
type AttrBaseTypeConstraint RGBARedFieldInfo = (~) RGBA
type AttrAllowedOps RGBARedFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint RGBARedFieldInfo = (~) Double
type AttrTransferTypeConstraint RGBARedFieldInfo = (~)Double
type AttrTransferType RGBARedFieldInfo = Double
type AttrGetType RGBARedFieldInfo = Double
type AttrLabel RGBARedFieldInfo = "red"
type AttrOrigin RGBARedFieldInfo = RGBA
attrGet = getRGBARed
attrSet = setRGBARed
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
rGBA_red :: AttrLabelProxy "red"
rGBA_red = AttrLabelProxy
#endif
getRGBAGreen :: MonadIO m => RGBA -> m Double
getRGBAGreen :: RGBA -> m Double
getRGBAGreen RGBA
s = IO Double -> m Double
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Double -> m Double) -> IO Double -> m Double
forall a b. (a -> b) -> a -> b
$ RGBA -> (Ptr RGBA -> IO Double) -> IO Double
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr RGBA
s ((Ptr RGBA -> IO Double) -> IO Double)
-> (Ptr RGBA -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr RGBA
ptr -> do
CDouble
val <- Ptr CDouble -> IO CDouble
forall a. Storable a => Ptr a -> IO a
peek (Ptr RGBA
ptr Ptr RGBA -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) :: IO CDouble
let val' :: Double
val' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
val
Double -> IO Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
val'
setRGBAGreen :: MonadIO m => RGBA -> Double -> m ()
setRGBAGreen :: RGBA -> Double -> m ()
setRGBAGreen RGBA
s Double
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ RGBA -> (Ptr RGBA -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr RGBA
s ((Ptr RGBA -> IO ()) -> IO ()) -> (Ptr RGBA -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr RGBA
ptr -> do
let val' :: CDouble
val' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
val
Ptr CDouble -> CDouble -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RGBA
ptr Ptr RGBA -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (CDouble
val' :: CDouble)
#if defined(ENABLE_OVERLOADING)
data RGBAGreenFieldInfo
instance AttrInfo RGBAGreenFieldInfo where
type AttrBaseTypeConstraint RGBAGreenFieldInfo = (~) RGBA
type AttrAllowedOps RGBAGreenFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint RGBAGreenFieldInfo = (~) Double
type AttrTransferTypeConstraint RGBAGreenFieldInfo = (~)Double
type AttrTransferType RGBAGreenFieldInfo = Double
type AttrGetType RGBAGreenFieldInfo = Double
type AttrLabel RGBAGreenFieldInfo = "green"
type AttrOrigin RGBAGreenFieldInfo = RGBA
attrGet = getRGBAGreen
attrSet = setRGBAGreen
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
rGBA_green :: AttrLabelProxy "green"
rGBA_green = AttrLabelProxy
#endif
getRGBABlue :: MonadIO m => RGBA -> m Double
getRGBABlue :: RGBA -> m Double
getRGBABlue RGBA
s = IO Double -> m Double
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Double -> m Double) -> IO Double -> m Double
forall a b. (a -> b) -> a -> b
$ RGBA -> (Ptr RGBA -> IO Double) -> IO Double
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr RGBA
s ((Ptr RGBA -> IO Double) -> IO Double)
-> (Ptr RGBA -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr RGBA
ptr -> do
CDouble
val <- Ptr CDouble -> IO CDouble
forall a. Storable a => Ptr a -> IO a
peek (Ptr RGBA
ptr Ptr RGBA -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16) :: IO CDouble
let val' :: Double
val' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
val
Double -> IO Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
val'
setRGBABlue :: MonadIO m => RGBA -> Double -> m ()
setRGBABlue :: RGBA -> Double -> m ()
setRGBABlue RGBA
s Double
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ RGBA -> (Ptr RGBA -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr RGBA
s ((Ptr RGBA -> IO ()) -> IO ()) -> (Ptr RGBA -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr RGBA
ptr -> do
let val' :: CDouble
val' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
val
Ptr CDouble -> CDouble -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RGBA
ptr Ptr RGBA -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16) (CDouble
val' :: CDouble)
#if defined(ENABLE_OVERLOADING)
data RGBABlueFieldInfo
instance AttrInfo RGBABlueFieldInfo where
type AttrBaseTypeConstraint RGBABlueFieldInfo = (~) RGBA
type AttrAllowedOps RGBABlueFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint RGBABlueFieldInfo = (~) Double
type AttrTransferTypeConstraint RGBABlueFieldInfo = (~)Double
type AttrTransferType RGBABlueFieldInfo = Double
type AttrGetType RGBABlueFieldInfo = Double
type AttrLabel RGBABlueFieldInfo = "blue"
type AttrOrigin RGBABlueFieldInfo = RGBA
attrGet = getRGBABlue
attrSet = setRGBABlue
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
rGBA_blue :: AttrLabelProxy "blue"
rGBA_blue = AttrLabelProxy
#endif
getRGBAAlpha :: MonadIO m => RGBA -> m Double
getRGBAAlpha :: RGBA -> m Double
getRGBAAlpha RGBA
s = IO Double -> m Double
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Double -> m Double) -> IO Double -> m Double
forall a b. (a -> b) -> a -> b
$ RGBA -> (Ptr RGBA -> IO Double) -> IO Double
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr RGBA
s ((Ptr RGBA -> IO Double) -> IO Double)
-> (Ptr RGBA -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr RGBA
ptr -> do
CDouble
val <- Ptr CDouble -> IO CDouble
forall a. Storable a => Ptr a -> IO a
peek (Ptr RGBA
ptr Ptr RGBA -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24) :: IO CDouble
let val' :: Double
val' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
val
Double -> IO Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
val'
setRGBAAlpha :: MonadIO m => RGBA -> Double -> m ()
setRGBAAlpha :: RGBA -> Double -> m ()
setRGBAAlpha RGBA
s Double
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ RGBA -> (Ptr RGBA -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr RGBA
s ((Ptr RGBA -> IO ()) -> IO ()) -> (Ptr RGBA -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr RGBA
ptr -> do
let val' :: CDouble
val' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
val
Ptr CDouble -> CDouble -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RGBA
ptr Ptr RGBA -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24) (CDouble
val' :: CDouble)
#if defined(ENABLE_OVERLOADING)
data RGBAAlphaFieldInfo
instance AttrInfo RGBAAlphaFieldInfo where
type AttrBaseTypeConstraint RGBAAlphaFieldInfo = (~) RGBA
type AttrAllowedOps RGBAAlphaFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint RGBAAlphaFieldInfo = (~) Double
type AttrTransferTypeConstraint RGBAAlphaFieldInfo = (~)Double
type AttrTransferType RGBAAlphaFieldInfo = Double
type AttrGetType RGBAAlphaFieldInfo = Double
type AttrLabel RGBAAlphaFieldInfo = "alpha"
type AttrOrigin RGBAAlphaFieldInfo = RGBA
attrGet = getRGBAAlpha
attrSet = setRGBAAlpha
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
rGBA_alpha :: AttrLabelProxy "alpha"
rGBA_alpha = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList RGBA
type instance O.AttributeList RGBA = RGBAAttributeList
type RGBAAttributeList = ('[ '("red", RGBARedFieldInfo), '("green", RGBAGreenFieldInfo), '("blue", RGBABlueFieldInfo), '("alpha", RGBAAlphaFieldInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "gdk_rgba_copy" gdk_rgba_copy ::
Ptr RGBA ->
IO (Ptr RGBA)
rGBACopy ::
(B.CallStack.HasCallStack, MonadIO m) =>
RGBA
-> m RGBA
rGBACopy :: RGBA -> m RGBA
rGBACopy RGBA
rgba = IO RGBA -> m RGBA
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO RGBA -> m RGBA) -> IO RGBA -> m RGBA
forall a b. (a -> b) -> a -> b
$ do
Ptr RGBA
rgba' <- RGBA -> IO (Ptr RGBA)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RGBA
rgba
Ptr RGBA
result <- Ptr RGBA -> IO (Ptr RGBA)
gdk_rgba_copy Ptr RGBA
rgba'
Text -> Ptr RGBA -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"rGBACopy" Ptr RGBA
result
RGBA
result' <- ((ManagedPtr RGBA -> RGBA) -> Ptr RGBA -> IO RGBA
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr RGBA -> RGBA
RGBA) Ptr RGBA
result
RGBA -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RGBA
rgba
RGBA -> IO RGBA
forall (m :: * -> *) a. Monad m => a -> m a
return RGBA
result'
#if defined(ENABLE_OVERLOADING)
data RGBACopyMethodInfo
instance (signature ~ (m RGBA), MonadIO m) => O.MethodInfo RGBACopyMethodInfo RGBA signature where
overloadedMethod = rGBACopy
#endif
foreign import ccall "gdk_rgba_equal" gdk_rgba_equal ::
Ptr RGBA ->
Ptr RGBA ->
IO CInt
rGBAEqual ::
(B.CallStack.HasCallStack, MonadIO m) =>
RGBA
-> RGBA
-> m Bool
rGBAEqual :: RGBA -> RGBA -> m Bool
rGBAEqual RGBA
p1 RGBA
p2 = IO Bool -> m Bool
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
Ptr RGBA
p1' <- RGBA -> IO (Ptr RGBA)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RGBA
p1
Ptr RGBA
p2' <- RGBA -> IO (Ptr RGBA)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RGBA
p2
CInt
result <- Ptr RGBA -> Ptr RGBA -> IO CInt
gdk_rgba_equal Ptr RGBA
p1' Ptr RGBA
p2'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
RGBA -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RGBA
p1
RGBA -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RGBA
p2
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data RGBAEqualMethodInfo
instance (signature ~ (RGBA -> m Bool), MonadIO m) => O.MethodInfo RGBAEqualMethodInfo RGBA signature where
overloadedMethod = rGBAEqual
#endif
foreign import ccall "gdk_rgba_free" gdk_rgba_free ::
Ptr RGBA ->
IO ()
rGBAFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
RGBA
-> m ()
rGBAFree :: RGBA -> m ()
rGBAFree RGBA
rgba = 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 RGBA
rgba' <- RGBA -> IO (Ptr RGBA)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RGBA
rgba
Ptr RGBA -> IO ()
gdk_rgba_free Ptr RGBA
rgba'
RGBA -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RGBA
rgba
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data RGBAFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo RGBAFreeMethodInfo RGBA signature where
overloadedMethod = rGBAFree
#endif
foreign import ccall "gdk_rgba_hash" gdk_rgba_hash ::
Ptr RGBA ->
IO Word32
rGBAHash ::
(B.CallStack.HasCallStack, MonadIO m) =>
RGBA
-> m Word32
rGBAHash :: RGBA -> m Word32
rGBAHash RGBA
p = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr RGBA
p' <- RGBA -> IO (Ptr RGBA)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RGBA
p
Word32
result <- Ptr RGBA -> IO Word32
gdk_rgba_hash Ptr RGBA
p'
RGBA -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RGBA
p
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data RGBAHashMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo RGBAHashMethodInfo RGBA signature where
overloadedMethod = rGBAHash
#endif
foreign import ccall "gdk_rgba_parse" gdk_rgba_parse ::
Ptr RGBA ->
CString ->
IO CInt
rGBAParse ::
(B.CallStack.HasCallStack, MonadIO m) =>
RGBA
-> T.Text
-> m Bool
rGBAParse :: RGBA -> Text -> m Bool
rGBAParse RGBA
rgba Text
spec = IO Bool -> m Bool
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
Ptr RGBA
rgba' <- RGBA -> IO (Ptr RGBA)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RGBA
rgba
CString
spec' <- Text -> IO CString
textToCString Text
spec
CInt
result <- Ptr RGBA -> CString -> IO CInt
gdk_rgba_parse Ptr RGBA
rgba' CString
spec'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
RGBA -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RGBA
rgba
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
spec'
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data RGBAParseMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo RGBAParseMethodInfo RGBA signature where
overloadedMethod = rGBAParse
#endif
foreign import ccall "gdk_rgba_to_string" gdk_rgba_to_string ::
Ptr RGBA ->
IO CString
rGBAToString ::
(B.CallStack.HasCallStack, MonadIO m) =>
RGBA
-> m T.Text
rGBAToString :: RGBA -> m Text
rGBAToString RGBA
rgba = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr RGBA
rgba' <- RGBA -> IO (Ptr RGBA)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RGBA
rgba
CString
result <- Ptr RGBA -> IO CString
gdk_rgba_to_string Ptr RGBA
rgba'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"rGBAToString" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
RGBA -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RGBA
rgba
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
data RGBAToStringMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo RGBAToStringMethodInfo RGBA signature where
overloadedMethod = rGBAToString
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveRGBAMethod (t :: Symbol) (o :: *) :: * where
ResolveRGBAMethod "copy" o = RGBACopyMethodInfo
ResolveRGBAMethod "equal" o = RGBAEqualMethodInfo
ResolveRGBAMethod "free" o = RGBAFreeMethodInfo
ResolveRGBAMethod "hash" o = RGBAHashMethodInfo
ResolveRGBAMethod "parse" o = RGBAParseMethodInfo
ResolveRGBAMethod "toString" o = RGBAToStringMethodInfo
ResolveRGBAMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveRGBAMethod t RGBA, O.MethodInfo info RGBA p) => OL.IsLabel t (RGBA -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif