gi-gtk-3.0.43: Gtk 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.Gtk.Structs.Gradient

Contents

- Exported types
- Methods
  - addColorStop
  - newLinear
  - newRadial
  - ref
  - resolve
  - resolveForContext
  - toString
  - unref

Description

GtkGradient is a boxed type that represents a gradient. It is the result of parsing a [gradient expression][gtkcssprovider-gradients]. To obtain the gradient represented by a GtkGradient, it has to be resolved with `gradientResolve`, which replaces all symbolic color references by the colors they refer to (in a given context) and constructs a `Pattern` value.

It is not normally necessary to deal directly with `GtkGradients`, since they are mostly used behind the scenes by `StyleContext` and `CssProvider`.

`Gradient` is deprecated. It was used internally by GTK’s CSS engine to represent gradients. As its handling is not conforming to modern web standards, it is not used anymore. If you want to use gradients in your own code, please use Cairo directly.

Synopsis

- newtype Gradient = Gradient (ManagedPtr Gradient)
- gradientAddColorStop :: (HasCallStack, MonadIO m) => Gradient -> Double -> SymbolicColor -> m ()
- gradientNewLinear :: (HasCallStack, MonadIO m) => Double -> Double -> Double -> Double -> m Gradient
- gradientNewRadial :: (HasCallStack, MonadIO m) => Double -> Double -> Double -> Double -> Double -> Double -> m Gradient
- gradientRef :: (HasCallStack, MonadIO m) => Gradient -> m Gradient
- gradientResolve :: (HasCallStack, MonadIO m, IsStyleProperties a) => Gradient -> a -> m (Bool, Pattern)
- gradientResolveForContext :: (HasCallStack, MonadIO m, IsStyleContext a) => Gradient -> a -> m Pattern
- gradientToString :: (HasCallStack, MonadIO m) => Gradient -> m Text
- gradientUnref :: (HasCallStack, MonadIO m) => Gradient -> m ()

# Exported types

newtype Gradient Source #

Memory-managed wrapper type.

Constructors

Gradient (ManagedPtr Gradient) |

#### Instances

Instances details

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

# Methods

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

Expand

#### Methods

addColorStop, ref, resolve, resolveForContext, toString, unref.

#### Getters

None.

#### Setters

None.

## addColorStop

gradientAddColorStop Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Gradient | `gradient`: a `Gradient`
-> Double | `offset`: offset for the color stop
-> SymbolicColor | `color`: color to use
-> m () |

Deprecated: (Since version 3.8)`Gradient` is deprecated.

Adds a stop color to `gradient`.

Since: 3.0

## newLinear

gradientNewLinear Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Double | `x0`: X coordinate of the starting point
-> Double | `y0`: Y coordinate of the starting point
-> Double | `x1`: X coordinate of the end point
-> Double | `y1`: Y coordinate of the end point
-> m Gradient | Returns: A newly created `Gradient`

Deprecated: (Since version 3.8)`Gradient` is deprecated.

Creates a new linear gradient along the line defined by (x0, y0) and (x1, y1). Before using the gradient a number of stop colors must be added through `gradientAddColorStop`.

Since: 3.0

## newRadial

gradientNewRadial Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Double | `x0`: X coordinate of the start circle
-> Double | `y0`: Y coordinate of the start circle
-> Double | `radius0`: radius of the start circle
-> Double | `x1`: X coordinate of the end circle
-> Double | `y1`: Y coordinate of the end circle
-> Double | `radius1`: radius of the end circle
-> m Gradient | Returns: A newly created `Gradient`

Deprecated: (Since version 3.8)`Gradient` is deprecated.

Creates a new radial gradient along the two circles defined by (x0, y0, radius0) and (x1, y1, radius1). Before using the gradient a number of stop colors must be added through `gradientAddColorStop`.

Since: 3.0

## ref

gradientRef Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Gradient | `gradient`: a `Gradient`
-> m Gradient | Returns: The same `gradient`

Deprecated: (Since version 3.8)`Gradient` is deprecated.

Increases the reference count of `gradient`.

Since: 3.0

## resolve

gradientResolve Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleProperties a) |
=> Gradient | `gradient`: a `Gradient`
-> a | `props`: `StyleProperties` to use when resolving named colors
-> m (Bool, Pattern) | Returns: `True` if the gradient has been resolved

Deprecated: (Since version 3.8)`Gradient` is deprecated.

If `gradient` is resolvable, `resolvedGradient` will be filled in with the resolved gradient as a cairo_pattern_t, and `True` will be returned. Generally, if `gradient` can’t be resolved, it is due to it being defined on top of a named color that doesn't exist in `props`.

Since: 3.0

## resolveForContext

gradientResolveForContext :: (HasCallStack, MonadIO m, IsStyleContext a) => Gradient -> a -> m Pattern Source #

No description available in the introspection data.

## toString

gradientToString Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Gradient | `gradient`: the gradient to print
-> m Text | Returns: A string representation for `gradient`

Deprecated: (Since version 3.8)`Gradient` is deprecated.

Creates a string representation for `gradient` that is suitable for using in GTK CSS files.

## unref

gradientUnref Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Gradient | `gradient`: a `Gradient`
-> m () |

Deprecated: (Since version 3.8)`Gradient` is deprecated.

Decreases the reference count of `gradient`, freeing its memory if the reference count reaches 0.

Since: 3.0