May 1 I973: Iji C
May 1 I973: Iji C
May 1 I973: Iji C
GRAPHICS PROTOCOL
Introduction
This document reflects opinions expressed and decisions reached
at the second meeting of the Network Graphics Group, held at the
Stanford Artificial Intelligence Laboratory in late Nov embe r
1971. It describes nart of a proposed Network Standard Graphics
Protocol for transmittin~ graphics data within the ARPA network.
The particular aspects of the protocol covered in this document
relate to the form and content of ~raphics information sent from
a source of graphical l n f o rrna t l on (an application program, say,
in the "Se rv l ng 1I0st") to a display package for output to a
graphics console (at the "Using Host ll ) . This will take the form
of a sequence of a-bit bytes, and will be called the graphics
output byte stream.
This document is intended to serve as a basis for discussion and
for experimentation over the network. This document does not
.. include form or content of graphics input (data sent frOM the
Using 1I0st to the Serving Host) nor does it cover hO\'I the
connection is estab1 ished between the hosts. A proposal for the
former will be generated eventually by this committee; the latter
is the job of the Connection Committee (of the Network Graphics
Group).
This RFC describes the cornnan ds wh l c h are available in the
protocol in terms of the effect they wou l d have at the re ce l v l n rr
(Using Host) end. Clearly, sone subroutine packap:e is desirable
at the Serving Host for use by app l ications in transmittinp,
graphics data, but on this topic this RFC does not intend to
comrne n t ,
-1
, 't,
/ /
-2
" ,
,;
-3
•
-4
,
/ ",
-5
,
-6
J
-7
/
-8
~-'1 ' general, vie v,porting a l l ows more than one "top level" picture to
be viewed at once. The desire to view several different pictures
on the same screen arises in cases v.he r e multiple users are
working together and in cases where one user is interacting with
a group of appl ications (in separate serving hosts>. This author
maintains that the coordinate transformations required by this
feature are simpler than that of "full subpictures" since no
rotations are involved, and would be part of the same mechanism
in its implementation. In particular, merely another affine
transformation (see Appendix 2> would be added to the levels
caused by full s ubp i c t u r e calls. All that is required is keeping
track of viewport identifiers and the associated rectangles.
Since little extra work is involved, it is proposed that this
feature be included at so~e high level of the protocol.
Command Codes
Each command in the graphics protocol will he assigned a
non-negative value which will represent this command in the byte
stream. The algorithn whereby values and commands are associated
is, it turns out, a very touchy subject. There are five or ten
different criteria for a "best" algorithm, each criterion
different in emphasis. This Gordian knot will be cut, In this
proposal, by ordering the co~mands approximately according to
level, and then just numbering them. In addition, if several
closely related commands occur at the same level, some attempt
will be made to encode variations of meanings in terms of bit
configurations. Even if some later consideration causes a change
in ordering to be proposed, it is this committee's feel ing that
the numbering should not be altered. Howev e r , until this matter
is firmly settled, it is strongly advised that any implementation
take into account the possibil ity of reassignment of command
codes.
Particular Proposal for Leyel 0 Protocol
It is proposed that level 0 be kept very simple. This is so that
impleDentation can be quickly accompl ished and experimentation
with the protocol begun. Another reason is that the least
powerful host and even programmable terminals should be able to
implement it. In accordance w I t h this, the "rule" was made that
a command be included only if its output is a function solely of
the current cOr.lDand and the "beam position" current at the start
of the command. In other words, the interpreter for level 0 need
have no internal storage for "modes" or pu s hdown stacks. ,..,rith
this restriction it is hoped that a very simple implementation
will be possible for level o. In particular, perhaps one could
eventually build a hardware translator from level 0 code to one's
own particular terninal 's code.
Note that in the opcode assig~nent for level 0, bits 4, 2, and 1
have special meaning for the move, line, and dot commands. In
-9
particular, the 1 bit encodes absolute versus relative data mode,
the 4 bit encodes whether any visible output occurs, and the 2
bit determines whether the visible output is aline or a dot.
Level 0; Command Summary
The following is a 1 ist of com~ands (and their syntax) in level
zero. Detailed descriptions of these commands follow in the next
section. Commands deal ing with protocol may be added by the
Connection Committee. (They currently request opcodes in the
range 128 to 255.)
(As described in Basic Data Forms, above, <x coordinate>, <y
coordinate>, <x delta> and <y delta> are two-byte coordinate
values, <string> is a count followed by (count) many bytes and
<value> is an eir,ht bit number.)
Decimal Octal Binary Format
o 0 00000000 Nu 11
coordinate>
coordinate>
coordinate>
Picture command.
-10
,...·1 x an d v ,
(IlDRA~'JAIl)
Aline is drawn from the current beam position to the specified
(IlDRA~'JR")
A line is drawn from the current beam position to the position
displayed there.
its text to the previous string. (The use of the TEXT command is
unspecfied.
the normal size for the device being operated; then reposition
"normal s l ze s " choose the size so that s e ve n t y-r two characters are
unspecified.
-11
..--, 10 En J 0 f Pic t u r e ( liEN DPIC II ) •
This command denotes the end of a new picture. It must be paired
with a preceeding ERASE command.
11 Escape to device specifics ("ESCDEV") <value> <strin~>.
If "value" is the code as s l rme d (by the Protocol Committee) to
the device being operated, then transmit the eight-bit bytes in
<string> (which starts with a <count> indicatin~ the number of
bytes) to the device without examining them. Otherwise ignore
this corman d , If the device does not accept a-bit information,
reformat the data in some device specific way; an example would
be throwing away the hi~h order hit for a seven bit device, or
gathering 58-bit bytes into one 3G-bit word, again discarding
the high order bits, perhaps. The action of the bytes in the
string should leave alone (or at least restore) any hardware beam
position registers in the device which the interpreter might
concievably depend on.
This command really should not be used; it was included at level
o so that specific appl ications can do mode settin~ and other
device specific manipulations. For example, ARDS terminals may
optionally have several independently addressable output scopes.
The selection mechanism changes state only when a particular
sequence of ASCI I characters reaches the terminal. Thus ESCDEV
would be used to select which scope(s) is/are to be affected by
following commands. (The current state is invisible to the
graphics package at the Using Host.)
Further, suppose that another nake of terminal has a similar
option, which responds to a diferent code sequence. This
po s s l b l l ity is the motivation for conditionally ignoring the
ESCDEV command based on the "<value>" specified. Given that a
particular appl ication will only be used to output to either an
ARDS or this second make (with the multiple scope option), then
the appl ication could always send two ESCDEV commands, one
applicable only to ARDS terminals, and the other applicable only
to the second make.
-12
LEVEL 1
*Set Line mode (ILINf.'IOn") <value>.
This command sets the current 1 ine mode; possible modes and the
<value> ....h l ch sets each are: sol id (0), dashed (1), dotted (2),
and others (3 or ». At the beginning of a new picture (i.e.,
after an Erase and Reset co~nand), 1 ine mode is sol ide If a site
does not have a certain mode readily available, it maya)
simulate it in software, b) substitute another in its place
(dashed for dotted, or vice versa) c) ignore it entirely. What
is provided should be clearly indicated in any publ ic document.
It is strongly recommend that at least sol id and one other mode
be provided.
*Set intensity (IISETINT II ) <value>.
This command sets the intensity of 1 ines, dots and characters
displayed following the command. If <value> is 128 decimal,
normal intensity should be set. If <value> is 255 decimal,
brightest should be selected, and if it is 0, then the beam
should be blanked. Intermediate values should be mapped
appropriately as the implementer sees fit. For instance, if
brightest is the same as normal, all values from 128 through 255
should be mapped to nornal. Information displayed between the
start of a new picture (the ERASE comnand) and the first SETINT
command appears at no rrna l intensity.
*Text out ("TEXTO") <strins;>.
Starting from the current beam position, this COmMand displays
the <string> (of net v.o r k ASCII characters) formatted as if it
we r e typed material (at the current intensity). <string>
consists of a <count> followed by count many characters. That
is, text extending past the ri~ht mar~in \"il 1 be broken and
repositioned at the left margin on the next 1 ine down. Of the
control characters, only carriage return, 1 ine feed, and
backspace are required to be interpreted properly.
*Subpicture header ("SUBIIED") <identifier> <count> <header info>.
This command begins the definition of a subpicture named
"<identifier>lI. This definition is terminated by a matching
SUBEND command. The definition will be remembered until a new
one is specified or until the graphics network connection is
broken. Note that <identifier> is a <string> consisting solely
of capital letters and numbers.
Subpicture definitions may be nested; this will be equivalent to
transmitting the two definitions separately. In other words, all
s ubp l c t u r e names are g l o ba l s and are "knm'm" to all other
subpictures. If a subpicture definition has not been received
prior to its use in a picture, the empty subpicture should be
displayed in its place until a definition is received.
-13
A subpicture definition need not be transmitted as part of a
picture (i.e., within an ERASE and END command pair). Indeed,
all subpicture definitions might preceed the main picture.
Currently, the <count> will always be 1, indicating only one byte
of <header info> follows, but at higher levels of the protocol
room for expansion may be required. In the <header info>, the 80
hex bit will be set if this subpicture can be a simple
subpicture, and the 40 hex bit will be set if the subpicture can
be a full subpicture. (It is possible that one subpicture can be
both.)
Other information that may beven uall ~ be present in <header
info> include whether the current value of a certain mode or
parameter should be saved on entry to, and restored on exit from,
this subroutine whenever it is called. These modes and
para meters include: 1 ine mode, intensity, character size, and
data length.
hex bit of the single byte of <header info> must have been set in
40-hex bit is set, then next in the byte stream (following the AS
the 40 hex nor the 80 hex bits are set, then neither the AT
-14
/
-15
LEVEL 2
*1·lark ("I·:ARI~").
u p ( un 1e s s i t i s ernp t y ).
1 ine (of the current 1 ine l ' ~ode and I n t e n s i t v ) f r om the current
bean position to the ;<,'J position at the tor> of the "ma r k "
pu s h down s t ac l: , and sets the be art r>OS i t ion to that val UP.. Then
-lG
,
I
Leve 1 3
(Perhaps all rotational transformations should be put at a h l zhe r
level, for instance higher than viewport operations.)
*Full Instance ("ItJSTF") <identifier> <full instance tail>
This comnand indicates that the subpicture <identifier> is to be
called (instanced) in a "full II manner as described in an
explanatroy section. For one thing, this means that the 40 hex
bit of the single byte of <header info> must have been set in the
SUBHED command which started the definition of <identifier>. If
<identifier> has never been defined, the empty subpicture (i.e.,
nothing) should be displayed in its place.
The <full instance tail> is similar to the <simple instance tail>
described under the Ir~STS command, but the former contains more
information. Below is a 1 ist of the information which can be
specified, and the bit assigned to the presence/absence of each
piece of information . The pieces of information which are
present always appear in the byte stream in the order they are
described in this 1 ist. (All the pieces of information are
described more fully in Full Subpicture Calls, except for the liAs
l n f o rrua t l on " wh l ch is described in Simple Subpicture Cal l s , )
Bit(hex) Information
80 As inforrlation -- II namell of this particular
instance. Consists of an <identifier>.
40 Translation infor~ation -- Center of the
subpicture's image on the call ing page. Consists
of an <x coordinate> and a <y coordinate>.
20 Rotation -- Fractional part of 2pi to rotate the
image counterclockwise. Consists of a 16-bit
unsigned fraction.
-17
ze ro ) •
set.
subpicture call, another code byte could follow all the above
instance tail> would include this second code byte and any
-18
~1 .
system of the called subpicture. All these chan~es may be very
hard to accoMplish, and what should be done will be left
unspecified at this time, with comment from readers particularly
invited.
-19
--- - ---~
Leve 1. 4
(Perhaps v l ewpo r t operations can he included in . level 3.)
*Declare Viewport
("SETV\~lI) <v l ewpo r t l d > <x coordinate> <v coordinate> <x delta>
<y delta>
indicated area of the logical screen. The x and y data are not
position.
If <x delta> or <y delta> are negative, the viewport named should
appear.
Because it affects the top level picture, this author feels that
All subpictures which have been added with the ADOSVW comMand to
-20
I
the viewport specified in this co~mand are removed from it. Thus
the specified viev/port contributes nothing to what the human
viewer sees. (After a CLVW, the area of the viewport may not be
blank due to other, non-cleared viewports which overlap it.)
Because it affects the top level picture, this author feels that
this command should not occur as part of a picture or in a
subpicture declaration.
-21
I
I
( -.\ . Leye 1 ?
-22
/ '-: .:,9
Leve 1 ? I
two.
Leve 1 ? I I
(These com~ands should probably be at the same level as viewport
ope rat ion s, if no tea r 1 i e r • )
*Extens ive Changes Fo l l ow ("DELAY").
This optional command is designed to el iminate futile effort on
the part of the Usinr, Host pror,rams. At some hosts and/or with
some output devices (particularly storage tubes) a non-neg] igible
amount of time may be required to present an ima~e to the human
. viewer. If extensive changes are going to be made, this cOr.lmand
wou l d be used to prevent the Us l nz Host graphics package from
updating the image after every chan~e. A NODELAY command exits
from the DELAY mode and causes the iMar,e to be prepared and
presented to the viewer.
For example, the current picture may display four subpictures
each of which is ~oinr, to be redefined. Without a DELAY command,
the viewer would see successive stages of the change, each
possihly involving a large amount of computation or transmission
time.
-23
I
'-\
. .. Appendix 1: BNF for the Graphics Protocol Byte Stream
Key to below:
Non-terminals are represented in < >.
Terminals which are keywords standing for particular eight-bit
values are in capitals.
Terminals whose meaning should be clear to the reader are in
lower case. Note that "empty_string" means "zero bytes," not "a
<s t r i n g > \'J h0 s e <co u n t > i s z e r 0 • II
stream>
byte strearl>
<picture> ::= <new picture stt> <program stt group> <end picture
stt>
<subpicture declaration> ::= <subpicture header stt> <program stt
group> <subpicture end stt>
<viewport operation> ::= <declare viewport stt>
-24
<text and re5tore beam stt>
<text stt>
<v ewpo r t
l l d >
<set character size stt> ::= SETCHS <x delta> <y delta>
-25
- ..
-26
Appendix 2. Mathematical Eor~ulae for Subpictures
Transforr:1ations
In this appendix positions in a logical coordinate system will be
represented by a row vector with two elements, as in L x y_I.
Vectors and matrices will be del imited by these funny brackets:
L _I. various symbols will be used to represent parameters in a
full subpicture call relating to a transfor~ation from one
coordinate system to another; these are defined below:
Mx and My : magnifications in x and y to be appl ied before
any rotation. They may be negative indicating
reflection.
8 an angle of rotation in the range 0 to just less than
2p i .
L Icx Icy_I: the center (in the calling picture) of the
image of the suhpicture.
Isx and Isy : the half-sizes, in the x and y directions, of
the image on the call ing page in terms of the
call ing page's coordinate system. They may be
negative to indicate reflection.
L x y_1 : a position on the called page.
L Ix ly_/: the position on the call ing page corresponding
to L x y_l.
L Pcx Pcy_l: The center of the portion of the called
subpicture's coordinate system which is to he
mapped to the call in~ par,e. This defaults to L 0
0_1 if not specified.
Psx and Psy : The half-sizes in x and y of the portion of
the subpicture to be mapped. These both default
to +1/2 in not specified.
(.i a uniform magnification is specified, s~t Mx and My equal to
it and proceed below as if they were specified.)
I cos 8 I 1/2 o I + L I ex
L -sinS L 0 112_1
or, in other words,
1)
Llx ly_1 = L x-Pcx y-Pcy_1 * I t ~x cos8/2Psx t1x sin8/2Psx I
L -My sin8/2Psy My cos8/2Psy_1
+ L Icx Icy_I
-27
(The factor of 1/2 is necessary because, for instance,
(x-Pcx)/Psx ranges from -1 to +1 for x values within the portion
( 1. e ., s uc h t hat I x- Pcx I < IPs x I ) \'J her e as the image , i nth e
call ing subpicture's coordinate system, should only range from
-1/2 to +1/2.)
If the image size is specified instead of the magnification, we
have the following:
L Ix ly_1 = (L x Y_I - LPcx Pcy I) * / I/Psx 0 / *
L 0 11 Psy _I
-28
.... .
•
1
. .· Another example is if no portioning is done (Pex~Pey=O,
Psx=Psy=1/2):
Sa) Llx Iy_/ = Lx y_/ * /Mx eosS Mx sinS / + Llex
L -t-1y s l ns My sln9_1
Sb) Llx Iy-' = Lx y_1 * 121sx cosS 21sy sinS I + Llcx Icy_I
L-2lsx sinS 21sy eosS_1
If, in addition, 6=0, we have:
6a) LI x I v.:' = L x~'ix+ Iex yMy+ Icy_I
6b) Llx IY_I =L x*2Isx+lcx y*2Isy+lcy_/
Of course, in all cases, the t r ans f o rma t l on from Lx y_/ to Llx
ly_1 can be written in the form:
Llx ly_1 = Lx y_1 * I 2 by 2 I + L translation _I
L mat r i x _I
In general, a transformation combinin~ a linear transformation
and a translation is called an affine transformation.
Transformations \\Iith I!ested Levels
The combination of two affine transforMations is again an affine
transformation. Indeed, if
Llx Iy-' = Lx y_I * I MatI / + L TranI _I
L _I
and
Llx' ly'_1 = Llx ly_1 * I Mat2 I + L Tran2 _I
L _I
then
Llx' I y'_1 = Lx y_1 *( I MatI I * I Mat2 I)
L _I L _I
-29
-.
-30