Gradient
Object Hierarchy:
Description:
[ CCode ( ref_function = "gtk_gradient_ref" , type_id = "gtk_gradient_get_type ()" , unref_function = "gtk_gradient_unref" ) ]
[ Compact ]
[ Version ( deprecated = true , deprecated_since = "3.8" ) ]
public class Gradient
Warning: Gradient is deprecated since 3.8.
GtkGradient is a boxed type that represents a gradient.
It is the result of parsing a gradient expression. To obtain the gradient represented by a GtkGradient, it has to be resolved
with resolve, which replaces all symbolic color references by the colors they refer
to (in a given context) and constructs a RasterSourcePattern value.
It is not normally necessary to deal directly with Gradients, 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.
Content:
Creation methods:
- public Gradient.linear (double x0, double y0, double x1, double y1)
Creates a new linear gradient along the line defined by (x0, y0) and (
x1, y1).
- public Gradient.radial (double x0, double y0, double radius0, double x1, double y1, double radius1)
Creates a new radial gradient along the two circles defined by (x0,
y0, radius0) and (x1, y1, radius1).
Methods:
- public unowned Gradient @ref ()
Increases the reference count of this
.
- public void add_color_stop (double offset, SymbolicColor color)
Adds a stop color to this.
- public bool resolve (StyleProperties props, out Pattern resolved_gradient)
If this is resolvable,
resolved_gradient will be filled in with the resolved gradient as a cairo_pattern_t, and true
will be returned.
- public Pattern resolve_for_context (StyleContext context)
- public string to_string ()
Creates a string representation for this
that is suitable for using in GTK CSS files.
- public void unref ()
Decreases the reference count of this
, freeing its memory if the reference count reaches 0.