Several words are available to use the "map" area of the screen as a graphics area. This is fixed in size to 256x64 pixels, and is only available on expanded Z88s. Use the EXP? word to check for a suitable Z88 before using these words; they will just be ignored on unexpanded machines.
The graphics area must be initialised before use, using OPENMAP, which requires a window number on the stack. Additionally, you should make sure that any text windows you are using are defined so that they do not overlap this area, which is situated at the right of the display. For example, use the following phrases:
1 0 48 8 1 OPENWINDOW 2 OPENMAP
Note that if you are using graphics, OPENMAP must be used every time a RC_DRAW error occurs (and, of course, you should redraw the graphics present in the area).
The coordinate system used runs from x=0 at the left side to x=255 at the right side, and from y=0 at the bottom to y=63 at the top.
In all the graphics words it is perfectly acceptable to give coordinates outside these limits. By default, pixels out of range are simply ignored. This means, for example, that a circle drawn with a centre of (0,0) will just appear as a quarter circle in the bottom left corner of the map.
An alternative treatment available is to force all out-of-range pixels to the nearest "edge" of the map and plot them there. In the circle example, this would be drawn like a piece of cake, with the left and bottom sides drawn as lines at the edge of the screen.
The most basic graphics facilities generally work with a single point at a time, and are listed here:
These words offer further facilities for creating graphics:
A fill/shade feature is available, which allows you to shade any area with your own design or one of the two supplied shading patterns. Each of these routines take a point within the area to be shaded.
The algorithm used is very simple, so it is fast but will not fill complicated shapes in a single go. The best position to specify for the point is where the shape is tallest.
You can specify your own shades by CREATEing a word and compiling 8 bytes of shade data after it; each byte represents one line of the shade pattern (the first byte is for the top line). For example, an interesting shade is:
CREATE MYSHADE 204 C, 0 C, 51 C, 0 C, 170 C, 85 C, 170 C, 0 C, 128 32 MYSHADE GPATTERN