Instance Method

drawFromPoint:toPoint:options:

Draws a linear gradient between the specified start and end points.

Declaration

- (void)drawFromPoint:(NSPoint)startingPoint toPoint:(NSPoint)endingPoint options:(NSGradientDrawingOptions)options;

Parameters

startingPoint

The starting point for the gradient, in the local coordinate system. The gradient’s first color is drawn at this point.

endingPoint

The end point for the gradient, in the local coordinate system. The gradient’s last color is drawn at this point.

options

The gradient options, if any. You can use these options to extend the gradient size beyond the start and end points. For more information, see Gradient Drawing Options.

Discussion

This method draws the gradient color changes along the line formed by the two points. The gradient fill extends perpendicularly outward from line until it reaches the edges of the current clipping region.

This is a primitive method used by the NSGradient class to draw linear gradients. Because this method does not perform any clipping of the gradient fill pattern, you must ensure that the clipping region is configured properly if you intend to invoke this method directly. By default, the clipping region is set to the current view or window in which drawing occurs.

See Also

Primitive Drawing Methods

- drawFromCenter:radius:toCenter:radius:options:

Draws a radial gradient between the specified circles.