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.
-
Untyped pointer to the underlying
PangoColor
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
color_ptr
Default implementationTyped 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)
-
copy()
Extension methodCreates a copy of
src
.The copy should be freed with [method
Pango.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 methodFrees a color allocated by [method
Pango.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
orrrrrggggbbbb
, wherer
,g
andb
are hex digits of the red, green, and blue components of the color, respectively. (White in the four forms isfff
,ffffff
,fffffffff
andffffffffffff
.)Declaration
Swift
@inlinable func parse(spec: UnsafePointer<CChar>!) -> Bool
-
parseWith(alpha:
Extension methodspec: ) 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
orrrrrggggbbbb
wherer
,g
andb
are hex digits of the red, green, and blue components of the color, respectively. (White in the four forms isfff
,ffffff
,fffffffff
andffffffffffff
.)Additionally, parse strings of the form
rgba
,rrggbbaa
,rrrrggggbbbbaaaa
, ifalpha
is notnil
, and setalpha
to the value specified by the hex digits fora
. If no alpha component is found inspec
,alpha
is set to 0xffff (for a solid color).Declaration
Swift
@inlinable func parseWith(alpha: UnsafeMutablePointer<guint16>! = nil, spec: UnsafePointer<CChar>!) -> Bool
-
toString()
Extension methodReturns a textual specification of
color
.The string is in the hexadecimal form
rrrrggggbbbb
, wherer
,g
andb
are hex digits representing the red, green, and blue components respectively.Declaration
Swift
@inlinable func toString() -> String!
-
red
Extension methodvalue of red component
Declaration
Swift
@inlinable var red: guint16 { get set }
-
green
Extension methodvalue of green component
Declaration
Swift
@inlinable var green: guint16 { get set }
-
blue
Extension methodvalue of blue component
Declaration
Swift
@inlinable var blue: guint16 { get set }