AppleCGColor - UBogun/Xojo-iosLib GitHub Wiki
Inherits from AppleCFObject
Memory leak check: not yet done
Status: Almost complete, pattern missing
CGColor is the CoreGraphics color object. Higher level Apple APIs demand a UIColor usually. CGColor is not toll-free bridgeable with it but you will find conversion methods between both.
In contrast to Xojos Color data type CGColor uses a colorspace, which means you can create real grayscale as well as CMYK colors.
Please note that while Xojo colors use one byte Integer values for each color property, Apple uses a double ranging between 0 and 1.
##Constructors Constructor (aColor As Color): Creates a new AppleCGColor from a Xojo color.
Constructor (gray as Double, alpha as double): Creates a new grayscale color.
Constructor (red as Double, green as Double, blue as double, alpha as double): Creates a new RGB color.
Constructor (cyan as Double, magenta as Double, yellow as double, black as double, alpha as double): Creates a new CMYK color.
##Properties The following color properties are only available in their respective ColorSpace, meaning you can only read the gray value if you examine a CGColor that was created with grayscale colorspace. In each other case they will return 0.
Alpha, Black, Blue, Cyan, Gray, Green, Magenta, Red, Yellow As Double (read-only): The color property value if the color is of the matching colorspace.
ColorSpace As AppleCGColorSpace (read-only): Guess what?
NumberOfComponents As UInteger (read-only): The number of color components including Alpha. So for a grayscale color, this property will be 2, 4 for RGB and 5 for CMYK.
toColor As Color: Convenience property for transformations into Xojo color.
##Methods Copy() As AppleCGColor: Returns a copy of the color.
ChangeAlpha (Alpha As Double) As AppleCGColor: Returns a copy of the color with a new alpha value.
Equals (anotherColor As AppleCGColor) As Boolean: Returns true if both colors are the same.
##Shared Properties BlackColor, ClearColor, WhiteColor As AppleCGColor (read-only): Fast access to predefined colors.
##Shared Methods FromColor (aColor As Color) As AppleCGColor: Convenience class method for getting a CGColor from a Xojo Color.