Name

CanvasRenderingContext2D.clip( ): set the clipping path of a canvas

Synopsis

void clip( )

Description

This method clips the current path using the current clipping path and then uses the clipped path as the new clipping path. Note that there is no way to enlarge the clipping path. If you want a temporary clipping path, you should first call save( ) in order to use restore( ) to restore the original clipping path. The default clipping path for a canvas is the canvas rectangle itself.

This method resets the current path so that it is empty.

Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.