NSGradient class provides support for drawing gradient fill colors, also known as shadings in Quartz. This class provides convenience methods for drawing radial or linear (axial) gradients for rectangles and
NSBezierPath objects. It also supports primitive methods that let you customize the shape of the gradient fill.
- macOS 10.5+
A gradient consists of two or more color changes over the range of the gradient shape. When creating a gradient object, you specify the colors and their locations relative to the start and end of the gradient. This combination of color and location is known as a color stop. During drawing, the
NSGradient object uses the color stop information to compute color changes for you and passes that information to the Quartz shading functions.
NSGradient class uses Quartz shadings, drawing is handled by computing the colors at a given point mathematically. This technique results in smooth gradients regardless of the resolution of the target device.