# cdCanvasClip

Definition: | include pGUI.e integer prev_mode = cdCanvasClip(cdCanvas canvas, integer mode)
Description: | The clipping area is an area that limits the available drawing area inside the canvas. Any primitive is drawn only inside the clipping area. It affects all primitives. You can set the clipping area by using the function cdCanvasClipArea, and retrieve it using cdCanvasGetClipArea (see below). The clipping area is a rectangle by default, but it can have other shapes. In some drivers a polygon area can be defined, and in display based drivers a complex region can be defined. The complex region can be a combination of boxes, polygons, sectors, chords and texts. The cdCanvasClip function activates and deactivates the clipping. Returns the previous status. Values: CD_CLIPAREA, CD_CLIPPOLYGON, CD_CLIPREGION or CD_CLIPOFF. The value CD_QUERY simply returns the current status. Default value: CD_CLIPOFF. The value CD_CLIPAREA activates a rectangular area as the clipping region. The value CD_CLIPPOLYGON activates a polygon as a clipping region, but works only in some drivers (please refer to the notes of each driver). The clipping polygon must be defined before activating the polygon clipping; if it is not defined, the current clipping state remains unchanged. See the documentation of cdCanvasBegin(canvas, CD_CLIP), cdCanvasVertex(), and cdCanvasEnd() to create a polygon. The value CD_CLIPREGION activates a complex clipping region. See the documentation of Regions. The defined clipping area, polygon and complex regions are stored internally, so you may define them independently and switch between area, polygon and complex region without having to define them again. Also if the active clipping region is re-defined it immediately becomes the current clipping region.
pwa/p2js: | Not supported.
Auxillary functions: | cdCanvasClipArea(cdCanvas canvas, atom xmin, xmax, ymin, ymax) Defines the current rectangle for clipping. Only the points in the interval xmin<= x <= xmax and ymin <= y <= ymax will be printed. Default region: (0, w-1, 0, h-1). Uses the C function cdfCanvasClipArea, which is not separately wrapped. atom {mode, xmin, xmax, ymin, ymax} = cdCanvasGetClipArea(cdCanvas canvas) Returns the rectangle and the clipping status. Uses the C function cdfCanvasGetClipArea, which is not separately wrapped. wdCanvasClipArea() and wdCanvasGetClipArea() are identical, except of course the arguments are in world coordinates.