SET PENDefines part or all of the color map.
Description:
The SET PEN statement changes the color map values used for each available pen number. A color may be specified in either RGB or HSL color space (see COLOR for an explanation about RGB and HSL color spaces). Redefine multiple pens using the array specifier or redefine individual pens by specifying one HSL or RGB color value. In either case, the pen-number specifies the first entry in the color map to be defined. The pen-number is a numeric expression which is rounded to an integer and should be in the range 0 to n-1, where n is the number of colors.
The closest possible color will be used if the computer display cannot display the color you select. When drawing an area in a certain color, it may be possible to produce the color more accurately by specifying SET PEN followed by AREA PEN, rather than specifying AREA COLOR or AREA INTENSITY.
Any pixels already drawn with the specified pen are changed to the new. All SET PEN statements take effect immediately upon execution. The effects of all SET PEN statements last until the next SET PEN statement of the same type, or until GINIT or QUIT. In cases where dithering is used, changing the color map changes the colors available to the dithering process.
Array
If an array is used to set more than one pen, the array must be 2-dimensional and have 3 columns. The number of rows determines the number of pens set. For example,
1!RE-SAVE"WINCLR.BAS"
10 PLOTTER IS CRT,"INTERNAL";COLOR MAP
20 DATA .5,.5,.5 ! 8 = dark grey
30 DATA .75,.75,.75 ! 9 = light grey
40 DATA .5, 0, 0 ! 10 = dark red
50 DATA .5,.5, 0 ! 11 = dark yellow
60 DATA 0,.5, 0 ! 12 = dark green
70 DATA 0,.5,.5 ! 13 = dark cyan
80 DATA 0, 0,.5 ! 14 = dark blue
90 DATA .5, 0,.5 ! 15 = dark magenta
180 !
190 DIM Palette(8:15,1:3)
200 READ Palette(*)
210 SET PEN 8 INTENSITY Palette(*)
220 END
See Also:
|