The AREA statement defines the area fill style and color. It is qualified with either the PEN, COLOR, or INTENSITY keywords. The area color and style remain in effect until another AREA, GINIT, or SCRATCH A is executed. The IPLOT, PLOT, RPLOT, and SYMBOL statements can also change the area fill color. This is explained under "Array Specified Pen Control," later in this section.
When you use the AREA PEN statement the fill color is looked up in the color map table, and the fill style is set to non-dither (solid).
AREA PEN pen
Pen numbers have the same effect as described in the PEN statement except for the following two conditions. In normal drawing mode, pen 0 erases; it does not complement. In alternate drawing mode, negative pen values erase; they do not complement. The default area fill color is PEN one.
When you use the AREA COLOR or AREA INTENSITY statements the fill color is created with dithering when needed to better approximate the color specified. Use AREA COLOR to specify a color in the HSL color space and AREA INTENSITY to specify a color in the RGB color space. These are explained earlier in this section. Because of the calculations needed to set up dithering, AREA COLOR/INTENSITY executes slower than AREA PEN.
Run this example program to see how dithered colors look, and to see how the HSL color space works. Change line 90 to AREA INTENSITY to see how the RGB color space works.
10 REM HSL.BAS
20 GINIT
30 GCLEAR
40 KEY LABELS OFF
50 WINDOW 0,1.31,1.31,0
60 FOR L=0 TO 1 STEP .2
70 FOR H=0 TO 1 STEP 1/6
80 FOR S=0 TO 1 STEP .2
90 AREA COLOR H,S,L
100 MOVE H+.11*L,S+.11*L
110 RECTANGLE .09,.1,FILL,EDGE
120 NEXT S
130 NEXT H
140 NEXT L
150 LORG 7
160 MOVE 1.2,1.31
170 LABEL "z = Luminosity"
180 LORG 4
190 MOVE .6,1.31
200 LABEL "x = Hue"
210 LDIR PI/2
220 MOVE 1.31,.6
230 LABEL "y = Saturation"
240 END
When drawing an area in a certain color, it may be possible to produce the color faster and more accurately by specifying SET PEN followed by AREA PEN, rather than specifying AREA COLOR or AREA INTENSITY.
10 REM AREAPEN.BAS
20 GINIT
30 PLOTTER IS CRT,"INTERNAL";COLOR MAP
40 AREA INTENSITY 1/3,2/3,1
50 MOVE 10,50
60 RECTANGLE 20,20,FILL,EDGE
61 !
70 SET PEN 15 INTENSITY 1/3,2/3,1
80 AREA PEN 15
90 MOVE 40,50
100 RECTANGLE 20,20,FILL,EDGE
110 END