{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- Provides information to interpret colors and pixels in a variety of ways.
-- 
-- They are also known as
-- <https://en.wikipedia.org/wiki/Color_space *color spaces*>.
-- 
-- Crucially, GTK knows how to convert colors from one color
-- state to another.
-- 
-- @GdkColorState@ objects are immutable and therefore threadsafe.
-- 
-- /Since: 4.16/

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Gdk.Structs.ColorState
    ( 

-- * Exported types
    ColorState(..)                          ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [createCicpParams]("GI.Gdk.Structs.ColorState#g:method:createCicpParams"), [equal]("GI.Gdk.Structs.ColorState#g:method:equal"), [ref]("GI.Gdk.Structs.ColorState#g:method:ref"), [unref]("GI.Gdk.Structs.ColorState#g:method:unref").
-- 
-- ==== Getters
-- /None/.
-- 
-- ==== Setters
-- /None/.

#if defined(ENABLE_OVERLOADING)
    ResolveColorStateMethod                 ,
#endif

-- ** createCicpParams #method:createCicpParams#

#if defined(ENABLE_OVERLOADING)
    ColorStateCreateCicpParamsMethodInfo    ,
#endif
    colorStateCreateCicpParams              ,


-- ** equal #method:equal#

#if defined(ENABLE_OVERLOADING)
    ColorStateEqualMethodInfo               ,
#endif
    colorStateEqual                         ,


-- ** getOklab #method:getOklab#

    colorStateGetOklab                      ,


-- ** getOklch #method:getOklch#

    colorStateGetOklch                      ,


-- ** getRec2100Linear #method:getRec2100Linear#

    colorStateGetRec2100Linear              ,


-- ** getRec2100Pq #method:getRec2100Pq#

    colorStateGetRec2100Pq                  ,


-- ** getSrgb #method:getSrgb#

    colorStateGetSrgb                       ,


-- ** getSrgbLinear #method:getSrgbLinear#

    colorStateGetSrgbLinear                 ,


-- ** ref #method:ref#

#if defined(ENABLE_OVERLOADING)
    ColorStateRefMethodInfo                 ,
#endif
    colorStateRef                           ,


-- ** unref #method:unref#

#if defined(ENABLE_OVERLOADING)
    ColorStateUnrefMethodInfo               ,
#endif
    colorStateUnref                         ,




    ) 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

-- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
#if MIN_VERSION_base(4,18,0)
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gdk.Enums as Gdk.Enums
import {-# SOURCE #-} qualified GI.Gdk.Objects.CicpParams as Gdk.CicpParams

#else
import {-# SOURCE #-} qualified GI.Gdk.Objects.CicpParams as Gdk.CicpParams

#endif

-- | Memory-managed wrapper type.
newtype ColorState = ColorState (SP.ManagedPtr ColorState)
    deriving (ColorState -> ColorState -> Bool
(ColorState -> ColorState -> Bool)
-> (ColorState -> ColorState -> Bool) -> Eq ColorState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ColorState -> ColorState -> Bool
== :: ColorState -> ColorState -> Bool
$c/= :: ColorState -> ColorState -> Bool
/= :: ColorState -> ColorState -> Bool
Eq)

instance SP.ManagedPtrNewtype ColorState where
    toManagedPtr :: ColorState -> ManagedPtr ColorState
toManagedPtr (ColorState ManagedPtr ColorState
p) = ManagedPtr ColorState
p

foreign import ccall "gdk_color_state_get_type" c_gdk_color_state_get_type :: 
    IO GType

type instance O.ParentTypes ColorState = '[]
instance O.HasParentTypes ColorState

instance B.Types.TypedObject ColorState where
    glibType :: IO GType
glibType = IO GType
c_gdk_color_state_get_type

instance B.Types.GBoxed ColorState

-- | Convert t'ColorState' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe ColorState) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gdk_color_state_get_type
    gvalueSet_ :: Ptr GValue -> Maybe ColorState -> IO ()
gvalueSet_ Ptr GValue
gv Maybe ColorState
P.Nothing = Ptr GValue -> Ptr ColorState -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr ColorState
forall a. Ptr a
FP.nullPtr :: FP.Ptr ColorState)
    gvalueSet_ Ptr GValue
gv (P.Just ColorState
obj) = ColorState -> (Ptr ColorState -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr ColorState
obj (Ptr GValue -> Ptr ColorState -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe ColorState)
gvalueGet_ Ptr GValue
gv = do
        Ptr ColorState
ptr <- Ptr GValue -> IO (Ptr ColorState)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr ColorState)
        if Ptr ColorState
ptr Ptr ColorState -> Ptr ColorState -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr ColorState
forall a. Ptr a
FP.nullPtr
        then ColorState -> Maybe ColorState
forall a. a -> Maybe a
P.Just (ColorState -> Maybe ColorState)
-> IO ColorState -> IO (Maybe ColorState)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr ColorState -> ColorState)
-> Ptr ColorState -> IO ColorState
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr ColorState -> ColorState
ColorState Ptr ColorState
ptr
        else Maybe ColorState -> IO (Maybe ColorState)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe ColorState
