ColorProtocol

public protocol ColorProtocol

The PangoColor structure is used to represent a color in an uncalibrated RGB color-space.

The ColorProtocol protocol exposes the methods and properties of an underlying PangoColor 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.

  • ptr

    Untyped pointer to the underlying PangoColor instance.

    Declaration

    Swift

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

    Typed pointer to the underlying PangoColor instance.

    Default Implementation

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

    Declaration

    Swift

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

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

Color Record: ColorProtocol extension (methods and fields)

  • copy() Extension method

    Creates a copy of src.

    The copy should be freed with [methodPango.Color.free]. Primarily used by language bindings, not that useful otherwise (since colors can just be copied by assignment in C).

    Declaration

    Swift

    @inlinable
    func copy() -> Pango.ColorRef!
  • free() Extension method

    Frees a color allocated by [methodPango.Color.copy].

    Declaration

    Swift

    @inlinable
    func free()
  • parse(spec:) Extension method

    Fill in the fields of a color from a string specification.

    The string can either one of a large set of standard names. (Taken from the CSS Color specification, or it can be a 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.)

    Declaration

    Swift

    @inlinable
    func parse(spec: UnsafePointer<CChar>!) -> Bool
  • parseWith(alpha:spec:) Extension method

    Fill in the fields of a color from a string specification.

    The string can either one of a large set of standard names. (Taken from the CSS Color specification, 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.)

    Additionally, parse strings of the form rgba, rrggbbaa, rrrrggggbbbbaaaa, if alpha is not nil, and set alpha to the value specified by the hex digits for a. If no alpha component is found in spec, alpha is set to 0xffff (for a solid color).

    Declaration

    Swift

    @inlinable
    func parseWith(alpha: UnsafeMutablePointer<guint16>! = nil, spec: UnsafePointer<CChar>!) -> Bool
  • toString() Extension method

    Returns a textual specification of color.

    The string is in the hexadecimal form rrrrggggbbbb, where r, g and b are hex digits representing the red, green, and blue components respectively.

    Declaration

    Swift

    @inlinable
    func toString() -> String!
  • red Extension method

    value of red component

    Declaration

    Swift

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

    value of green component

    Declaration

    Swift

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

    value of blue component

    Declaration

    Swift

    @inlinable
    var blue: guint16 { get set }