3 draw \- screen graphics
11 .BI /dev/draw/ n /data
12 .BI /dev/draw/ n /colormap
13 .BI /dev/draw/ n /refresh
20 ushort BGSHORT(uchar *p)
21 ulong BGLONG(uchar *p)
22 void BPSHORT(uchar *p, ushort v)
23 void BPLONG(uchar *p, ulong v)
29 device serves a three-level file system
30 providing an interface to the graphics facilities of the system.
31 Each client of the device connects by opening
33 and reading 12 strings, each 11 characters wide followed by a blank:
38 of the display image (always zero),
57 of the clipping rectangle.
58 The channel format string is described in
60 and the other fields are decimal numbers.
62 The client can then open the directory
70 files associated with the connection.
78 device provides access to
79 images and font caches
80 in its private storage,
83 Each image is identified by a 4-byte integer, its
88 file yields 12 strings formatted as in
90 but for the current image rather
91 than the display image.
92 The current image may be set by writing a
93 binary image id to the
97 A process can write messages to
99 to allocate and free images, fonts, and subfonts;
100 read or write portions of the images;
101 and draw line segments and character
102 strings in the images.
103 All graphics requests are clipped to their images.
104 Some messages return a response to be recovered by
109 The format of messages written to
112 followed by binary parameters;
113 multibyte integers are transmitted with the low order byte first.
118 macros place correctly formatted two- and four-byte integers into a character
123 retrieve values from a character buffer.
124 Points are two four-byte numbers:
127 Rectangles are four four-byte numbers: min
135 Images, screens, and fonts have 32-bit identifiers.
136 In the discussion of the protocol below,
137 the distinction between identifier and actual image, screen, or font
141 should be interpreted as
142 ``the object with identifier
144 The definitions of constants used in the description below can be found in
147 The following requests are accepted by the
150 The numbers in brackets give the length in bytes of the parameters.
173 byte is non-zero, the screen can
174 be accessed from other processes
189 Allocate an image with a given
194 The image will have rectangle
196 and clipping rectangle
200 is non-zero, the image's replicate
205 specifies the method to be used to draw the window
206 when it is uncovered.
208 causes the server to maintain a backing store,
210 does not refresh the image,
213 causes a message to be sent via
219 The image format is described by
221 a binary version of the channel format string.
222 Specifically, the image format is the catenation of up to four
223 8-bit numbers, each describing a particular image channel.
224 Each of these 8-bit numbers contains a channel type in its
225 high nibble and a bit count in its low nibble.
226 The channel type is one of
239 is the catenation of four 8-bit numbers
240 specifying the red, green, blue, and alpha
241 channels of the color that the new image should
242 be initially filled with.
243 The red channel is in the highest 8 bits, and
244 the alpha in the lowest.
245 Note that color is always in this format, independent of
253 Change the replicate bit and clipping rectangle of the
256 This overrides whatever settings were specified in
257 the allocate message.
269 operator to combine the rectangle
277 using a rectangle of image
279 as an alpha mask to further control blending.
280 The three rectangles are congruent and aligned such that
281 the upper left corner
303 is non-zero, enable debugging output.
305 The meaning of ``debugging output'' is implementation dependent.
318 Draw an ellipse in image
320 centered on the point
322 with horizontal and vertical semiaxes
326 The ellipse is drawn using the image
337 The ellipse is drawn with thickness
343 only the arc of the ellipse from degree angles
348 For the purposes of drawing the arc,
350 is treated as a signed 31-bit number
351 by ignoring its high bit.
364 Draws an ellipse or arc as the
366 message, but rather than outlining it, fills
367 the corresponding sector using the image
371 field is ignored, but must be non-negative.
376 Free the resources associated with the image
382 Free the screen with the specified
384 Windows on the screen must be freed separately.
395 character cells, each with
408 Load a character into the font cache associated with image
412 The character data is drawn in rectangle
414 of the font cache image
416 the congruent rectangle in image
418 with upper left corner
421 specifies the width of the character\(emthe spacing from this character to the next\(emwhile
424 the horizontal distance from the left side
425 of the character to the left side of the cache image.
426 The dimensions of the image of the character are defined by
439 Draw a line of thickness
447 The line is drawn using the image
449 translated so that point
461 fields specify whether the corresponding
462 line end should be a square, a disc,
478 is non-zero, associate the image
486 already corresponds to the
489 the association is deleted.
496 Introduce the identifier
498 to correspond to the image named
509 so that its upper left corner is at the
513 Simultaneously change its internal (logical) coordinate system
516 corresponds to the upper left corner of the window.
521 Set the compositing operator to
523 for the next draw operation.
537 Draw a polygon of thickness
539 It is conceptually equivalent to a series of
541 line-drawing messages (see
544 joining adjacent points in the list of points
548 is translated so that the point
552 aligns with the first point
555 The polygon need not be closed:
559 specify the line endings for the first and
560 last point on the polygon.
561 All interior lines have rounded ends
562 to make smooth joins.
573 Draw a polygon as the
576 fill it rather than outlining it.
577 The winding rule parameter
579 resolves ambiguities about what to fill if the polygon is self-intersecting.
584 a pixel is inside the polygon if the polygon's winding number about the point
590 a pixel is inside if the winding number is odd.
591 Complementary values (0 or ~1) cause outside pixels to be filled.
592 The meaning of other values is undefined.
593 The polygon is closed with a line if necessary.
599 Cause the next read of the
601 file to return the image pixel data corresponding to the
619 the text string specified by the
625 starting with the upper left corner at point
629 The image drawn is taken from image
639 All drawing is confined to the clipping rectangle
656 Like the string drawing
658 command, but fill the background of each character
659 with pixels from image
663 is translated so that the point
674 Attach to the public screen with the specified
676 It is an error if the screen does not exist, is not public, or does not
677 have the channel descriptor
679 for its associated image.
688 windows to the top (if
690 is non-zero) or bottom (if
692 is zero) of the window stack.
693 The window is specified by the list of
697 are moved as a group, maintaining their own order within the stack.
701 Flush changes from a soft screen, if any, to the display buffer.
714 Replace the rectangle
718 with the pixel data in
720 The pixel data must be in the format dictated by
722 image channel descriptor (see
726 message uses uncompressed data,
729 message uses compressed data.
731 it is an error to include more data than necessary.
735 returns the system color map used on 8-bit displays.
736 Each color map entry consists of a single line containing
737 four space-separated decimal strings.
738 The first is an index into the map, and the remaining three are
739 the red, green, and blue values associated with that index.
740 The color map can be changed by writing entries in the
745 Note that changing the system color map
746 does not change the color map used for
747 calculations involving
749 images, which is immutable.
754 As windows owned by the client are uncovered,
755 if they cannot be refreshed by the server (such as when they have
756 refresh functions associated with them), a message is made available
759 file reporting what needs to be repainted by the client.
760 The message has five decimal integers formatted as in the
762 message: the image id of the window and the coordinates of the rectangle
763 that should be refreshed.
765 .B /sys/src/9/port/devdraw.c
767 .B /sys/src/libmemdraw
772 these can be detected by a system call error
776 of the data containing the erroneous message.
777 The most common error is a failure to allocate
778 because of insufficient free resources. Most other errors occur
779 only when the protocol is mishandled by the application.
785 refresh method is not fully implemented.
789 files only reference the system color map, and as
790 such should be called
793 .BI /dev/draw/ n /colormap\f1.