forall a. Maybe a
P.Nothing
        
    


#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList ColorState
type instance O.AttributeList ColorState = ColorStateAttributeList
type ColorStateAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif

-- method ColorState::create_cicp_params
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Gdk" , name = "ColorState" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a `GdkColorState`" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gdk" , name = "CicpParams" })
-- throws : False
-- Skip return : False

foreign import ccall "gdk_color_state_create_cicp_params" gdk_color_state_create_cicp_params :: 
    Ptr ColorState ->                       -- self : TInterface (Name {namespace = "Gdk", name = "ColorState"})
    IO (Ptr Gdk.CicpParams.CicpParams)

-- | Create a t'GI.Gdk.Objects.CicpParams.CicpParams' representing the colorstate.
-- 
-- It is not guaranteed that every @GdkColorState@ can be
-- represented with Cicp parameters. If that is the case,
-- this function returns @NULL@.
-- 
-- /Since: 4.16/
colorStateCreateCicpParams ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ColorState
    -- ^ /@self@/: a @GdkColorState@
    -> m (Maybe Gdk.CicpParams.CicpParams)
    -- ^ __Returns:__ A new t'GI.Gdk.Objects.CicpParams.CicpParams'
colorStateCreateCicpParams :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ColorState -> m (Maybe CicpParams)
colorStateCreateCicpParams ColorState
self = IO (Maybe CicpParams) -> m (Maybe CicpParams)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe CicpParams) -> m (Maybe CicpParams))
-> IO (Maybe CicpParams) -> m (Maybe CicpParams)
forall a b. (a -> b) -> a -> b
$ do
    Ptr ColorState
self' <- ColorState -> IO (Ptr ColorState)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ColorState
self
    Ptr CicpParams
result <- Ptr ColorState -> IO (Ptr CicpParams)
gdk_color_state_create_cicp_params Ptr ColorState
self'
    Maybe CicpParams
maybeResult <- Ptr CicpParams
-> (Ptr CicpParams -> IO CicpParams) -> IO (Maybe CicpParams)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr CicpParams
result ((Ptr CicpParams -> IO CicpParams) -> IO (Maybe CicpParams))
-> (Ptr CicpParams -> IO CicpParams) -> IO (Maybe CicpParams)
forall a b. (a -> b) -> a -> b
$ \Ptr CicpParams
result' -> do
        CicpParams
result'' <- ((ManagedPtr CicpParams -> CicpParams)
-> Ptr CicpParams -> IO CicpParams
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr CicpParams -> CicpParams
Gdk.CicpParams.CicpParams) Ptr CicpParams
result'
        CicpParams -> IO CicpParams
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CicpParams
result''
    ColorState -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ColorState
self
    Maybe CicpParams -> IO (Maybe CicpParams)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe CicpParams
maybeResult

