GradientProtocol
public protocol GradientProtocol
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 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.
The GradientProtocol
protocol exposes the methods and properties of an underlying GtkGradient
instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see Gradient
.
Alternatively, use GradientRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkGradient
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
gradient_ptr
Default implementationTyped pointer to the underlying
GtkGradient
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkGradient
instance.Declaration
Swift
var gradient_ptr: UnsafeMutablePointer<GtkGradient>! { get }
-
Required Initialiser for types conforming to
GradientProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
addColorStop(offset:
Extension methodcolor: ) Adds a stop color to
gradient
.add_color_stop is deprecated:
GtkGradient is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func addColorStop<SymbolicColorT>(offset: Double, color: SymbolicColorT) where SymbolicColorT : SymbolicColorProtocol
-
ref()
Extension methodIncreases the reference count of
gradient
.ref is deprecated:
GtkGradient is deprecated.
Declaration
Swift
@available(*, deprecated) @discardableResult @inlinable func ref() -> GradientRef!
-
resolve(props:
Extension methodresolvedGradient: ) If
gradient
is resolvable,resolved_gradient
will be filled in with the resolved gradient as a cairo_pattern_t, andtrue
will be returned. Generally, ifgradient
can’t be resolved, it is due to it being defined on top of a named color that doesn’t exist inprops
.resolve is deprecated:
GtkGradient is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func resolve<StylePropertiesT>(props: StylePropertiesT, resolvedGradient: UnsafeMutablePointer<UnsafeMutablePointer<cairo_pattern_t>?>!) -> Bool where StylePropertiesT : StylePropertiesProtocol
-
resolveFor(context:
Extension method) Undocumented
Declaration
Swift
@inlinable func resolveFor<StyleContextT>(context: StyleContextT) -> Cairo.PatternRef! where StyleContextT : StyleContextProtocol
-
toString()
Extension methodCreates a string representation for
gradient
that is suitable for using in GTK CSS files.to_string is deprecated:
GtkGradient is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func toString() -> String!
-
unref()
Extension methodDecreases the reference count of
gradient
, freeing its memory if the reference count reaches 0.unref is deprecated:
GtkGradient is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func unref()