2.1.4 Mediums, Sheets, and Streams

Mediums, sheets, and streams are classes of primary importance in the creation of graphics in CLIM.

One of the arguments taken by drawing functions is a medium . A medium keeps track of device-specific information necessary for creating graphics. There are different medium classes to support different devices; thus, there is one medium class for the X Window System and a different one for the Macintosh Common Lisp environment. A medium implements the low-level graphic functions such as drawing a line or displaying a color. A medium also keeps track of its drawing environment, which includes such things as the current transformation, text style, line style, and foreground and background inks.

A sheet specifies the destination for the graphical output of a medium.Whereas mediums are device-specific, sheets are completely portable. Sheets are visible objects that have properties such as a position, a region, a parent, and children. Interface elements such as scrollbars and pushbuttons are subclasses of sheets. For convenience, sheets have also been made to support the graphics protocol. A graphics function call to a sheet object, however, simply results in the same graphics function call being made to the medium object.

Streams are specialized sheets that implement the sheet and stream protocols. A stream is thus a sheet that supports stream methods like write-string and keeps track of additional stream-related state information, such as current cursor position.

CommonLisp Interface Manager 2.0 User's Guide - 18 Mar 2005