Gtk.Gradient

Entities

Tagged Types

Constants

Subprograms

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 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 Gtk_Gradients, since they are mostly used behind the scenes by Gtk.Style_Context.Gtk_Style_Context and Gtk.Css_Provider.Gtk_Css_Provider.

Gtk.Gradient.Gtk_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.

Add_Color_Stop

procedure Add_Color_Stop
   (Self   : Gtk_Gradient;
    Offset : Gdouble;
    Color  : Gtk.Symbolic_Color.Gtk_Symbolic_Color)

Adds a stop color to Gradient. Since: gtk+ 3.0 Deprecated since 3.8, 1

Parameters
Self
Offset

offset for the color stop

Color

color to use

From_Object

function From_Object (Object : System.Address) return Gtk_Gradient
Parameters
Object
Return Value

From_Object_Free

function From_Object_Free (B : access Gtk_Gradient'Class) return Gtk_Gradient
Parameters
B
Return Value

Get_Type

function Get_Type return Glib.GType
Return Value

Gtk_Gradient

type Gtk_Gradient is new Glib.C_Boxed with null record;

Gtk_Gradient_New_Linear

function Gtk_Gradient_New_Linear
   (X0 : Gdouble;
    Y0 : Gdouble;
    X1 : Gdouble;
    Y1 : Gdouble) return Gtk_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. Since: gtk+ 3.0

Parameters
X0

X coordinate of the starting point

Y0

Y coordinate of the starting point

X1

X coordinate of the end point

Y1

Y coordinate of the end point

Return Value

Gtk_Gradient_New_Radial

function Gtk_Gradient_New_Radial
   (X0      : Gdouble;
    Y0      : Gdouble;
    Radius0 : Gdouble;
    X1      : Gdouble;
    Y1      : Gdouble;
    Radius1 : Gdouble) return Gtk_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. Since: gtk+ 3.0

Parameters
X0

X coordinate of the start circle

Y0

Y coordinate of the start circle

Radius0

radius of the start circle

X1

X coordinate of the end circle

Y1

Y coordinate of the end circle

Radius1

radius of the end circle

Return Value

Gtk_New_Linear

procedure Gtk_New_Linear
   (Self : out Gtk_Gradient;
    X0   : Gdouble;
    Y0   : Gdouble;
    X1   : Gdouble;
    Y1   : Gdouble)

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. Since: gtk+ 3.0

Parameters
Self
X0

X coordinate of the starting point

Y0

Y coordinate of the starting point

X1

X coordinate of the end point

Y1

Y coordinate of the end point

Gtk_New_Radial

procedure Gtk_New_Radial
   (Self    : out Gtk_Gradient;
    X0      : Gdouble;
    Y0      : Gdouble;
    Radius0 : Gdouble;
    X1      : Gdouble;
    Y1      : Gdouble;
    Radius1 : Gdouble)

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. Since: gtk+ 3.0

Parameters
Self
X0

X coordinate of the start circle

Y0

Y coordinate of the start circle

Radius0

radius of the start circle

X1

X coordinate of the end circle

Y1

Y coordinate of the end circle

Radius1

radius of the end circle

Null_Gtk_Gradient

Null_Gtk_Gradient : constant Gtk_Gradient;

Ref

function Ref (Self : Gtk_Gradient) return Gtk_Gradient

Increases the reference count of Gradient. Since: gtk+ 3.0 Deprecated since 3.8, 1

Parameters
Self
Return Value

The same Gradient

Resolve

function Resolve
   (Self              : Gtk_Gradient;
    Props             : not null access Gtk.Style_Properties.Gtk_Style_Properties_Record'Class;
    Resolved_Gradient : access Cairo.Cairo_Pattern) return Boolean

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. Since: gtk+ 3.0 Deprecated since 3.8, 1

Parameters
Self
Props

Gtk.Style_Properties.Gtk_Style_Properties to use when resolving named colors

Resolved_Gradient

return location for the resolved pattern

Return Value

True if the gradient has been resolved

Resolve_For_Context

function Resolve_For_Context
   (Self    : Gtk_Gradient;
    Context : not null access Gtk.Style_Context.Gtk_Style_Context_Record'Class)
    return Cairo.Cairo_Pattern
Parameters
Self
Context
Return Value

To_String

function To_String (Self : Gtk_Gradient) return UTF8_String

Creates a string representation for Gradient that is suitable for using in GTK CSS files. Deprecated since 3.8, 1

Parameters
Self
Return Value

A string representation for Gradient

Unref

procedure Unref (Self : Gtk_Gradient)

Decreases the reference count of Gradient, freeing its memory if the reference count reaches 0. Since: gtk+ 3.0 Deprecated since 3.8, 1

Parameters
Self