device serves a three-level file system
providing an interface to the graphics facilities of the system.
The Limbo Draw module (see
implements its functions using this device.
Each client of the device connects by opening
and reading 12 strings, each 11 characters wide followed by a blank:
the connection number
the image id
of the display image (always zero),
of the image,
of the display image,
of the clipping rectangle.
The channel format string is described in
and the other fields are decimal numbers.
The client can then open the directory
to access the
files associated with the connection.
device provides access to
images and font caches
in its private storage,
as described in
Each image is identified by a 4-byte integer, its
file yields 12 strings formatted as in
but for the current image rather
than the display image.
The current image may be set by writing a
binary image id to the
A process can write messages to
to allocate and free images, fonts, and subfonts;
read or write portions of the images;
and draw line segments and character
strings in the images.
All graphics requests are clipped to their images.
Some messages return a response to be recovered by
device provides three types of graphical resource: Images, Screens and Fonts.
Resource instances have an identification number.
Screen identifiers are global to the device.
All other identifiers are local to each client.
Image is the fundamental resource type on which all drawing primitives
At client connection the physical display is represented by Image 0.
A Screen manages a set of (overlapping) Images, handling
Z-order and position manipulation and the refreshing of regions
uncovered by such operations.
When a Screen is created it is associated with an Image on which
to render itself.
New images can be associated with a screen when they are created; they
are then treated as windows on that screen.
Screens can be marked as
meaning that other clients can import their ID and create new windows
A Font is an image with associated character data.
The Font image provides the bitmap of all the characters in the
Font; the character data is used by the string command to render
characters from the image.
- Command messages
The format of messages written to
is a single letter
followed by binary parameters;
multibyte integers are transmitted with the low order byte first.
Points are two four-byte numbers:
Rectangles are four four-byte numbers: min
Images, screens, and fonts have 32-bit identifiers.
In the discussion of the protocol below,
the distinction between identifier and actual image, screen, or font
is not made, so that
should be interpreted as
``the object with identifier
The definitions of constants used in the description below can be found in
The following requests are accepted by the
The numbers in brackets give the length in bytes of the parameters.
- Allocate a new
backing store image
filling it initially
with data from image
byte is non-zero, the screen can
be accessed from other processes
- Allocate an image with a given
screen named by
The image will have rectangle
and clipping rectangle
is non-zero, the image's replicate
bit will be set (see
specifies the method to be used to draw the window
when it is uncovered.
causes the server to maintain a backing store,
does not refresh the image,
causes a message to be sent via
- The image format is described by
a binary version of the channel format string.
Specifically, the image format is the catenation of up to four
8-bit numbers, each describing a particular image channel.
Each of these 8-bit numbers contains a channel type in its
high nibble and a bit count in its low nibble.
The channel type is one of
is the catenation of four 8-bit numbers
specifying the red, green, blue, and alpha
channels of the color that the new image should
be initially filled with.
The red channel is in the highest 8 bits, and
the alpha in the lowest.
Note that color is always in this format, independent of
the image format.
- Change the replicate bit and clipping rectangle of the
This overrides whatever settings were specified in
the allocate message.
- Use the
operator to combine the rectangle
rectangle of image
using a rectangle of image
as an alpha mask to further control blending.
The three rectangles are congruent and aligned such that
the upper left corner
is non-zero, enable debugging output.
If zero, disable it.
The meaning of ``debugging output'' is implementation dependent.
- Draw an ellipse in image
centered on the point
with horizontal and vertical semiaxes
The ellipse is drawn using the image
The ellipse is drawn with thickness
- If the high bit of
only the arc of the ellipse from degree angles
For the purposes of drawing the arc,
is treated as a signed 31-bit number
by ignoring its high bit.
- Draws an ellipse or arc as the
message, but rather than outlining it, fills
the corresponding sector using the image
field is ignored, but must be non-negative.
- Free the resources associated with the image
- Free the the screen with the specified
Windows on the screen must be freed separately.
- Treat the image
as a font cache of
character cells, each with
- Load a character into the font cache associated with image
at cache position
The character data is drawn in rectangle
of the font cache image
and is fetched from
the congruent rectangle in image
with upper left corner
specifies the width of the character—the spacing from this character to the next—while
the horizontal distance from the left side
of the character to the left side of the cache image.
The dimensions of the image of the character are defined by
- Draw a line of thickness
The line is drawn using the image
translated so that point
fields specify whether the corresponding
line end should be a square, a disc,
or an arrow head.
for more details.
is non-zero, associate the image
with the string
is zero and
already corresponds to the
the association is deleted.
- Introduce the identifier
to correspond to the image named
by the string
- Position the window
so that its upper left corner is at the
on its screen.
Simultaneously change its internal (logical) coordinate system
so that the point
corresponds to the upper left corner of the window.
- Draw a polygon of thickness
It is conceptually equivalent to a series of
line-drawing messages (see
joining adjacent points in the list of points
The source image
is translated so that the point
aligns with the first point
in the list
The polygon need not be closed:
specify the line endings for the first and
last point on the polygon.
All interior lines have rounded ends
to make smooth joins.
- Draw a polygon as the
fill it rather than outlining it.
The winding rule parameter
resolves ambiguities about what to fill if the polygon is self-intersecting.
a pixel is inside the polygon if the polygon's winding number about the point
a pixel is inside if the winding number is odd.
Complementary values (0 or ~1) cause outside pixels to be filled.
The meaning of other values is undefined.
The polygon is closed with a line if necessary.
- Cause the next read of the
file to return the image pixel data corresponding to the
- Draw in the image
the text string specified by the
starting with the upper left corner at point
The image drawn is taken from image
translated to align
All drawing is confined to the clipping rectangle
- Like the string drawing
command, but fill the background of each character
with pixels from image
is translated so that the point
aligns with the
Attach to the public screen with the specified
It is an error if the screen does not exist, is not public, or does not
have the channel descriptor
for its associated image.
windows to the top (if
is non-zero) or bottom (if
is zero) of the window stack.
The window is specified by the list of
are moved as a group, maintaining their own order within the stack.
- Flush changes from a soft screen, if any, to the display buffer.
Replace the rectangle
of pixels in image
with the pixel data in
The pixel data must be in the format dictated by
image channel descriptor (see
message uses uncompressed data,
message uses compressed data.
In either case,
it is an error to include more data than necessary.
file is read-only.
As windows owned by the client are uncovered,
if they cannot be refreshed by the server (such as when they have
refresh functions associated with them), a message is made available
file reporting what needs to be repainted by the client.
The message has five decimal integers formatted as in the
message: the image id of the window and the coordinates of the rectangle
that should be refreshed.