ColorProtocol

public protocol ColorProtocol

The ColorProtocol protocol exposes the methods and properties of an underlying GdkColor 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 Color. Alternatively, use ColorRef as a lighweight, unowned reference if you already have an instance you just want to use.

A GdkColor is used to describe a color, similar to the XColor struct used in the X11 drawing API.

  • ptr

    Untyped pointer to the underlying GdkColor instance.

    Declaration

    Swift

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

    Typed pointer to the underlying GdkColor instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GdkColor instance.

    Declaration

    Swift

    var color_ptr: UnsafeMutablePointer<GdkColor>! { get }
  • Required Initialiser for types conforming to ColorProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

Color Record: ColorProtocol extension (methods and fields)

  • copy() Extension method

    Makes a copy of a GdkColor.

    The result must be freed using gdk_color_free().

    copy is deprecated: Use #GdkRGBA

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func copy() -> ColorRef!
  • equal(colorb:) Extension method

    Compares two colors.

    equal is deprecated: Use #GdkRGBA

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func equal<ColorT>(colorb: ColorT) -> Bool where ColorT : ColorProtocol
  • free() Extension method

    Frees a GdkColor created with gdk_color_copy().

    free is deprecated: Use #GdkRGBA

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func free()
  • hash() Extension method

    A hash function suitable for using for a hash table that stores GdkColors.

    hash is deprecated: Use #GdkRGBA

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func hash() -> Int
  • toString() Extension method

    Returns a textual specification of color in the hexadecimal form “`rrrrggggbbbb`” where “r”, “g” and “b” are hex digits representing the red, green and blue components respectively.

    The returned string can be parsed by gdk_color_parse().

    to_string is deprecated: Use #GdkRGBA

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func toString() -> String!
  • parse(spec:) Extension method

    Parses a textual specification of a color and fill in the red, green, and blue fields of a GdkColor.

    The string can either one of a large set of standard names (taken from the X11 rgb.txt file), or it can be a hexadecimal value in the form “`rgb” “\rrggbb”, “\rrrgggbbb” or “\rrrrggggbbbb” where “r”, “g” and “b” are hex digits of the red, green, and blue components of the color, respectively. (White in the four forms is “\fff”, “\ffffff”, “\fffffffff” and “\ffffffffffff`”).

    parse is deprecated: Use #GdkRGBA

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func parse(spec: UnsafePointer<gchar>!) -> Bool
  • cairoSetSourceColor(cr:) Extension method

    Sets the specified GdkColor as the source color of cr.

    cairo_set_source_color is deprecated: Use gdk_cairo_set_source_rgba() instead

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func cairoSetSourceColor<ContextT>(cr: ContextT) where ContextT : ContextProtocol
  • colorParse(spec:) Extension method

    Parses a textual specification of a color and fill in the red, green, and blue fields of a GdkColor.

    The string can either one of a large set of standard names (taken from the X11 rgb.txt file), or it can be a hexadecimal value in the form “`rgb” “\rrggbb”, “\rrrgggbbb” or “\rrrrggggbbbb” where “r”, “g” and “b” are hex digits of the red, green, and blue components of the color, respectively. (White in the four forms is “\fff”, “\ffffff”, “\fffffffff” and “\ffffffffffff`”).

    color_parse is deprecated: Use #GdkRGBA

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func colorParse(spec: UnsafePointer<gchar>!) -> Bool
  • pixel Extension method

    For allocated colors, the pixel value used to draw this color on the screen. Not used anymore.

    Declaration

    Swift

    @inlinable
    var pixel: guint32 { get set }
  • red Extension method

    The red component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity

    Declaration

    Swift

    @inlinable
    var red: guint16 { get set }
  • green Extension method

    The green component of the color

    Declaration

    Swift

    @inlinable
    var green: guint16 { get set }
  • blue Extension method

    The blue component of the color

    Declaration

    Swift

    @inlinable
    var blue: guint16 { get set }