#if defined(ENABLE_OVERLOADING)
data ColorStateCreateCicpParamsMethodInfo
instance (signature ~ (m (Maybe Gdk.CicpParams.CicpParams)), MonadIO m) => O.OverloadedMethod ColorStateCreateCicpParamsMethodInfo ColorState signature where
    overloadedMethod = colorStateCreateCicpParams

instance O.OverloadedMethodInfo ColorStateCreateCicpParamsMethodInfo ColorState where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gdk.Structs.ColorState.colorStateCreateCicpParams",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk4-4.0.10/docs/GI-Gdk-Structs-ColorState.html#v:colorStateCreateCicpParams"
        })


#endif

-- method ColorState::equal
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Gdk" , name = "ColorState" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a `GdkColorState`" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "other"
--           , argType =
--               TInterface Name { namespace = "Gdk" , name = "ColorState" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "another `GdkColorStatee`"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gdk_color_state_equal" gdk_color_state_equal :: 
    Ptr ColorState ->                       -- self : TInterface (Name {namespace = "Gdk", name = "ColorState"})
    Ptr ColorState ->                       -- other : TInterface (Name {namespace = "Gdk", name = "ColorState"})
    IO CInt

-- | Compares two @GdkColorStates@ for equality.
-- 
-- Note that this function is not guaranteed to be perfect and two objects
-- describing the same color state may compare not equal. However, different
-- color states will never compare equal.
-- 
-- /Since: 4.16/
colorStateEqual ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ColorState
    -- ^ /@self@/: a @GdkColorState@
    -> ColorState
    -- ^ /@other@/: another @GdkColorStatee@
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the two color states compare equal
colorStateEqual :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ColorState -> ColorState -> m Bool
colorStateEqual ColorState
self ColorState
other = 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
    Ptr ColorState
self' <- ColorState -> IO (Ptr ColorState)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ColorState
self
    Ptr ColorState
other' <- ColorState -> IO (Ptr ColorState)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ColorState
other
    CInt
result <- Ptr ColorState -> Ptr ColorState -> IO CInt
gdk_color_state_equal Ptr ColorState
self' Ptr ColorState
other'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    ColorState -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ColorState
self
    ColorState -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ColorState
other
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data ColorStateEqualMethodInfo
instance (signature ~ (ColorState -> m Bool), MonadIO m) => O.OverloadedMethod ColorStateEqualMethodInfo ColorState signature where
    overloadedMethod = colorStateEqual

instance O.OverloadedMethodInfo ColorStateEqualMethodInfo ColorState where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gdk.Structs.ColorState.colorStateEqual",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk4-4.0.10/docs/GI-Gdk-Structs-ColorState.html#v:colorStateEqual"
        })


#endif

-- method ColorState::ref
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Gdk" , name = "ColorState" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a `GdkColorState`" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gdk" , name = "ColorState" })
-- throws : False
-- Skip return : False

foreign import ccall "gdk_color_state_ref" gdk_color_state_ref :: 
    Ptr ColorState ->                       -- self : TInterface (Name {namespace = "Gdk", name = "ColorState"})
    IO (Ptr ColorState)

-- | Increase the reference count of /@self@/.
-- 
-- /Since: 4.16/
colorStateRef ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ColorState
    -- ^ /@self@/: a @GdkColorState@
    -> m ColorState
    -- ^ __Returns:__ the object that was passed in
colorStateRef :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ColorState -> m ColorState
colorStateRef ColorState
self = IO ColorState -> m ColorState
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ColorState -> m ColorState) -> IO ColorState -> m ColorState
forall a b. (a -> b) -> a -> b
$ do
    Ptr ColorState
self' <- ColorState -> IO (Ptr ColorState)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ColorState
self
    Ptr ColorState
result <- Ptr ColorState -> IO (Ptr ColorState)
gdk_color_state_ref Ptr ColorState
self'
    Text -> Ptr ColorState -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"colorStateRef" Ptr ColorState
result
    ColorState
