Gjsify LogoGjsify Logo

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 gtk_gradient_resolve(), which replaces all symbolic color references by the colors they refer to (in a given context) and constructs a #cairo_pattern_t value.

It is not normally necessary to deal directly with #GtkGradients, since they are mostly used behind the scenes by #GtkStyleContext and #GtkCssProvider.

#GtkGradient 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.

record

Hierarchy

  • Gradient

Index

Constructors

Properties

name: string

Methods

  • If gradient is resolvable, resolved_gradient 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.

    Parameters

    • props: StyleProperties

      #GtkStyleProperties to use when resolving named colors

    Returns [boolean, cairo.Pattern]

  • toString(): string
  • Creates a string representation for gradient that is suitable for using in GTK CSS files.

    Returns string

  • unref(): void
  • Decreases the reference count of gradient, freeing its memory if the reference count reaches 0.

    Returns void

  • newLinear(x0: number, y0: number, x1: number, y1: number): Gradient
  • 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 gtk_gradient_add_color_stop().

    Parameters

    • x0: number

      X coordinate of the starting point

    • y0: number

      Y coordinate of the starting point

    • x1: number

      X coordinate of the end point

    • y1: number

      Y coordinate of the end point

    Returns Gradient

  • newRadial(x0: number, y0: number, radius0: number, x1: number, y1: number, radius1: number): Gradient
  • 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 gtk_gradient_add_color_stop().

    Parameters

    • x0: number

      X coordinate of the start circle

    • y0: number

      Y coordinate of the start circle

    • radius0: number

      radius of the start circle

    • x1: number

      X coordinate of the end circle

    • y1: number

      Y coordinate of the end circle

    • radius1: number

      radius of the end circle

    Returns Gradient

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method