Gradient

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

Constructors

this
this(void* ptr, Flag!"Take" take)

Members

Functions

_cPtr
void* _cPtr(Flag!"Dup" dup)
addColorStop
void addColorStop(double offset, gtk.symbolic_color.SymbolicColor color)

Adds a stop color to gradient.

resolve
bool resolve(gtk.style_properties.StyleProperties props, cairo.pattern.Pattern resolvedGradient)

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.

resolveForContext
cairo.pattern.Pattern resolveForContext(gtk.style_context.StyleContext context)
self
Gradient self()

Returns this, for use in with statements.

toString_
string toString_()

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

Properties

_gType
GType _gType [@property getter]

Static functions

_getGType
GType _getGType()
newLinear
gtk.gradient.Gradient newLinear(double x0, double y0, double x1, double y1)

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.Gradient.addColorStop.

newRadial
gtk.gradient.Gradient newRadial(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). Before using the gradient a number of stop colors must be added through gtk.gradient.Gradient.addColorStop.

Inherited Members

From Boxed

_cInstancePtr
void* _cInstancePtr;

Pointer to the C boxed value

_getGType
GType _getGType()

Get the GType of this boxed type.

_gType
GType _gType [@property getter]

Boxed GType property.

self
Boxed self()

Convenience method to return this cast to a type. For use in D with statements.

boxCopy
void* boxCopy()

Make a copy of the wrapped C boxed data.

boxedCopy
void* boxedCopy(void* cBoxed)

Copy a C boxed value using g_boxed_copy.

boxedFree
void boxedFree(void* cBoxed)

Free a C boxed value using g_boxed_free.