Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.3 . Guide To CA-Clipper - <b>gsetclip()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 GSETCLIP()
 Define the allowed display area
------------------------------------------------------------------------------
 Syntax

     GSETCLIP([<nX1>, <nY1>, <nX2>, <nY2>]) --> aOldRegion

 Arguments

     <nX1> is a numeric value representing the left X-axis (column)
     position of the region in pixels.

     <nY1> is a numeric value representing the top Y-axis (row) position
     of the region in pixels.

     <nX2> is a numeric value representing the right X-axis (column)
     position of the region in pixels.

     <nY2> is a numeric value representing the bottom Y-axis (row)
     position of the region in pixels.

     Either all parameters should be specified or none.

 Returns

     GSETCLIP() returns an array of four numbers representing the new
     clipping region if you specify all arguments, and the current region if
     you specify none.

 Description

     GSETCLIP() limits the active display to a portion of the screen.  This
     function applies only to CA-Clipper graphic mode functions beginning
     with "G", such as GRECT(), GLINE(), GBMPDISP().  Text emulation
     functions such as DEVOUT() and QOUT() are not affected by setting
     clipping regions.  To enhance redraw speed, clipping of the function for
     rewriting text in GWRITEAT() graphic mode is simplified.  CA-Clipper
     graphic mode checks whether each character displayed fits entirely in
     the clipping region.  If it does, the character is displayed; otherwise,
     it is not.

 Notes

     The clipping region is initialized to be the entire screen.  To specify
     maximum clipping (which amounts to eliminating clipping altogether), you
     need to pass parameters to GSETCLIP() corresponding to the entire
     screen.  There are two ways to do this:

     .  Save the clipping state immediately after the change.  This is
        equivalent to the whole screen at that instant:

        SET VIDEOMODE TO LLG_VIDEO_VGA_640_480_16
        // Retrieve clipping value
        aMaxClip := GSETCLIP()
        // Execute clipping
        GSETCLIP(<nCoord list>)
        .
        .
        .
        // Your code
        .
        .
        .
        // Retrieve clipping value
        GSETCLIP(aMaxClip[1] , aMaxClip[2] , aMaxClip[3] , aMaxClip[4])

     .  Use GMODE() which returns the screen size in pixels:

        // Switch to graphic mode
        SET VIDEOMODE TO LLG_VIDEO_VGA_640_480_16

        // Perform clipping
        GSETCLIP(<nCoord list>)
        .
        .
        .
        // Your code
        .
        .
        .
        // Retrieve clipping value
        GSETCLIP(0, 0, ;
        GMODE()[LLG_MODE_GRAPH_ROW], ;
        GMODE()[LLG_MODE_GRAPH_COL])

 Examples

     .  This example restricts display to a portion of the screen:

     // Switch to graphic mode
        SET VIDEOMODE TO LLG_VIDEO_VGA_640_480_16


        // Restrict the display region
        GSETCLIP(100, 100, 300, 300)

        DO WHILE ! (INKEY() == K_ESC)
           AreaDraw()                 // Call a drawing function
        ENDDO
        QUIT                           // End of application

     .  This example stores clipping region parameters for later use:

        // Switch to graphic mode
        SET VIDEOMODE TO LLG_VIDEO_VGA_640_480_16

        // Retrieve current values
        aOldRegion := GSETCLIP()

        // Restrict display region to a portion of the screen
        GSETCLIP(100,100,300,300)

        DO WHILE !(INKEY() == K_ESC)
           AreaDraw()
           // Call a function that draws something
        ENDDO

        // Reset original clipping regions
        GSETCLIP(aOldRegion[1],;
           aOldRegion[2],;
           aOldRegion[3],;
           aOldRegion[4])
        QUIT                        // End of application

 Files   Library is LLIBG.LIB, header file is Llibg.ch.


See Also: GLINE() GRECT() GWRITEAT() GBMPDISP()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson