NSGradient
An object that can draw gradient fill colors
Declaration
class NSGradientOverview
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. 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.
Because the 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.
For more information about gradients and their appearance, see Gradients in Quartz 2D Programming Guide.
Topics
Creating a Gradient
init(starting:ending:)init(colors:)init(colorsAndLocations:)init(colors:atLocations:colorSpace:)init(coder:)
Drawing a Linear Gradient
Drawing a Radial Gradient
draw(fromCenter:radius:toCenter:radius:options:)draw(in:relativeCenterPosition:)draw(in:relativeCenterPosition:)