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
GtkGradientinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
gradient_ptrDefault implementationTyped pointer to the underlying
GtkGradientinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkGradientinstance.Declaration
Swift
var gradient_ptr: UnsafeMutablePointer<GtkGradient>! { get } -
Required Initialiser for types conforming to
GradientProtocolDeclaration
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
gradientis resolvable,resolved_gradientwill be filled in with the resolved gradient as a cairo_pattern_t, andtruewill be returned. Generally, ifgradientcan’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
gradientthat 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()
View on GitHub
Install in Dash
GradientProtocol Protocol Reference