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.
-
Untyped pointer to the underlying
GdkColor
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
color_ptr
Default implementationTyped 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)
-
copy()
Extension methodMakes 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 methodFrees a
GdkColor
created withgdk_color_copy()
.free is deprecated: Use #GdkRGBA
Declaration
Swift
@available(*, deprecated) @inlinable func free()
-
hash()
Extension methodA 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 methodReturns 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
, andblue
fields of aGdkColor
.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 ofcr
.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
, andblue
fields of aGdkColor
.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 methodFor 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 methodThe 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 methodThe green component of the color
Declaration
Swift
@inlinable var green: guint16 { get set }
-
blue
Extension methodThe blue component of the color
Declaration
Swift
@inlinable var blue: guint16 { get set }