Topic : The GFA-Basic Compendium Author : GFA Systemtechnik GmbH Version : GFABasic.HYP v2.98 (12/31/2023) Subject : Documentation/Programming Nodes : 899 Index Size : 28056 HCP-Version : 3 Compiled on : Atari @charset : atarist @lang : @default : Document not found @help : Help @options : +g -i -s +z @width : 75 @hostname : STRNGSRV @hostname : CAB @hostname : HIGHWIRE @hostname : THING View Ref-FileCOLOR color SETCOLOR register,red,green,blue SETCOLOR register,composite VSETCOLOR color,red,green,blue VSETCOLOR color,composite register, red, green, blue, composite, color: iexp The command COLOR determines the line color. Values between 0 and 255, dependant on the current resolution, are valid. The first variant of SETCOLOR determines the proportion of the colors red, green, and blue in a particular color register. The intensity of the color element is specified on a scale from 0 (low) to 15 (high) and the number of available color registers depends on the current resolution. In the second variant of SETCOLOR, the color setting is defined by a single parameter whose value is computed by the following formula: composite = red * 256 + green * 16 + blue * 1 and, as with the other setting, the values for red, green, and blue are specified on a scale from 0 to 15. The setting of color elements in the color registers is, naturally, only applicable when in the color modes. However, in the monochrome mode, when a composite value other than 0 or 1 is specified, even numbers have the same effect as 0 and odd numbers the same effect as 1. Example: SETCOLOR 0,0 --> On a mono monitor, the display appears as white on a black background. Through an apparently unexpected mix-up in the design of the operating system, the color registers used by SETCOLOR do not correspond directly to the numbers used by COLOR. To overcome this the command VSETCOLOR is available. The values of red, green, and blue are numbers in the range 0 to 15. The term composite is calculated in the same manner as SETCOLOR, i.e.: composite = red * 256 + green * 16 + blue * 1 VSETCOLOR 1,2,3,4 is the same as VSETCOLOR 1,&H234 The syntax of the VSETCOLOR command is virtually identical to that of SETCOLOR, the sole difference being in the parameters 'register' and 'color'. They are related as shown: For monochrome modes: SETCOLOR 0,even corresponds to VSETCOLOR 0,0 SETCOLOR 0,odd corresponds to VSETCOLOR 0,&HFFF For 4 color modes: SETCOLOR 00 01 02 03 VSETCOLOR 00 02 03 01 For 16 color modes: SETCOLOR 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 VSETCOLOR 00 02 03 06 04 07 05 08 09 10 11 14 12 15 13 01 For 256 color modes: See 256 color VDI/Hardware table. Example: ' In Low resolution FOR i%=0 TO 15 DEFFILL i% PBOX i%+20,0,319,199 NEXT i% DO a%=INP(2) EXIT IF a%=27 VSETCOLOR a% AND 15,RAND(-1) LOOP --> This program draws overlapping color boxes, the result being 16 vertical bars (the left hand one is the same color as the border, i.e. color 0). By ANDing the key code with 15, a color register number can be chosen and this register is then set to a random value. The program is left by using the Escape key. Memo: 'VSETCOLOR i,rgb' contains a bug such that the red and blue values end up swapped. This happens in the editor and compiled. SETCOLOR uses a 15-bit mask that should be 12-bits (editor bug only). 'rrrrggggbbbb' When using vq_color() always set 'flag' to 1, otherwise you can get values greater than 1000. vsl_color()+, vs_color()+, EsetColor()+, Setcolor()+, vq_color()+