gi-pango-1.0.24: Pango bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Pango.Structs.Color

Description

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

Synopsis

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

ManagedPtrNewtype Color Source # 
Instance details

Defined in GI.Pango.Structs.Color

Methods

toManagedPtr :: Color -> ManagedPtr Color

TypedObject Color Source # 
Instance details

Defined in GI.Pango.Structs.Color

Methods

glibType :: IO GType

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

IsGValue (Maybe Color) Source #

Convert Color to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Pango.Structs.Color

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe Color -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe Color)

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

Click to display all available methods, including inherited ones

Expand

Methods

copy, free, parse, parseWithAlpha, toString.

Getters

None.

Setters

None.

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 ]