gi-pango-1.0.23: Pango bindings

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

GI.Pango.Structs.Color

Contents

- Exported types
- Methods
  - Overloaded methods
  - copy
  - free
  - parse
  - parseWithAlpha
  - toString
- Properties
  - blue
  - green
  - red

Description

The `Color` structure is used to represent a color in an uncalibrated RGB color-space.

Synopsis

- newtype Color = Color (ManagedPtr Color)
- newZeroColor :: MonadIO m => m Color
- colorCopy :: (HasCallStack, MonadIO m) => Color -> m (Maybe Color)
- colorFree :: (HasCallStack, MonadIO m) => Color -> m ()
- colorParse :: (HasCallStack, MonadIO m) => Color -> Text -> m Bool
- colorParseWithAlpha :: (HasCallStack, MonadIO m) => Color -> Text -> m (Bool, Word16)
- colorToString :: (HasCallStack, MonadIO m) => Color -> m Text
- getColorBlue :: MonadIO m => Color -> m Word16
- setColorBlue :: MonadIO m => Color -> Word16 -> m ()
- getColorGreen :: MonadIO m => Color -> m Word16
- setColorGreen :: MonadIO m => Color -> Word16 -> m ()
- getColorRed :: MonadIO m => Color -> m Word16
- setColorRed :: MonadIO m => Color -> Word16 -> m ()

# Exported types

newtype Color Source #

Memory-managed wrapper type.

Constructors

Color (ManagedPtr Color) |

#### Instances

Instances details

Eq Color Source # |
Instance details Defined in GI.Pango.Structs.Color Methods (==) :: Color -> Color -> Bool # (/=) :: Color -> Color -> Bool #
GBoxed Color Source # |
Instance details Defined in GI.Pango.Structs.Color
TypedObject Color Source # |
Instance details Defined in GI.Pango.Structs.Color Methods glibType :: IO GType Source #
ManagedPtrNewtype Color Source # |
Instance details Defined in GI.Pango.Structs.Color Methods toManagedPtr :: Color -> ManagedPtr Color Source #
IsGValue Color Source # | Convert `Color` to and from `GValue` with `toGValue` and `fromGValue`.
Instance details Defined in GI.Pango.Structs.Color Methods toGValue :: Color -> IO GValue Source # fromGValue :: GValue -> IO Color Source #
HasParentTypes Color Source # |
Instance details Defined in GI.Pango.Structs.Color
tag ~ 'AttrSet => Constructible Color tag Source # |
Instance details Defined in GI.Pango.Structs.Color Methods new :: MonadIO m => (ManagedPtr Color -> Color) -> [AttrOp Color tag] -> m Color Source #
type ParentTypes Color Source # |
Instance details Defined in GI.Pango.Structs.Color type ParentTypes Color = '[] :: [Type]

newZeroColor :: MonadIO m => m Color Source #

Construct a `Color` struct initialized to zero.

# Methods

## Overloaded methods

## copy

colorCopy Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Color | `src`: color to copy, may be `Nothing`
-> m (Maybe Color) | Returns: the newly allocated `Color`, which should be freed with `colorFree`, or `Nothing` if `src` was `Nothing`.

Creates a copy of `src`, which should be freed with `colorFree`. Primarily used by language bindings, not that useful otherwise (since colors can just be copied by assignment in C).

## free

colorFree Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Color | `color`: an allocated `Color`, may be `Nothing`
-> m () |

Frees a color allocated by `colorCopy`.

## parse

colorParse Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Color | `color`: a `Color` structure in which to store the result, or `Nothing`
-> Text | `spec`: a string specifying the new color
-> m Bool | Returns: `True` if parsing of the specifier succeeded, otherwise false.

Fill in the fields of a color from a string specification. The string can either one of a large set of standard names. (Taken from the CSS <ulink url="http://dev.w3.org/csswg/css-color/`named`-colors">specification</ulink>), or it can be a hexadecimal value in the form '&num;rgb' '&num;rrggbb' '&num;rrrgggbbb' or '&num;rrrrggggbbbb' where 'r', 'g' and 'b' are hex digits of the red, green, and blue components of the color, respectively. (White in the four forms is '&num;fff' '&num;ffffff' '&num;fffffffff' and '&num;ffffffffffff')

## parseWithAlpha

colorParseWithAlpha Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Color | `color`: a `Color` structure in which to store the result, or `Nothing`
-> Text | `spec`: a string specifying the new color
-> m (Bool, Word16) | Returns: `True` if parsing of the specifier succeeded, otherwise false.

Fill in the fields of a color from a string specification. The string can either one of a large set of standard names. (Taken from the CSS <ulink url="http://dev.w3.org/csswg/css-color/`named`-colors">specification</ulink>), or it can be a hexadecimal value in the form '&num;rgb' '&num;rrggbb' '&num;rrrgggbbb' or '&num;rrrrggggbbbb' where 'r', 'g' and 'b' are hex digits of the red, green, and blue components of the color, respectively. (White in the four forms is '&num;fff' '&num;ffffff' '&num;fffffffff' and '&num;ffffffffffff')

Additionally, parse strings of the form '&num;rgba', '&num;rrggbbaa', '&num;rrrrggggbbbbaaaa', if `alpha` is not `Nothing`, and set `alpha` to the value specified by the hex digits for 'a'. If no alpha component is found in `spec`, `alpha` is set to 0xffff (for a solid color).

Since: 1.46

## toString

colorToString Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Color | `color`: a `Color`
-> m Text | Returns: a newly-allocated text string that must be freed with `free`.

Returns a textual specification of `color` in the hexadecimal form <literal>&num;rrrrggggbbbb</literal>, where <literal>r</literal>, <literal>g</literal> and <literal>b</literal> are hex digits representing the red, green, and blue components respectively.

Since: 1.16

# Properties

## blue

value of blue component

getColorBlue :: MonadIO m => Color -> m Word16 Source #

Get the value of the “`blue`” field. When overloading is enabled, this is equivalent to

    get color #blue

setColorBlue :: MonadIO m => Color -> Word16 -> m () Source #

Set the value of the “`blue`” field. When overloading is enabled, this is equivalent to

    set color [ #blue := value ]

## green

value of green component

getColorGreen :: MonadIO m => Color -> m Word16 Source #

Get the value of the “`green`” field. When overloading is enabled, this is equivalent to

    get color #green

setColorGreen :: MonadIO m => Color -> Word16 -> m () Source #

Set the value of the “`green`” field. When overloading is enabled, this is equivalent to

    set color [ #green := value ]

## red

value of red component

getColorRed :: MonadIO m => Color -> m Word16 Source #

Get the value of the “`red`” field. When overloading is enabled, this is equivalent to

    get color #red

setColorRed :: MonadIO m => Color -> Word16 -> m () Source #

Set the value of the “`red`” field. When overloading is enabled, this is equivalent to

    set color [ #red := value ]