and try to undraw it by:

DRAW OVER 1;-250,-175

This doesn't quite work, because the pixels the line uses on the way back are not quite the same as the ones that it used on the way down. You must undraw a line in exactly the same direction as you drew it.

Note, that being in screen mode in the editor is required for the examples above, otherwise the screen will be reset after each command and you will not get to see the results of the OVER and INVERSE modifiers.

Using stippling patterns to generate additional colours

One way to get unusual colours is to mix two normal ones together in a single square, using a user-defined graphic. These patterns are called stipples and work reasonably well in lower layers other than LoRes (where the pixels are too big) and exceptionally well in Layer 2 where both the available colours and resolution combine to make the results quite believable. Run this program:

1000 FOR n=0 TO 6 STEP 2
1010 POKE USR "a"+n, BIN
     01010101: POKE USR
     "a"+n+1, BIN 10101010
1020 NEXT n

which gives the user-defined graphic corresponding to a chessboard pattern. If you print this character (Graphics mode, then A) in red ink on yellow paper, you will find it gives a reasonably acceptable orange. You can obviously simulate the same behaviour with PLOT statements. This is slower than UDGs but it's much more flexible in the diversity of patterns that you can create.

Quick erase and fill using LAYER ERASE

NextBASIC lacks a dedicated fill command, however large rectangular areas on screen can be filled (or emptied) in LoRes and Layer 2 using the compound LAYER ERASE statement with 4 coordinate parameters (+ 1 optional fill parameter). The command:

LAYER ERASE x1,y1,x2,y2,c

will fill the rectangular area delineated by (x1,y1) and (x2,y2) with the global transparency colour (if the optional c parameter is not specified) or with the colour index contained in the c parameter taken from the active palette for the selected layer.

Clipping windows

One of the nicer features that come as a result of the layer system is the ability to superimpose/combine graphics that exist in separate memory spaces. This is possible on the one hand due to the existence of the transparency colour and on the other hand due to the ability to order the layer superimposition order. The latter is controllable via the LAYER OVER compound command as we saw in the More on the LAYER command section in Chapter 14.

This can be further enhanced with the creation of clipping windows which are basically smaller areas of a certain layer where all display in this layer goes and leaves the layers underneath visible (without having to set the entire area to be visible to a transparent colour). If you wish to visualise this, imagine a glass window with a rectangular section painted so you cannot see what's behind. That rectangular section is the clipping window, in essence the opposite of a regular window. The compound command:


ZX Spectrum Next User Manual, 3rd Edition (ISBN 978-1-5272-5496-1), written and illustrated by Phoebus R. Dokos. Copyright © 2020-2024 Phoebus Dokos / SpecNext Ltd. Licensed under CC BY-NC-SA 4.0. This is a transcription and can contain errors; check any doubt against the printed page.