gi-gdk4-4.0.10: Gdk bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gdk.Structs.ColorState

Contents

- Exported types
- Methods
  - createCicpParams
  - equal
  - equivalent
  - getOklab
  - getOklch
  - getRec2100Linear
  - getRec2100Pq
  - getSrgb
  - getSrgbLinear
  - ref
  - unref

Description

Provides information to interpret colors and pixels in a variety of ways.

They are also known as *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

Synopsis

- newtype ColorState = ColorState (ManagedPtr ColorState)
- colorStateCreateCicpParams :: (HasCallStack, MonadIO m) => ColorState -> m (Maybe CicpParams)
- colorStateEqual :: (HasCallStack, MonadIO m) => ColorState -> ColorState -> m Bool
- colorStateEquivalent :: (HasCallStack, MonadIO m) => ColorState -> ColorState -> m Bool
- colorStateGetOklab :: (HasCallStack, MonadIO m) => m ColorState
- colorStateGetOklch :: (HasCallStack, MonadIO m) => m ColorState
- colorStateGetRec2100Linear :: (HasCallStack, MonadIO m) => m ColorState
- colorStateGetRec2100Pq :: (HasCallStack, MonadIO m) => m ColorState
- colorStateGetSrgb :: (HasCallStack, MonadIO m) => m ColorState
- colorStateGetSrgbLinear :: (HasCallStack, MonadIO m) => m ColorState
- colorStateRef :: (HasCallStack, MonadIO m) => ColorState -> m ColorState
- colorStateUnref :: (HasCallStack, MonadIO m) => ColorState -> m ()

# Exported types

newtype ColorState Source #

Memory-managed wrapper type.

Constructors

ColorState (ManagedPtr ColorState) |

#### Instances

Instances details

Eq ColorState Source # |
Instance details Defined in GI.Gdk.Structs.ColorState Methods (==) :: ColorState -> ColorState -> Bool Source # (/=) :: ColorState -> ColorState -> Bool Source #
GBoxed ColorState Source # |
Instance details Defined in GI.Gdk.Structs.ColorState
ManagedPtrNewtype ColorState Source # |
Instance details Defined in GI.Gdk.Structs.ColorState Methods toManagedPtr :: ColorState -> ManagedPtr ColorState Source #
TypedObject ColorState Source # |
Instance details Defined in GI.Gdk.Structs.ColorState Methods glibType :: IO GType Source #
HasParentTypes ColorState Source # |
Instance details Defined in GI.Gdk.Structs.ColorState
IsGValue (Maybe ColorState) Source # | Convert `ColorState` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gdk.Structs.ColorState Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe ColorState -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe ColorState) Source #
type ParentTypes ColorState Source # |
Instance details Defined in GI.Gdk.Structs.ColorState type ParentTypes ColorState = '[] :: [Type]

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

createCicpParams, equal, equivalent, ref, unref.

#### Getters

None.

#### Setters

None.

## createCicpParams

colorStateCreateCicpParams Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> ColorState | `self`: a `GdkColorState`
-> m (Maybe CicpParams) | Returns: A new `CicpParams`

Create a `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

## equal

colorStateEqual Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> ColorState | `self`: a `GdkColorState`
-> ColorState | `other`: another `GdkColorStatee`
-> m Bool | Returns: `True` if the two color states compare equal

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

## equivalent

colorStateEquivalent Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> ColorState | `self`: a `GdkColorState`
-> ColorState | `other`: another `GdkColorStatee`
-> m Bool | Returns: `True` if the two color states are equivalent

Compares two `GdkColorStates` for equivalence.

Two objects that represent the same color state should be equivalent, even though they may not be equal in the sense of `colorStateEqual`.

Since: 4.20

## getOklab

colorStateGetOklab Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m ColorState | Returns: the color state object for oklab

Returns the color state object representing the oklab color space.

This is a perceptually uniform color state.

Since: 4.18

## getOklch

colorStateGetOklch Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m ColorState | Returns: the color state object for oklch

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

## getRec2100Linear

colorStateGetRec2100Linear Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m ColorState | Returns: the color state object for linearized rec2100

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 Cicp tuple 9/8/0/1.

See e.g. the CSS HDR Module for details about this colorstate.

Since: 4.16

## getRec2100Pq

colorStateGetRec2100Pq Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m ColorState | Returns: the color state object for rec2100-pq

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 Cicp tuple 9/16/0/1.

See e.g. the CSS HDR Module for details about this colorstate.

Since: 4.16

## getSrgb

colorStateGetSrgb Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m ColorState | Returns: the color state object for sRGB

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 Cicp tuple 1/13/0/1.

See e.g. the CSS Color Module for details about this colorstate.

Since: 4.16

## getSrgbLinear

colorStateGetSrgbLinear Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m ColorState | Returns: the color state object for linearized sRGB

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 Cicp tuple 1/8/0/1.

See e.g. the CSS Color Module for details about this colorstate.

Since: 4.16

## ref

colorStateRef Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> ColorState | `self`: a `GdkColorState`
-> m ColorState | Returns: the object that was passed in

Increase the reference count of `self`.

Since: 4.16

## unref

colorStateUnref Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> ColorState | `self`: a `GdkColorState`
-> m () |

Decrease the reference count of `self`.

Unless `self` is static, it will be freed when the reference count reaches zero.

Since: 4.16