include "draw.m"; draw:= load Draw Draw->PATH; Display: adt { image: ref Image; ones: ref Image; zeros: ref Image; allocate: fn(dev: string) :ref Display; startrefresh:fn(d: self ref Display); publicscreen:fn(d: self ref Display, id: int) :ref Screen; newimage: fn(d: self ref Display, r: Rect, ldepth, repl, color: int) :ref Image; color: fn(d: self ref Display,color: int):ref Image; rgb: fn(d: self ref Display, red, green, blue: int):ref Image; open: fn(d: self ref Display, name: string) :ref Image; readimage: fn(d: self ref Display, fd: ref Sys->FD) :ref Image; writeimage: fn(d: self ref Display, fd: ref Sys->FD, i:ref Image) :int; rgb2cmap: fn(d: self ref Display, red, green, blue: int) :int; cmap2rgb: fn(d: self ref Display, color: int) :(int, int, int); };
image | The visible contents of the display. Draw on image to change the display. |
ones, zeros | Replicated images of a single pixel, either all ones (true) or all zeros (false). Useful as masks for basic graphical operations. |
allocate (dev) | Attach to a new display, represented by the draw device mounted in the specified dev directory. If dev is the empty string, /dev is used. The return value is nil if the allocation fails. |
d.startrefresh ( ) | Receive and process window refresh events from the device. After allocating a Display object, the application should spawn a thread to call startrefresh. |
d.publicscreen (id) | Create a locally addressable pointer to a public Screen. See Screen - type to define the abstract data structures for the windows on a display. |
d.newimage (clipr, ldepth, repl, color) | Allocate an off-screen Image. The arguments supply the values for that are used to paint the image when created. |
d.color (color) | Create a single-pixel, replicated off-screen image of the specified color. The Draw module defines constants for several common colors: Black, Blue, Green, Red, White, and Yellow. |
d.rgb (red, green, blue) | Use the values (from 0 [no color] through 255 [saturated]) of red, green, and blue to find the closest matching color map entry, and creates a single-pixel replicated image of that color. Equivalent to d.color(d.rgb2cmap(red, green, blue)). |
d.open (file) | Read an image description from file and return an Image holding the picture. This function will implicitly handle either compressed or uncompressed formats. (See image - external format for images in Appendix A for further details) |
d.readimage (fd) | Analogous to open, except the image is obtained from an open file descriptor, fd, rather than a named file. |
d.writeimage (fd, i) | Complement of readimage. Write an image file representing image i to the open file descriptor, fd. This image is always written in a compressed format. See image - external format for images in Appendix A for further details. |
d.rgb2cmap (red, green, blue) | Return the color map index of the color that best matches the color triple. The values of the components range from 0 (no color) to 255 (saturated). |
d.cmap2rgb (color) | Decompose the color into a color triple and return the result. |