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

PgSetClipping(), PgSetClippingCx()

Limit the extent of drawing


void PgSetClipping( unsigned short n,
                    PhRect_t const *rects );

void PgSetClippingCx( PhGC_t *gc,
                      unsigned short n,
                      PhRect_t const *rects );




These functions let you limit the extent of drawing by specifying which rectangles to draw in. Note that you can never draw outside of the current region.

PgSetClipping() works on the current graphics context, while you can specify the graphics context gc for PgSetClippingCx().

The n argument contains the number of clip rectangles; rects is an array of n clip rectangles, relative to the origin of the current region. To reset the clipping rectangle to the full size of the region, you should pass 0 rectangles.

All subsequent draws will be clipped to the intersection of the clipping rectangles set by PgSetClipping*(), PgSetMultiClip*(), and PgSetUserClip*(), and PgSetRegion*().

Note: PhAttach(), PhReattach(), and PgSetRegion*() reset the clipping rectangle to the full size of the region.

Don't call PgSetClipping*() in a widget's draw function; use PgSetMultiClip*(), PtClipAdd(), and PtClipRemove() instead.

This function flushes the draw buffer.



Interrupt handler No
Signal handler No
Thread No

See also:

PgFlush*(), PgSetMultiClip*(), PgSetRegion*(), PgSetUserClip*(), PhAttach(), PhReattach() PhRect_t, PtClipAdd(), PtClipRemove()