result' <- ((ManagedPtr ColorState -> ColorState)
-> Ptr ColorState -> IO ColorState
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr ColorState -> ColorState
ColorState) Ptr ColorState
result
    ColorState -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ColorState
self
    ColorState -> IO ColorState
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ColorState
result'

#if defined(ENABLE_OVERLOADING)
data ColorStateRefMethodInfo
instance (signature ~ (m ColorState), MonadIO m) => O.OverloadedMethod ColorStateRefMethodInfo ColorState signature where
    overloadedMethod = colorStateRef

instance O.OverloadedMethodInfo ColorStateRefMethodInfo ColorState where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gdk.Structs.ColorState.colorStateRef",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk4-4.0.10/docs/GI-Gdk-Structs-ColorState.html#v:colorStateRef"
        })


#endif

-- method ColorState::unref
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Gdk" , name = "ColorState" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a `GdkColorState`" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gdk_color_state_unref" gdk_color_state_unref :: 
    Ptr ColorState ->                       -- self : TInterface (Name {namespace = "Gdk", name = "ColorState"})
    IO ()

-- | Decrease the reference count of /@self@/.
-- 
-- Unless /@self@/ is static, it will be freed
-- when the reference count reaches zero.
-- 
-- /Since: 4.16/
colorStateUnref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ColorState
    -- ^ /@self@/: a @GdkColorState@
    -> m ()
colorStateUnref :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ColorState -> m ()
colorStateUnref ColorState
self = 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
    Ptr ColorState
self' <- ColorState -> IO (Ptr ColorState)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ColorState
self
    Ptr ColorState -> IO ()
gdk_color_state_unref Ptr ColorState
self'
    ColorState -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ColorState
self
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ColorStateUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod ColorStateUnrefMethodInfo ColorState signature where
    overloadedMethod = colorStateUnref

instance O.OverloadedMethodInfo ColorStateUnrefMethodInfo ColorState where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gdk.Structs.ColorState.colorStateUnref",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk4-4.0.10/docs/GI-Gdk-Structs-ColorState.html#v:colorStateUnref"
        })


#endif

-- method ColorState::get_oklab
-- method type : MemberFunction
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gdk" , name = "ColorState" })
-- throws : False
-- Skip return : False

foreign import ccall "gdk_color_state_get_oklab" gdk_color_state_get_oklab :: 
    IO (Ptr ColorState)

-- | Returns the color state object representing the oklab color space.
-- 
-- This is a perceptually uniform color state.
-- 
-- /Since: 4.18/
colorStateGetOklab ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ColorState
    -- ^ __Returns:__ the color state object for oklab
colorStateGetOklab :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ColorState
colorStateGetOklab  = IO ColorState -> m ColorState
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ColorState -> m ColorState) -> IO ColorState -> m ColorState
forall a b. (a -> b) -> a -> b
$ do
    Ptr ColorState
result <- IO (Ptr ColorState)
gdk_color_state_get_oklab
    Text -> Ptr ColorState -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"colorStateGetOklab" Ptr ColorState
result
    ColorState
result' <- ((ManagedPtr ColorState -> ColorState)
-> Ptr ColorState -> IO ColorState
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr ColorState -> ColorState
ColorState) Ptr ColorState
result
    ColorState -> IO ColorState
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ColorState
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method ColorState::get_oklch
-- method type : MemberFunction
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gdk" , name = "ColorState" })
-- throws : False
-- Skip return : False

foreign import ccall "gdk_color_state_get_oklch" gdk_color_state_get_oklch :: 
    IO (Ptr ColorState)

-- | Returns the color state object representing the oklch color space.
-- 
-- This is the polar variant of oklab, in which the hue is encoded as
-- a polar coordinate.
-- 
-- /Since: 4.18/
colorStateGetOklch ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ColorState
    -- ^ __Returns:__ the color state object for oklch
colorStateGetOklch :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ColorState
colorStateGetOklch  = IO ColorState -> m ColorState
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ColorState -> m ColorState) -> IO ColorState -> m ColorState
forall a b. (a -> b) -> a -> b
$ do
    Ptr ColorState
