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
A gradient defines a smooth transition between colors across an area.

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.

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:

Some examples using this class:

Blog Entries


The items on this page are in the following plugins: MBS MacCG Plugin.


CGFunctionMBS   -   CGImageDestinationMBS


The biggest plugin in space...