From: mpdillon@halcyon.com (Michael Dillon) Subject: NAPLPS technical specs Date: Sun, 11 Apr 1993 08:05:33 GMT
resulting from the first blink process. Some complex side
effects can be created this way.
The first set of data bytes following BLINK are a
single value operand defining the blink-to color as a
palette entry. The same rules apply as for SELECT COLOR. The
blink-from color is defined to be the current drawing color
and therefore is not explicitly included in the BLINK PDI.
Following the single value operand are 3 fixed format
bytes defining the ON interval, OFF interval and START DELAY
for the blink processes. Each interval is defined in 10ths
of a second and, of course, only bits 6 through 1 are used.
This means the minimum interval is .1 seconds and the
maximum interval is 6.3 seconds. If the START DELAY is not
transmitted then it is assumed to be 0. A start delay is
ignored if there are no currently active blink processes. If
either the ON interval or the OFF interval are zero, then
any currently active blink process for the specified blink-
from and blink-to colors is terminated. There can be only
one blink process at a time for a given pair of colors. If a
blink PDI is issued with no data bytes following it then all
blink processes using the current drawing color as the blink-
from color will be terminated. When all blink processes for
a given blink-from color are terminated, then the original
blink-from color will be restored.
If there are additional data bytes after the start
delay byte, then another blink command is started
implicitly. This new blink command will automatically
increment the palette entry number to use as the blink-from
color using the same algorithm as SET COLOR uses for
incrementing palette indexes. This incrementing does not
affect the drawing color.
The number of blink processes simultaneously active is
implementation dependent but should be at least 16.
POINT SET ABS - 24
This PDI sets the current drawing point to the
coordinates specified in last one of the following multi-
value operands. No point is drawn.
POINT SET REL - 25
This PDI sets the drawing point to the current drawing
point plus the displacement specified in the following multi-
value operand. This operation may be repeated for multiple
multi-value operands. No point is drawn.
POINT ABS - 26
This PDI sets the drawing point to the coordinates
specified in the following multi-value operand and draws a
logical pel at that point in the current drawing color.
Multiple points may be specified by transmitting more
coordinate pairs.
POINT REL - 27
This PDI sets the drawing point to the current drawing
point plus a displacement specified in the following multi-
value operand and draws a logical pel at that point in the
current drawing color. Multiple points may be specified by
transmitting more X,Y displacements.
LINE ABS - 28
This PDI draws a line in the current color from the
current drawing point to the end point specified in the
following multi-value operand. If more than one operand is
transmitted, lines will be drawn until there are no more
data bytes. The current drawing point is set to the last end
point. The thickness of the line is determined by the
logical pel size since the logical pel is used as a brush to
draw the line as in the example below.
_
/\/\
/ /\ \
/ / \ \
/ / \ \
|_/ \_|
LINE REL - 29
This PDI draws a line in the current color from the
current drawing point to a point specified by the X,Y
displacement in the following multi-value operand. If more
than one operand is transmitted, lines will be drawn until
there are no more displacements. The current drawing point
is set to the last end point.
SET & LINE ABS - 2A
This PDI is similar to LINE ABS except that the first
multivalue operand after the PDI is used to set the current
drawing point before drawing commences.
SET & LINE REL - 2B
This PDI is similar to LINE REL except that the first
multivalue operand after the PDI is used to set the current
drawing point before drawing commences.
Arc Drawing
The ARC PDI's are used to draw circles, circle segments
and curvilinear splines. Arcs are drawn from a start point,
through an intermediate point to an end point. The start and
end points are the same point, then the intermediate point
defines the diameter of a circle and a circle is drawn. If
more than 3 points are specified, then a curvilinear spline
is drawn. The minimal acceptable implementation according to
the standard is a straight line connecting all the end
points, but in this day and age a B-spline should be used. B-
splines are used in TrueType font outlines and can readily
be drawn using CAD programs, so B-spline support would be
useful for converting display typefaces and CAD drawings to
NAPLPS format. The maximum number of points in a spline is
implementation dependent but should be at least 256.
If the 3 points specified for an arc are collinear,
then a line is drawn from the start point to the end point.
If the end point is omitted, it is assumed to be the same as
the start point and a circle is drawn. After drawing the
arc, the current drawing point is set to the end point.
If an arc is filled, then the area between the arc and
the chord specified by the start and end points is filled
with the current colors and current fill pattern. The line
width of the chord is affected by the logical pel size, but
if the arc is outlined, the chord is NOT outlined.
There is a good reason why the chord is filled rather
that the pie segment and why only the circular portion of
the arc is outlined and not the chord. Firstly, a pie
segment is easily composed of a filled arc and a triangle
which have the chord line in common. It is possible to
construct curved objects more efficiently by drawing several
end-to-end filled arcs and an interior polygon which
connects the chords of those arcs (see cloud in the BYTE
sample). If this object is to be outlined, you would not
want the chord lines to be visible but you would want the
curved portions to be visible. The alternative is to draw a
polygon with many short line segments to approximate the
curves but that takes many more bytes and is less efficient.
Remember, most of the world still runs on 2400 bps modems.
Well designed NAPLPS images can be transmitted quite
reasonably at that speed.
ARC OUTLINED - 2C
This PDI draws an unfilled arc in the current drawing
color. The start point is the current drawing point. Only
the intermediate and end points are specified in the
following multi-value operands.
ARC FILLED - 2D
This PDI is the same as ARC OUTLINED except that the
start and end points are joined by a chord in the current
drawing color and the arc is filled with the current color
and fill pattern. If the TEXTURE settings specified that
outlines should be drawn, only the curved part of the arc is
drawn in the background color.
SET & ARC OUTLINED - 2E
This PDI is the same as ARC OUTLINED except that the
first multi-value operand sets the current drawing point.
SET & ARC FILLED - 2F
This PDI is the same as ARC FILLED except that the
first multi-value operand sets the current drawing point.
Rectangle Drawing
The rectangle commands draw rectangles of a specified
width and height. After the rectangle is drawn the endpoint
is displaced from the starting point by the width only. This
facilitates drawing bar charts along a baseline. If
additional data bytes follow a rectangle command, they are
interpreted as additional width and height specifications
for additional rectangles.
RECT OUTLINED - 30
This PDI draws an unfilled rectangle in the current
drawing color starting at the current drawing point.
RECT FILLED - 31
This PDI draws a filled rectangle starting at the
current drawing point. The fill is done with the current
drawing color and fill pattern.
SET & RECT OUTLINED - 32
This PDI is the same as RECT OUTLINED except that the
current drawing point is set by the first multi-value
operand.
SET & RECT FILLED - 33
This PDI is the same as RECT FILLED except that the
current drawing point is set by the first multi-value
operand.
Polygon Drawing
The polygon command is used to draw filled and unfilled
polygons. The polygon is defined as a series of
displacements from a starting point. The last point in a
polygon is implicitly the same as the starting point to
ensure that it is closed. The drawing point is unchanged
after drawing a polygon.
The number of vertices allowed in a polygon is
implementation dependent but should be at least 256.
POLY OUTLINED - 34
This PDI draws a polygon starting at the current
drawing point.
POLY FILLED - 35
This PDI draws a filled polygon starting at the current
drawing point.
SET & POLY OUTLINED - 36
This PDI is the same as POLY OUTLINED except that it
sets the current drawing point first.
SET & POLY FILLED- 37
This PDI is the same as POLY FILLED except that it sets
the current drawing point first.
FIELD - 38
This PDI defines the active field position and
dimensions. The active field is used for displaying and
scrolling columnar or wordwrapped text, for setting up
unprotected input fields and for displaying bitmapped
images. If there is already an active field, it will be
replaced by this new active field.
The first parameter after the PDI is the origin of the
field in absolute coordinates. The second multi-value
operand, gives the width and height of the field. If the
width or height are negative, then the origin point of the
field will not be in the lower left corner. This is handled
the same way as the logical pel size under the DOMAIN PDI.
The current drawing point is set to the field origin point.
If there are no multivalue operands after the FIELD PDI,
then the active field is set to the default setting of the
full unit screen with the origin at (0,0). If there is only
one multi-value operand, then it is used as the field
dimensions and the current drawing point will be used as the
origin point.
INCREMENTAL POINT - 39
This PDI displays a color bitmap within the active
field. Each pixel specified in the bitmap is drawn by one
logical pel using the color specified in the bitmap. In
color mode 0, the colors are explicitly specified as RGB
values. In modes 1 and 2, they are palette entries. The
color settings or selections caused by the incremental point
command have exactly the same effect on the graphics
environment as a SET COLOR (mode 0) or SELECT COLOR (mode 1
& 2) command including side effects dealing with palette
entries.
The active field is important as it bounds the bitmap
and determines the number of pixels or pels per line in the
bitmap. Pels are displayed starting at the current drawing
point. After drawing the pel, the drawing point is displaced
in the X direction by an amount equal to the width of the
logical pel. Positive widths move right, and negative ones
move left. At this point, if the new position of the logical
pel causes it to overlap the active field boundaries, then
two things happen. First, any remaining bits in the current
data byte are discarded. Then, if there are any more data
bytes, the drawing point is repositioned at the boundary
opposite the overlapping one (like a carriage return). If it
is possible to displace the logical pel in the Y direction
without overlapping the field boundary, then this is done,
otherwise, the Y position is unchanged but the entire field
contents are scrolled in the opposite direction. Positive
pel heights move up but scroll down, negative heights
reverse the directions. After the repositioning is
completed, the next pel is drawn.
Once the last pel has been drawn, the current drawing
point is set back to the field origin.
The first byte following the INCREMENTAL POINT PDI is a
fixed format parameter that describes the number of bits per
pixel that are used to specify the pixel color or the
palette entry. This number ranges from 1 to 48. If it is 0
or if it is greater than 48, then the entire PDI is
discarded. The following data bytes are a bitstring
consisting of bits 6 through 1 of each data byte. In color
mode 0 the number of bits equal to the packing count are
arranged GRBGRBG...BGRB. These are to be extracted and
interpreted as RGB colors in the same way as the multi-value
color operands used by SET COLOR. Note that if the packing
count is not a multiple of 3, then there will not be the
same number of bits for each of the three primary colors.
For instance, with a packing count of 5, the bit string
would be GRBGRGRBGRGRBGR...
^ ^ note that Blue is not specified
In modes 1 and 2, the bitstring consists of palette
indexes concatenated together.
In some cases it will be necessary to rescale either
the logical pel dimensions and the active field dimensions
in order to ensure that both of them are integer multiples
or integer fractions of the physical pixel dimensions. If
this scaling is done, then the original unscaled values for
both the active field and the logical pel are restored after
the INCREMENTAL POINT PDI has completed. This scaling must
ensure that the resulting bitmap image is guaranteed to lie
within the ORIGINAL active field and that skewing of the
image does not occur. This means that the new dimensions
must display the same number of pels per line as the
original ones. It also means that the rescaled bitmap will
be smaller than the actual specified field size.
If any portion of the logical pel for the initial
drawing point lies outside the active field, then the entire
PDI is discarded. If either width or height of the current
logical pel is equal to zero, then for the duration of the
INCREMENTAL POINT PDI, it is set to the smallest value
possible within the current DOMAIN.
INCREMENTAL LINE - 3A
This PDI defines a scribble which is an efficient
representation for certain types of polylines such as a
signature. The line segments in the scribble are drawn with
the current color and line texture.
The first operand is a multi-value operand which
specifies the step-size as separate x and y displacements
referred to as dx and dy. Following this, the data bytes
define a bitstring consisting of a series of 2 bit opcodes
as follows:
00 makes the following opcode one of:
00 toggle the draw flag
01 reverse the sign of dx
10 reverse the sign of dy
11 reverse the sign of dx and dy
01 move the drawing point dx in the x direction
10 move the drawing point dy in the y direction
11 move the drawing point dx in the x direction
and dy in the y direction
If the draw flag is on, each of the move instructions causes
a line segment to be drawn from the current point to the new
point. When the INCREMENTAL LINE starts, the draw flag is on
unless it is turned off explicitly. The current drawing
point is set to the last point in the scribble.
INCREMENTAL POLY FILLED - 3B
This PDI is almost identical to the INCREMENTAL LINE,
except as follows:
1. The scribble is filled with the current colors and
fill pattern.
2. the draw flag is always on
3. If an opcode to turn off the draw flag is
encountered, it is skipped.
4. The final drawing point is implicitly the same
as the starting point to ensure closure.
5. the maximum number of nodes allowed is the same
as for the polygon PDI's.
The Mosaic set
Overview
This G-set consists of 65 2x3 block mosaic characters
and 31 <space> characters. The mosaic range from 20 to 3F
and from 60 to 7F and a special one at 5F. The bit pattern
of the character code determines the bit pattern of the
mosaic character:
7 6 5 4 3 2 1
---------------
| |1| | | | | | data byte
---------------
-----
|1|2|
----- 2 x 3
|3|4| Mosaic cell
-----
|5|7|
-----
One bits in the data byte cause the corresponding mosaic
cell to be visible. If you want to see what they look like,
use MGE or get a copy of the official standards document or
look in the February 1983 issue of BYTE magazine.
Mosaic characters are normally displayed in contiguous
mode so as to create the effect of a monochrome bitmap.
However, when text underline mode is on, they are displayed
as separated with no actual underscore. In contiguous mode,
the mosaic cell size is determined by dividing the character
field into six equal rectangles. In separated mode, the
character field size is reduced in width by the width of a
logical pel and reduced in height by the height of a logical
pel before subdividing into six equal rectangular parts. The
scaled down mosaic characters are left and bottom justified
within the character field. If either dimension of the
logical pel is greater than the corresponding character
field dimension, then the mosaics are invisible in separated
mode.
Mosaic code 20 is not subject to underlining and
mosaics are never proportionally spaced. The mosaic
displayed by code 5F is the same as 7F
The Macro Set
Overview
This set contains 96 codes which can be used to define
and invoke macro. A macro is simply a stream of NAPLPS bytes
that are captured by the terminal program and assigned to a
code in the macro set. They may be buffered in RAM or on
disk as desired by the implementor. Once the macro is
defined, it can be recalled by invoking the macro set and
transmitting the single byte code for the macro. Macros can
also be recalled within the definition of another macro, so
it is necessary for the terminal program to beware of
infinite macro loops.
There are three control codes which define a macro (DEF
MACRO, DEFP MACRO, and DEFT MACRO). Any of these macros may
be linked to a user input such as a function key or mouse
click so that it may be activated or transmitted by the
user.
Macro expansion can occur in odd places, such as in the
middle of a PDI's data bytes, so be careful.
Dynamically Redefinable Character Set
Overview
This G-set is a character set that may be defined and
redefined by the host system transmitting the NAPLPS codes.
This could be used simply for a different looking font, or
it could be used to enable use of NAPLPS with a non-Latin
based language such as Russian, Thai or Inuktitut. The 96
codes in the DRCS are treated as <space> until they are
explicitly defined by a DEF DRCS control command. When these
codes are displayed they are subject to the same features
and limitations as alphanumeric text.
Character Field Layout
When defining characters for a DRCS, one should take
certain factors into consideration when planning the
character field layout. Remember, that the entire character
shape must lie 100% within the character field including
descenders and accents. The characters should be designed
with a baseline that is offset far enough from the bottom of
the character field to leave room for descenders and the
underline which is drawn at the bottom of the character
field. Approximately 20% of the character field height is a
good starting point. Similarly, the maximum character height
should be offset below the top of the character field to
leave enough room for accents to be placed on the
characters. Approximately 10% of the character field height
is a good starting point. In addition, a small allowance
should be made on the left and right of the character field
to provide an intercharacter spacing. If it is not possible
to leave space on both sides, then put the space on the
right of the character. Of course, there may be times when
some or all of these rules may be broken, but they should be
understood first, and then only broken for a reason.
C-Sets
C0 Control Set
These are the normal ASCII control characters. Note
that this specification defines what happens when the codes
are received in the NAPLPS data stream. This is not
necessarily the same behavior as when these codes are
received from the keyboard, and in fact, it is up to the
implementor to decide how to handle keystrokes. Keystrokes
are not part of the NAPLPS spec.
Any specifications that deal with what to do with the
character field and cursor position and the active field,
when the active field boundaries are crossed, only take
place if the character field in it's original position is
wholly within the active field. If it is not wholly within
the active field, then the same processing takes place, but
with reference to the entire display area.
Backspace - 08
This code moves the cursor a parallel to the character
path but in a direction opposite from the normal character
advance and by a displacement equal to the normal character
advance. If the new cursor position is wholly or partially
outside of the active field or the display area, then the
cursor is moved to the opposite edge of the field and a
<vertical tab> is executed.
Tab - 09
This moves the cursor in an opposite direction but in a
similar manner to <backspace>.
Line Feed - 0A
This moves the cursor perpendicular to the character
path and by a displacement equal to the interrow spacing. If
the new character field position is wholly or partially
outside of the active field, then one of two things happens.
If scroll mode is active, the character field stays at its
old position and the active field is scrolled in a direction
opposite to the intended cursor movement. If scroll mode is
off, then the character field is positioned at the opposite
boundary of the active field.
Cursor Position - 1C
The two bytes following this control code represent a
row and column address to which the cursor is positioned.
The row address is decoded by taking bits 7 through 1 of the
first byte and subtracting 32. The column address is
obtained from the second byte in the same way. This gives a
range from 0 through 95 inclusive. If either of the 2 bytes
following the 1C is from the C0 or C1 sets, then the entire
sequence is discarded. NOTE that row 0, column 0 is in the
lower left corner of the display screen (Cartesian
coordinates).
Vertical Tab - 0B
This moves the cursor in an opposite direction but in a
similar manner to <linefeed>.
Clear Screen - 0C
This moves the cursor to the upper left character
position on the display and clears the screen. In color
-- 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