result <- IO (Ptr ColorState)
gdk_color_state_get_oklch
    Text -> Ptr ColorState -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"colorStateGetOklch" Ptr ColorState
result
    ColorState
result' <- ((ManagedPtr ColorState -> ColorState)
-> Ptr ColorState -> IO ColorState
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr ColorState -> ColorState
ColorState) Ptr ColorState
result
    ColorState -> IO ColorState
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ColorState
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method ColorState::get_rec2100_linear
-- method type : MemberFunction
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gdk" , name = "ColorState" })
-- throws : False
-- Skip return : False

foreign import ccall "gdk_color_state_get_rec2100_linear" gdk_color_state_get_rec2100_linear :: 
    IO (Ptr ColorState)

-- | Returns the color state object representing the linear rec2100 color space.
-- 
-- This color state uses the primaries defined by BT.2020-2 and BT.2100-0 and a linear
-- transfer function.
-- 
-- It is equivalent to the <http://developer.gnome.org/gdk/stable/class.CicpParams.html Cicp> tuple 9\/8\/0\/1.
-- 
-- See e.g. <https://drafts.csswg.org/css-color-hdr/#valdef-color-rec2100-linear the CSS HDR Module>
-- for details about this colorstate.
-- 
-- /Since: 4.16/
colorStateGetRec2100Linear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ColorState
    -- ^ __Returns:__ the color state object for linearized rec2100
colorStateGetRec2100Linear :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ColorState
colorStateGetRec2100Linear  = IO ColorState -> m ColorState
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ColorState -> m ColorState) -> IO ColorState -> m ColorState
forall a b. (a -> b) -> a -> b
$ do
    Ptr ColorState
result <- IO (Ptr ColorState)
gdk_color_state_get_rec2100_linear
    Text -> Ptr ColorState -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"colorStateGetRec2100Linear" Ptr ColorState
result
    ColorState
result' <- ((ManagedPtr ColorState -> ColorState)
-> Ptr ColorState -> IO ColorState
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr ColorState -> ColorState
ColorState) Ptr ColorState
result
    ColorState -> IO ColorState
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ColorState
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method ColorState::get_rec2100_pq
-- method type : MemberFunction
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gdk" , name = "ColorState" })
-- throws : False
-- Skip return : False

foreign import ccall "gdk_color_state_get_rec2100_pq" gdk_color_state_get_rec2100_pq :: 
    IO (Ptr ColorState)

-- | Returns the color state object representing the rec2100-pq color space.
-- 
-- This color state uses the primaries defined by BT.2020-2 and BT.2100-0 and the transfer
-- function defined by SMPTE ST 2084 and BT.2100-2.
-- 
-- It is equivalent to the <http://developer.gnome.org/gdk/stable/class.CicpParams.html Cicp> tuple 9\/16\/0\/1.
-- 
-- See e.g. <https://drafts.csswg.org/css-color-hdr/#valdef-color-rec2100-pq the CSS HDR Module>
-- for details about this colorstate.
-- 
-- /Since: 4.16/
colorStateGetRec2100Pq ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ColorState
    -- ^ __Returns:__ the color state object for rec2100-pq
colorStateGetRec2100Pq :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ColorState
colorStateGetRec2100Pq  = IO ColorState -> m ColorState
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ColorState -> m ColorState) -> IO ColorState -> m ColorState
forall a b. (a -> b) -> a -> b
$ do
    Ptr ColorState
result <- IO (Ptr ColorState)
gdk_color_state_get_rec2100_pq
    Text -> Ptr ColorState -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"colorStateGetRec2100Pq" Ptr ColorState
result
    ColorState
result' <- ((ManagedPtr ColorState -> ColorState)
-> Ptr ColorState -> IO ColorState
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr ColorState -> ColorState
ColorState) Ptr ColorState
result
    ColorState -> IO ColorState
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ColorState
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method ColorState::get_srgb
-- method type : MemberFunction
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gdk" , name = "ColorState" })
-- throws : False
-- Skip return : False

