Ink Modes - AMSTRAD cpc 6128 User Instruction

Integrated computer/disc system
Hide thumbs Also See for cpc 6128:
Table of Contents

Advertisement

Ink modes
It is possible to draw using a graphics ink mode which combines the current drawing
with the ink already on the screen. The final ink for each pixel is calculated by
forming the logical combination of the old ink for the pixel with the graphics ink (pen
or paper) being plotted. The logical combinations provided are XOR, AND and OR.
The ink mode can be set either as the fourth parameter of DRAW/DRAWR,
PLOT/PLOTR and MOVE/MOVER commands or by PRINTing a CHR$(23);
CH R $ ( <mode» control code sequence. In each case a value of 1 sets XOR plotting, 2
sets AND plotting and 3 sets OR plotting. A value of 0 restores the 'force' mode,
where the graphics inkis used 'as is'.
The next example demonstrates the use of the XOR combination. XOR is often used
in so-called Turtle Graphics because it has the property that drawing the same
pattern twice restores the original image. Thus the square drawing routine is
executed twice (in lines 110 and 130), and the TAGged printing is also executed
twice (in lines 170 and 190). The F R A M E commands cause enough delay to make
the effect visible. Note the use, in line 90, of commands without a first parameter.
This is quite in order in these commands, and simply leave the current settings ofthe
first parameter unchanged.
The third parameter (,
1 )
of the M
0
V E command in line 2 2 0 sets the G RAP H I C S
PEN to 1, overriding the '3' set in line 60. The XOR mode is set by the fourth
parameter of the D RAW R command in line 2 3 0. Note once more the missing
parameter.
A reminder of the first-point plotting effect can be seen by removing the M ASK
command in line 90. The corners of the square disappear because they are drawn
twice (at the end of one line and the start of the next) and are therefore cancelled out
by the XORing action.
10 REM XOR ink modes
20 MODE 1:INK 2,10:INK 3,4
30 ORIGIN 440,100,440,640,100,300
40 WINDOW 1,26,1,25
50 CLG 2:GRAPHICS PAPER 0
60 DRAW 200,200,3
70 MOVE 2,0:FILL 3
80 ORIGIN 440,0,440,640,0,400
90 GRAPHICS PEN ,1:MASK ,0
100 FOR y=60 TO 318 STEP 2
110 GOSUB 220
120 FRAME:FRAME
130 GOSUB 220
Chapter 9 Page 52
continued on the next page
At your leisure ....

Advertisement

Table of Contents
loading

Table of Contents