From: mpdillon@halcyon.com (Michael Dillon) Subject: NAPLPS technical specs Date: Sun, 11 Apr 1993 08:05:25 GMT
34 POLY OUTLINED - polyline
35 POLY FILLED - polgon
36 SET & POLY OUTLINED - polyline
37 SET & POLY FILLED - polygon
38 FIELD - define bitmap field or input field
39 INCREMENTAL POINT - color bitmap
3A INCREMENTAL LINE - scribble
3B INCREMENTAL POLY FILLED - filled scribble
3C SET COLOR - specify an RGB color
3D WAIT - timed pause
3E SELECT COLOR - set color mode
3F BLINK - palette animation
Default graphics environment
The following setting are the default upon starting the
program or immediately after receiving an NSR (non-selective
Reset).
- GL contains the G0 set
- in 8-bit mode, GR contains the G1 set
- G0 contains the ASCII set
- G1 contains the PDI set
- G2 contains the supplementary set
- G3 contains the mosaic set
- drawing color is nominal white
- color mode is 0
- single value operands are 1 byte
- multi-value operands are 3 bytes
- multi-value co-ordinates are 2 dimensional with Z=0
- logical pel is 0 wide and 0 high with origin
point at the lower left. This makes the logical
pel size equivalent to 1 physical pixel.
- text rotation is 0 degrees (horizontal)
- character path moves to the right
- intercharacter spacing is 1
- interrow spacing is 1
- cursor and drawing point move together
- cursor style is underscore and is invisible
- character field is 1/40 wide and 5/128 high
- line texture is solid
- no outlines are drawn on filled objects
- fill pattern is solid
- fill pattern mask is 1/40 wide and 5/128 high
- the active field corresponds to the unit screen
- underlining is off
- word wrap is off
- scrolling is off
- reverse video is off
The following conditions are found at startup but are NOT
created by receipt of an NSR:
- palette is in default condition (see SET COLOR PDI)
1/2 evenly spaced grey scale
1/2 evenly spaced hues
- blinking is off
- no macros are defined
- no DRCS characters are defined (all <spaces>)
- no programmable fill masks are defined
- no unprotected fields are defined
RESET - 20
This PDI can selectively reset parts of the graphics
environment their default values. It is followed by two
fixed format bytes which specify what is to be reset. The
resets are to be performed in the following order:
DOMAIN - If bit 1 of the first byte is 1, the domain
parameters are reset.
COLOR - specified by bits 3 and 2 of the first byte
0 0 nothing
0 1 set color mode 0, reset to default
palette and set drawing color to white
1 0 set color mode and reset to default
palette. If current color mode is 0
then treat same as 1 1
1 1 set color mode 1, reset to default
palette and set drawing color to white
SCREEN - specified by bits 6, 5 and 4 of the first byte
0 0 0 nothing
0 0 1 clear screen to nominal black
0 1 0 clear screen to current drawing color
0 1 1 set border to nominal black
1 0 0 set border to current drawing color
1 0 1 clear screen/border to drawing color
1 1 0 clear screen to drawing color and set
border to nominal black
1 1 1 clear screen/border to nominal black
Note that most modern video displays do not
allow manipulation of the border or overscan.
TEXT - If bit 1 of the second byte is 1, then the
cursor is sent home to the top left of the
display area and all text parameters from the
TEXT PDI, the C1 set and the active field are
reset to their defaults.
BLINK - If bit 2 of the second byte is 1 then all blink
processes are terminated.
FIELDS - If bit 3 of the second byte is 1 then all
unprotected fields are changed to protected
and all field definitions except the active
field are lost. The display is not changed. If
the terminal program has any internal data
structures for editing and transmitting field
contents, they should be cleared as well.
TEXTURE - If bit 4 of the second byte is 1 then all
line texture and pattern fill attributes are
set to the default. The four programmable
pattern masks are not changed.
MACRO - If bit 5 of the second byte is 1 all macros are
cleared including transmit macros.
DRCS - If bit 6 of the second byte is 1 then all DRCS
characters are cleared by setting all DRCS
characters to be equivalent to the <space>
character.
If one or more of the data bytes are missing, then the RESET
will proceed as if it had been received with all zero bits.
If extra bytes are received, they will be discarded.
DOMAIN - 21
This command sets the precision of single and multi-
value parameter data, the number of Cartesian coordinates
and the logical pel size. The first parameter is fixed
format and that is followed by a multi-value operand to set
the logical pel size.
If bit 6 is 0, then X,Y coordinates are transmitted, if
1 then X,Y,Z coordinates are transmitted. The default
setting is X,Y. If 3-dimensional X,Y,Z is selected, then the
Z coordinates should be ignored at the present time.
The length of a multi-value operand is encoded in bits
5, 4 and 3 as follows:
0 0 0 1 byte
0 0 1 2 bytes
0 1 0 3 bytes (the default)
0 1 1 4 bytes
1 0 0 5 bytes
1 0 1 6 bytes
1 1 0 7 bytes
1 1 1 8 bytes
The length of a single value operand is encoded in bits
2 and 1 as follows
0 0 1 byte (the default)
0 1 2 bytes
1 0 3 bytes
1 1 4 bytes
The multi-value data following the fixed format byte is
used to define the width and height of the logical pel which
is the basic brush used in all the drawing operations. The
logical pel will always be at least 1 real pixel in size,
but may be larger. The width and height of the logical pel
must be rounded UP to the nearest real pixel size. For
instance, if the unit coordinates map to 1.3 real pixels in
width, then the logical pel should be 2 pixels wide. The
default size is 0,0 which makes the logical pel 1 physical
pixel in both width and height. The logical pel cannot
become invisible.
Unlike many graphical environments that draw pictures
with a logical brush, the logical pel is NOT centered on the
current drawing point. Instead the current drawing point is
located as follows:
+,- ------- -,-
| |
| |
+,+ ------- -,+
For instance, if the width is .01 and the height is -.01
then the upper left corner of the logical pel is always
aligned with the drawing point. To see this graphically,
draw a circle in MGE with a larger pel size. Then copy it
and use "Edit To" to change the copy to a smaller pel size
and a contrasting color.
The data bytes defining the logical pel are interpreted
according to the multi-value operand settings in the fixed
format byte immediately preceding them. Any additional data
bytes after the logical pel size are to be ignored. If there
are no data bytes after the fixed format byte, then the
logical pel size is unchanged.
TEXT - 22
This command sets up the current parameters which
affect how text is displayed. This includes ASCII,
supplementaries, DRCS characters and mosaics. The parameters
are two fixed format bytes followed by a multi-value
character field size.
Bits 6 and 5 of the first byte determine how far to
move the cursor after displaying a character or after a
<space>, <backspace> or <tab> character. The cursor is
always moved parallel to the character path and the distance
is a multiple of the height or width of the character field,
depending on which one is parallel to the character path.
This intercharacter spacing is defined as follows:
0 0 1 (the default)
0 1 5/4 i.e. 1.25
1 0 3/2 i.e. 1.5
1 1 proportional spacing
When the intercharacter spacing is 1, the following
character field touches the previous one, but in 5/4 and 3/2
spacing there is a gap. This would be visible in color mode
2 if the current background color contrasted with the
underlying image. Proportional spacing is defined later in
this document.
Bits 4 and 3 of the first byte define the character
path as follows:
0 0 Right (the default)
0 1 Left
1 0 Up
1 1 Down
After a character is displayed, the cursor moves in the
direction specified by the character path. This is
independent of the character rotation setting.
Bits 2 and 1 of the first byte define the character
field rotation as follows:
0 0 0 degrees (the default)
0 1 90 degrees
1 0 180 degrees
1 1 360 degrees
The character field rotates about it's origin which is the
lower left hand corner regardless of the sign of the
character field dimensions. The rotation affects all 4
character G-sets as well as the cursor and the underline
produced in underline mode.
Bits 6 and 5 of the second byte define the cursor style
as follows:
0 0 Underscore (the default)
0 1 Block
1 0 Cross-hair
1 1 Custom
The underscore is the full width of the character field at
the bottom of the field. The block cursor fills the entire
character field. The cross-hair is a vertical line and a
horizontal line that intersect at the center of the
character field. The custom cursor shape is implementation
dependent. When the underscore and block cursors are used,
the current drawing point aligns itself with the lower left
hand corner. When the cross-hair and custom cursors are
used, it aligns itself with the center of the character
field.
Bits 4 and 3 of the second byte define how the
graphical drawing point is related to the text cursor as
follows:
0 0 Move together (the default)
0 1 Cursor leads
1 0 Drawing point leads
1 1 Move independently.
When the cursor and the drawing point move together, then
every text character displayed causes the drawing point to
be repositioned, and every graphical drawing primitive
causes the text cursor to be repositioned. The actual
alignment between cursor and drawing point is determined by
the cursor type. If the cursor leads, then the drawing point
follows it, but it does NOT follow the drawing point. If the
drawing point leads, then the cursor follows it bit it does
NOT follow the cursor. Whenever the cursor is repositioned
in such a way that part of the character field would fall
outside the unit screen, it is automatically repositioned so
that the entire character field is within the unit screen.
Bits 2 and 1 of the second byte define the interrow
spacing as follows:
0 0 1 (the default)
0 1 5/4 i.e. 1.25
1 0 3/2 i.e. 1.5
1 1 2
These are interpreted as multiples of the character field
height or width, whichever is perpendicular to the character
path. Whenever <linefeed> or <vertical tab> is executed, the
new line position is calculated according to this spacing.
Note that the default single spacing causes the character
fields of the two rows to meet exactly, whereas 5/4, 3/2 and
double spacing leave a gap. Whenever a text character is
displayed, if the subsequent cursor movement would cause
part of the character field to be outside the unit screen or
outside the active field, then an automatic <carriage
return> <linefeed> is executed. If, by chance, a <carriage
return> <linefeed> is received right after that, then it is
ignored so that only one line positioning takes place.
The character field dimensions are defined by the
multivalue operands following the two fixed format bytes. If
the width of the character field is negative, then the
characters are mirrored around the vertical center axis of
the character field. If the height is negative, then they
are mirrored around the horizontal center axis of the
character field. If no data bytes are received, then the
character field dimensions are not changed. The default
width of the character field is 1/40 of the unit screen and
the default height is 5/128 of the unit screen. This is like
saying that by default, the unit screen is 40 chars by 25
lines (although only 3/4 of the lines are visible, i.e. 19
lines).
TEXTURE - 23
This command sets the line textures, fill patterns and
the outlining of filled areas. It is a fixed format byte
followed by a multi-value operand.
Bits 6, 5 and 4 define the fill pattern as follows:
0 0 0 Solid (the default)
0 0 1 Vertical hatching
0 1 0 Horizontal hatching
0 1 1 Vertical and horizontal cross-hatching
1 0 0 programmable mask A
1 0 1 programmable mask B
1 1 0 programmable mask C
1 1 1 programmable mask D
The hatching lines are one logical pel wide (or high) and
are spaced one logical pel apart. The hatching patterns
should maintain registration from one object to the next if
the pel size for those objects is the same. Even when the
logical pel size is (0,0), the solid fill is still drawn.
The programmable fill masks are defined with the DEF TEXTURE
command. By default, they cause no fill in color modes 0 and
1, and a background color fill in color mode 2.
Bit 3 defines whether or not to draw the outline of
filled objects. If it is 1 then filled objects are outlined
with a solid line (independent of the line texture) using
the current pel size. In color modes 0 and 1, the outline is
black; in color mode 2, the background color is used. The
default is 0 for no outline.
Bits 2 and 1 define the line texture as follows:
0 0 Solid (the default)
0 1 Dotted
1 0 Dashed
1 1 Dot-Dash
This sets the texture of lines drawn by the LINE, ARC,
RECTANGLE, POLYGON, and INCREMENTAL LINE PDI's. The size of
a dot and the gap size is equal to the logical pel size. In
horizontal lines the dashes are 3 logical pels wide, in
vertical lines they are 3 logical pels high. In angled lines
the visual effect of dots and dashes should be consistent
with that of the specified horizontal and vertical lines.
All end points of lines and arcs and all vertices should be
drawn regardless of the line texture. When the pel width is
0, all non-vertical lines are solid. When the pel height is
0, all non-horizontal lines are solid.
The multi-value operand following the fixed format byte
defines the mask size used in pattern fills for the
programmable masks A, B, C and D. The pattern is scaled to
the mask size, then tiled over the object with reference to
the screen origin to maintain registration. In color mode 2
both the foreground and background colors are used to draw
the pattern fill. The default mask size is 1/40 wide and
5/128 high. Negative mask sizes mirror the pattern the same
way text characters are mirrored. If there is no multi-value
operand, then the mask size is unchanged.
SET COLOR - 3C
This command is used to modify the color palette and is
subject to the color mode set by SELECT COLOR. In color mode
0, drawing colors are explicitly specified as RGB triples
and the palette is modified implicitly. In color modes 1 and
2, the color is specified as a palette entry. For example,
when displaying text in color mode 0, the drawing color is
specified directly and only affects the foreground pixels in
the text character. In color mode 1, the color is selected
from the palette and also is used to draw only the
foreground pixels. In color mode 2, both foreground and
background colors are chosen from the palette and both
foreground and background pixels are drawn in the
appropriate colors.
In order to use a color in modes 1 and 2, you must
first specify the color to be placed in the palette using
SET COLOR, and then you must select the palette entry to use
with SELECT COLOR. Any changes to the palette are
immediately reflected on the display. When a color is
specified directly in mode 0, the palette is checked. If the
color is already there, then the drawing color is set to the
lowest palette entry with that same color. If it is not
already there, mode 0 looks for the lowest palette entry
that has not been used by SET COLOR or SELECT COLOR since
the last RESET that has reset the palette. The palette
entries for nominal black and nominal white are not used.
Once an unused entry is found, it is defined and the drawing
color is set to use that palette entry. If there are no
available palette entries, then the drawing color is set in
an implementation dependent manner.
In mode 0 the multi-value operand specifies the actual
RGB color value where bits 6 through 1 of each data byte
represent GRBGRB. For instance, to set the value of the
green portion concatenate bits 6 and 3 from each byte as
follows 6363..., for Red use bits 5 and 2 5252... and for
blue use bits 4 and 1 4141... The drawing color is in effect
until another SET COLOR command changes it or it is reset by
a RESET or NSR. The default drawing color is white.
In modes 1 and 2, the SET COLOR command puts colors
into the palette. The palette entry used is the one which is
the current drawing color. It can be changed by using SELECT
COLOR. Whenever the data bytes specify more bits than the
palette can handle, the least significant bits are
discarded. If the palette entry can handle more bits than
the data bytes provide, then trailing zero bytes are added.
If there are additional data bytes after the multi-value
operand size, then an implicit SET COLOR command is assumed
with a new palette entry. The new palette entry is
determined as follows:
Take the palette entry number, change the most
significant zero to a one, then change all ones to
the left of it to zeroes. For example, 010100
would be incremented to 110100 which would be
incremented to 001100. This palette entry
determination does not affect the current drawing
color. The incrementing stops when a palette entry
of all ones is reached. This algorithm allows an
image to be viewed on a device with more palette
entries than are specified in the image. Carefully
placing similar colors in adjacent palette entries
will also allow the image to be viewed reasonably
on a device with fewer palette entries than the
original image.
If there are no multi-value data bytes, then the transparent
color is used. If transparency is not implemented, then the
transparent color is shown as black.
The default palette is determined by the following
algorithm:
N = number of bits in a palette entry number
i.e. 4 bits for 16 color VGA, 8 bits for 256 color
2 ^ n = the number of palette entries, i.e. 2^4 = 16
M = number of bits in the colour values, e.g. 24 bit
M >= 3 * (N - 1) This is a required relationship
The first half of the palette stores a uniformly spaced
greyscale where R = G = B. If M = 3 * (N - 1) then
there should be exactly (2^N)/2 grey levels including
black and white.
The second half of the palette stores a full rang of
hues spaced equally around the perimeter of the hue
circle with Blue at 0 degrees, Red at 120 degrees and
Green at 240 degrees. The algorithm for mixing colors
to obtain a desired hue is:
h = desired hue
ang(h) = the angle of h
P1 = the closest primary to h
ang (P1) = the angle of P1
P2 = the second closest primary to h
ang(P2) = the angle of P2
P3 = the farthest primary from h
Then the color values to give h will be:
P1 = 100% (all one bits)
P2 = |ang(h) - ang(P1)|
------------------
60 degrees
P3 = 0%
WAIT - 3D
This command produces a timed pause. If the terminal
program has not yet finished displaying previously received
PDI's, then the pause interval is not started until the
drawing is completed. The byte following the WAIT PDI is a
fixed format byte containing 1011100 in bits 7 through 1. If
any other byte follows the WAIT PDI, then the entire
sequence is discarded.
The 3rd and subsequent bytes specify wait intervals in
bytes 6 through 1. There can be any number of wait intervals
specified to add up to the required pause time. A wait
interval of zero is anywhere between 0 and .1 seconds long.
SELECT COLOR - 3E
This command sets the color mode. For modes 1 and 2 it
selects the palette entry to use for the foreground or
drawing color. For mode 2 it also sets the palette entry for
the background color. It can have 0, 1 or 2 single value
operands. Any additional data bytes are discarded.
If there are no data bytes, then color mode 0 is set.
If there are data bytes for 1 single value operand, mode 1
is set and if there are data bytes for 2 single value
operands, mode 2 is set. The most significant bits of the
single value operands are used to determine the palette
entry to use. If the single value operand has less bits than
palette entry numbers, then trailing 0 bits are added.
The first single value specifies the drawing color. The
second single value (if available) specifies the background
color. If both operands specify the same palette entry, then
the drawing color is NOT changed, only the background color.
The background color is used to fill the character field in
which characters are displayed. It also draws the outlines
of filled objects, the spaces in line textures and the
backgrounds in all pattern fills.
BLINK - 3F
This command is used to set up palette animation by
creating a blink process. This process runs on a 1/10th of a
second timer and periodically modifies palette entries. The
palette entry to be changed is the blink-from color and the
new contents of the blink-from color come from the palette
entry specified by the blink-to color. The time interval
that each of the two colors is visible is definable. The ON
interval is when the blink-to color is visible and the OFF
interval is when the blink-from color is visible.
A starting delay can be specified to synchronize
multiple blink processes. The starting delay is ignored if
there are currently no blink processes active. The delay is
relative to the beginning of the ON interval of the most
recently defined blink process. A start delay of 0 causes
the ON interval of the new blink process to start at the
same time as the ON interval of the previously defined blink
process.
When the ON or OFF intervals, for more than one blink
process, end simultaneously, they are processed starting
with the first defined blink process. This means that the
second and subsequent blink processes use the color map
-- Michael Dillon Internet: mpdillon@halcyon.halcyon.com C-4 Powerhouse Fidonet: 1:353/350 RR #2 Armstrong, BC V0E 1B0 Voice: +1-604-546-8022 Canada BBS: +1-604-546-2705