foreign import ccall "gdk_color_state_get_srgb" gdk_color_state_get_srgb :: 
    IO (Ptr ColorState)

-- | Returns the color state object representing the sRGB color space.
-- 
-- This color state uses the primaries defined by BT.709-6 and the transfer function
-- defined by IEC 61966-2-1.
-- 
-- It is equivalent to the <http://developer.gnome.org/gdk/stable/class.CicpParams.html Cicp> tuple 1\/13\/0\/1.
-- 
-- See e.g. <https://www.w3.org/TR/css-color-4/#predefined-sRGB the CSS Color Module>
-- for details about this colorstate.
-- 
-- /Since: 4.16/
colorStateGetSrgb ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ColorState
    -- ^ __Returns:__ the color state object for sRGB
colorStateGetSrgb :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ColorState
colorStateGetSrgb  = IO ColorState -> m ColorState
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ColorState -> m ColorState) -> IO ColorState -> m ColorState
forall a b. (a -> b) -> a -> b
$ do
    Ptr ColorState
result <- IO (Ptr ColorState)
gdk_color_state_get_srgb
    Text -> Ptr ColorState -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"colorStateGetSrgb" Ptr ColorState
result
    ColorState
result' <- ((ManagedPtr ColorState -> ColorState)
-> Ptr ColorState -> IO ColorState
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr ColorState -> ColorState
ColorState) Ptr ColorState
result
    ColorState -> IO ColorState
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ColorState
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method ColorState::get_srgb_linear
-- method type : MemberFunction
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gdk" , name = "ColorState" })
-- throws : False
-- Skip return : False

foreign import ccall "gdk_color_state_get_srgb_linear" gdk_color_state_get_srgb_linear :: 
    IO (Ptr ColorState)

-- | Returns the color state object representing the linearized sRGB color space.
-- 
-- This color state uses the primaries defined by BT.709-6 and a linear transfer function.
-- 
-- It is equivalent to the <http://developer.gnome.org/gdk/stable/class.CicpParams.html Cicp> tuple 1\/8\/0\/1.
-- 
-- See e.g. <https://www.w3.org/TR/css-color-4/#predefined-sRGB-linear the CSS Color Module>
-- for details about this colorstate.
-- 
-- /Since: 4.16/
colorStateGetSrgbLinear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ColorState
    -- ^ __Returns:__ the color state object for linearized sRGB
colorStateGetSrgbLinear :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ColorState
colorStateGetSrgbLinear  = IO ColorState -> m ColorState
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ColorState -> m ColorState) -> IO ColorState -> m ColorState
forall a b. (a -> b) -> a -> b
$ do
    Ptr ColorState
result <- IO (Ptr ColorState)
gdk_color_state_get_srgb_linear
    Text -> Ptr ColorState -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"colorStateGetSrgbLinear" Ptr ColorState
result
    ColorState
result' <- ((ManagedPtr ColorState -> ColorState)
-> Ptr ColorState -> IO ColorState
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr ColorState -> ColorState
ColorState) Ptr ColorState
result
    ColorState -> IO ColorState
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ColorState
result'

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveColorStateMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveColorStateMethod "createCicpParams" o = ColorStateCreateCicpParamsMethodInfo
    ResolveColorStateMethod "equal" o = ColorStateEqualMethodInfo
    ResolveColorStateMethod "ref" o = ColorStateRefMethodInfo
    ResolveColorStateMethod "unref" o = ColorStateUnrefMethodInfo
    ResolveColorStateMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveColorStateMethod t ColorState, O.OverloadedMethod info ColorState p) => OL.IsLabel t (ColorState -> 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 ~ ResolveColorStateMethod t ColorState, O.OverloadedMethod info ColorState p, R.HasField t ColorState p) => R.HasField t ColorState p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveColorStateMethod t ColorState, O.OverloadedMethodInfo info ColorState) => OL.IsLabel t (O.MethodProxy info ColorState) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif