Platforms to show: All Mac Windows Linux Cross-Platform
Back to CGGradientMBS class.
CGGradientMBS.CreateWithColorComponents(colorSpace as CGColorSpaceMBS, components() as Double) as CGGradientMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | CoreGraphics | MBS MacCG Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
space: The color space to use for the gradient. You cannot use a pattern or indexed color space.
components: The color components for each color that defines the gradient. The components should be in the color space specified by space. If you are unsure of the number of components, you can call the function CGColorSpaceMBS.NumberOfComponents.
The number of items in this array should be the product of count and the number of components in the color space. For example, if the color space is an RGBA color space and you want to use two colors in the gradient (one for a starting location and another for an ending location), then you need to provide 8 values in components—red, green, blue, and alpha values for the first color, followed by red, green, blue, and alpha values for the second color.
locations: Optional, The location for each color provided in components. Each location must be a CGFloat value in the range of 0 to 1, inclusive. If 0 and 1 are not in the locations array, Quartz uses the colors provided that are closest to 0 and 1 for those locations.
If locations is not passed, the first color in colors is assigned to location 0, the last color incolors is assigned to location 1, and intervening colors are assigned locations that are at equal intervals in between.
Available in Mac OS X v10.5 and later.
See also:
Some examples using this method:
CGGradientMBS.CreateWithColorComponents(colorSpace as CGColorSpaceMBS, components() as Double, locations() as Double) as CGGradientMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | CoreGraphics | MBS MacCG Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
space: The color space to use for the gradient. You cannot use a pattern or indexed color space.
components: The color components for each color that defines the gradient. The components should be in the color space specified by space. If you are unsure of the number of components, you can call the function CGColorSpaceMBS.NumberOfComponents.
The number of items in this array should be the product of count and the number of components in the color space. For example, if the color space is an RGBA color space and you want to use two colors in the gradient (one for a starting location and another for an ending location), then you need to provide 8 values in components—red, green, blue, and alpha values for the first color, followed by red, green, blue, and alpha values for the second color.
locations: Optional, The location for each color provided in components. Each location must be a CGFloat value in the range of 0 to 1, inclusive. If 0 and 1 are not in the locations array, Quartz uses the colors provided that are closest to 0 and 1 for those locations.
If locations is not passed, the first color in colors is assigned to location 0, the last color incolors is assigned to location 1, and intervening colors are assigned locations that are at equal intervals in between.
Available in Mac OS X v10.5 and later.
See also:
CGGradientMBS.CreateWithColors(colorSpace as CGColorSpaceMBS, colors() as CGColorMBS) as CGGradientMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | CoreGraphics | MBS MacCG Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
space: The color space to use for the gradient. You cannot use a pattern or indexed color space. Can be nil.
colors: A non-empty array of CGColorMBS objects that should be in the color space specified by space. If space is not nil, each color will be converted (if necessary) to that color space and the gradient will drawn in that color space. Otherwise, each color will be converted to and drawn in the GenericRGB color space.
locations: Optional. The location for each color provided in colors; each location must be a CGFloat value in the range of 0 to 1, inclusive. If 0 and 1 are not in the locations array, Quartz uses the colors provided that are closest to 0 and 1 for those locations.
If locations is missing, the first color in colors is assigned to location 0, the last color incolors is assigned to location 1, and intervening colors are assigned locations that are at equal intervals in between.
The locations array should contain the same number of items as the colors array.
Available in Mac OS X v10.5 and later.
See also:
Some examples using this method:
CGGradientMBS.CreateWithColors(colorSpace as CGColorSpaceMBS, colors() as CGColorMBS, locations() as Double) as CGGradientMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | CoreGraphics | MBS MacCG Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
space: The color space to use for the gradient. You cannot use a pattern or indexed color space. Can be nil.
colors: A non-empty array of CGColorMBS objects that should be in the color space specified by space. If space is not nil, each color will be converted (if necessary) to that color space and the gradient will drawn in that color space. Otherwise, each color will be converted to and drawn in the GenericRGB color space.
locations: Optional. The location for each color provided in colors; each location must be a CGFloat value in the range of 0 to 1, inclusive. If 0 and 1 are not in the locations array, Quartz uses the colors provided that are closest to 0 and 1 for those locations.
If locations is missing, the first color in colors is assigned to location 0, the last color incolors is assigned to location 1, and intervening colors are assigned locations that are at equal intervals in between.
The locations array should contain the same number of items as the colors array.
Available in Mac OS X v10.5 and later.
See also:
The items on this page are in the following plugins: MBS MacCG Plugin.