SETCLIPRGN

Graphics Subroutine: Limits graphics output to part of the screen.

Module: USE DFLIB

Syntax

CALL SETCLIPRGN (x1, y1, x2, x2)

x1, y1
(Input) INTEGER(2). Physical coordinates for upper-left corner of clipping region.


x2, y2
(Input) INTEGER(2). Physical coordinates for lower-right corner of clipping region.

The SETCLIPRGN function limits the display of subsequent graphics output and font text output to that which fits within a designated area of the screen (the "clipping region"). The physical coordinates (x1, y1) and (x2, y2) are the upper-left and lower-right corners of the rectangle that defines the clipping region. The SETCLIPRGN function does not change the viewport-coordinate system; it merely masks graphics output to the screen.

SETCLIPRGN affects graphics and font text output only, such as OUTGTEXT. To mask the screen for text output using OUTTEXT, use SETTEXTWINDOW.

Compatibility

STANDARD GRAPHICS QUICKWIN GRAPHICS LIB

See Also: GETPHYSCOORD, GRSTATUS, SETTEXTWINDOW, SETVIEWORG, SETVIEWPORT, SETWINDOW

Example

This program draws an ellipse lying partly within a clipping region, as shown below.

 ! Build as QuickWin or Standard Graphics ap.
 USE DFLIB
 INTEGER(2) status, x1, y1, x2, y2
 INTEGER(4) oldcolor
 x1 = 10;  y1 = 50
 x2 = 170; y2 = 150
 ! Draw full ellipse in white
 status = ELLIPSE($GBORDER, x1, y1, x2, y2)
 oldcolor = SETCOLORRGB(#FF0000) !blue
 WRITE(*,*) "Hit enter"
 READ(*,*)
 CALL CLEARSCREEN($GCLEARSCREEN) ! clear screen
 CALL SETCLIPRGN( INT2(0), INT2(0), &
                  INT2(150), INT2(125))
 ! only part of ellipse inside clip region drawn now
 status = ELLIPSE($GBORDER, x1, y1, x2, y2)
 END

Figure: Output of Program SETCLIP.FOR