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>gsetpal()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 GSETPAL()
 Change components of a color
------------------------------------------------------------------------------
 Syntax

     GSETPAL(<nColor>, <nRedValue>, <nGreenValue>,
        <nBlueValue>) --> aOldPalette

     GSETPAL() --> aOldPalette

     GSETPAL(<aPalette>) --> aOldPalette

     GSETPAL(<nColor>, <aRGB>) --> aOldPalette

 Arguments

     <nColor> is a numeric value that represents a display color.

     The range of values for the parameter is limited to the number of colors
     available in the selected video mode.  In 16-color modes, valid values
     are between 0 and 15.  In 256-color modes, valid values are between 0
     and 255.

     <nRedValue> is a numeric value that represents the red component
     assigned to <nColor>.  Its possible values are from 0 to 63.

     <nGreenValue> is a numeric value that represents the green component
     assigned to <nColor>.  Its possible values are from 0 to 63.

     <nBlueValue> is a numeric value that represents the blue component
     assigned to <nColor>.  Its possible values are from 0 to 63.

     <aFullOldPalette> is an array of components in the palette.  The
     structure of the array is { nRedValue, nGreenValue, nBlueValue }.

     <aRGB> is an array of components in the palette.  The structure of
     the array is { nRedValue, nGreenValue, nBlueValue }.

 Returns

     <aOldPalette> represents an array of components in palette:

     aOldPalette := { nRedValue, nGreenValue, nBlueValue }

 Description

     The GSETPAL() function changes a color's basic component values.  This
     function must be called for each color if you want to change the
     palette.  It can be used in text or graphic mode.

 Notes

     CA-Clipper saves the VGA|VESA environment including the palette.  It
     also saves the first call to GMODE() or SET VIDEOMODE.  When you do a
     QUIT or reach the last RETURN of your application, your initial video
     mode is automatically restored.  You do not need to save the original
     color palette.

 Examples

     .  This example stores a video mode's color components in a
        multidimensional array.  It is identical to calling GSETPAL() with no
        parameters:

        FUNCTION aPalSave()
           LOCAL aPalStore := {}
           LOCAL nI        := 0

        // For all colors in the current video mode
           FOR nI := 1 TO GMODE()[LLG_MODE_COLOR_MAX]
        // Save color reference and color components
              AADD(aPalStore, {nI-1,;
                 GSETPAL(nI-1)[1],;
                 GSETPAL(nI-1)[2],;
                 GSETPAL(nI-1)[3]})
           NEXT nI
           // Return an array of arrays
           RETURN aPalStore

     .  This example loads all color components of a video mode using
        a multidimensional array which contains the individual components:

        FUNCTION aPalRest(aPalette)
           LOCAL nI := 0
           // For all the arrays in the major array
           FOR nI := 1 TO LEN(aPalette)
           // Reset the color components
              GSETPAL(aPalette[nI,1],;
                 aPalette[nI,2],;
                 aPalette[nI,3],;
                 aPalette[nI,4];)
           NEXT nI
           RETURN aPalette

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


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