Caution: This version of this document is no longer maintained. For the latest documentation, see


Add a clipping rectangle to the stack


int PtClipAdd( PtWidget_t *widget, 
               PhRect_t *rect );


This function adds a clipping rectangle to the clipping stack. The rectangle added to the clipping stack is the intersection of the last rectangle on the stack and the rectangle defined in the PhRect_t pointed to by rect.

Prior to entering a widget's Draw method, the canvas rectangle derived from the PtBasic-class level is pushed onto the clipping stack. This prevents any children from drawing beyond the canvas of the parent container.

A widget can, however, draw beyond its own canvas or extent unless additional clipping is performed. PtAttemptResize() and PtResizeCanvas() set the Pt_UCLIP bit of a widget's resize flags if the widget requires additional clipping (to prevent it from drawing beyond its own canvas).


The current level of stack clipping.



Interrupt handler No
Signal handler No
Thread No

See also:

PhRect_t, PtCalcCanvas(), PtClipRemove()

PtAttemptResize(), PtResizeCanvas() in Building Custom Widgets