Platforms to show: All Mac Windows Linux Cross-Platform
CGGradientMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | CoreGraphics | MBS MacCG Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The CGGradientMBS class, and the functions that operate on it, make creating and using radial and axial gradient fills an easy task. A CGGradient object has a color space, two or more colors, and a location for each color. The color space cannot be a pattern or indexed color space, otherwise it can be any Quartz color space (CGColorSpaceMBS).
Colors can be provided as component values (such as red, green, blue) or as Quartz color objects (CGColorMBS). In Quartz, component can vary from 0.0 to 1.0, designating the proportion of the component present in the color.
A location is a normalized value. When it comes time to paint the gradient, Quartz maps the normalized location values to the points in coordinate space that you provide.
If you want more precise control over gradients, or if your application runs in versions of Mac OS X that are earlier than v10.5, see CGShadingMBS.
Requires Mac OS X 10.5.
- property Handle as Integer
- 4 shared methods
- shared method CreateWithColorComponents(colorSpace as CGColorSpaceMBS, components() as Double) as CGGradientMBS
- shared method CreateWithColorComponents(colorSpace as CGColorSpaceMBS, components() as Double, locations() as Double) as CGGradientMBS
- shared method CreateWithColors(colorSpace as CGColorSpaceMBS, colors() as CGColorMBS) as CGGradientMBS
- shared method CreateWithColors(colorSpace as CGColorSpaceMBS, colors() as CGColorMBS, locations() as Double) as CGGradientMBS
- 2 constants
Gradient Drawing Options
Constant | Value | Description |
---|---|---|
kCGGradientDrawsAfterEndLocation | 2 | The fill should extend beyond the ending location. The color that extends beyond the ending point is the solid color defined by the CGGradient object to be at location 1. more |
kCGGradientDrawsBeforeStartLocation | 1 | The fill should extend beyond the starting location. The color that extends beyond the starting point is the solid color defined by the CGGradient object to be at location 0. more |
This class has no sub classes.
Some methods using this class:
- CGContextMBS.DrawLinearGradient(gradient as CGGradientMBS, startPoint as CGPointMBS, endPoint as CGPointMBS, options as Integer)
- CGContextMBS.DrawRadialGradient(gradient as CGGradientMBS, startCenter as CGPointMBS, startRadius as Double, endCenter as CGPointMBS, endRadius as Double, options as Integer)
Some examples using this class:
Blog Entries
- MBS Xojo / Real Studio Plugins, version 14.4pr6
- MBS Real Studio Plugins, version 13.1fc1
- MBS REALbasic Plugins, version 11.2pr1
The items on this page are in the following plugins: MBS MacCG Plugin.
CGFunctionMBS - CGImageDestinationMBS