Modifies the current clipping path, using the nonzero winding number rule.


void CGContextClip(CGContextRef c);



A graphics context that contains a path. If the context does not have a current path, the function does nothing.


The function uses the nonzero winding number rule to calculate the intersection of the current path with the current clipping path. The path resulting from the intersection is used as the new current clipping path for subsequent painting operations.

If the current path includes any open subpaths, the paths are treated as if they were closed by calling CGContextClosePath.

Unlike the current path, the current clipping path is part of the graphics state. Therefore, to re-enlarge the paintable area by restoring the clipping path to a prior state, you must save the graphics state before you clip and restore the graphics state after you’ve completed any clipped drawing.

After determining the new clipping path, the function resets the context’s current path to an empty path.

See Also

Modifying Clipping Paths


Modifies the current clipping path, using the even-odd rule.


Sets the clipping path to the intersection of the current clipping path with the area defined by the specified rectangle.


Sets the clipping path to the intersection of the current clipping path with the region defined by an array of rectangles.


Returns the bounding box of a clipping path.


Maps a mask into the specified rectangle and intersects it with the current clipping area of the graphics context.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software