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.

  • ptr

    Untyped pointer to the underlying GtkGradient instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • gradient_ptr Default implementation

    Typed 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)

Gradient Record: GradientProtocol extension (methods and fields)

  • addColorStop(offset:color:) Extension method

    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 method

    Increases the reference count of gradient.

    ref is deprecated:

    GtkGradient is deprecated.

    Declaration

    Swift

    @available(*, deprecated)
    @discardableResult
    @inlinable
    func ref() -> GradientRef!
  • 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.

    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 method

    Creates 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 method

    Decreases 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()