CLIM offers a set of drawing functions that enable you to draw points, lines, polygons, rectangles, ellipses, circles, and text. You can affect the way the geometric objects are drawn by supplying options to the drawing functions. The drawing options specify clipping, transformation, line style, text style, ink, and other aspects of the graphic to be drawn. See 3.2 Using CLIM Drawing Options.
When drawing graphics in CLIM, you imagine that they appear on a drawing plane. The drawing plane extends infinitely in four directions and has infinite resolution (no pixels). The drawing plane has no material existence and cannot be viewed directly. The drawing plane provides an idealized version of the graphics you draw. A line that you draw on the drawing plane is infinitely thin.
Of course, you intend that the graphics should be visible to the user, so they must be presented on a real display device. CLIM transfers the graphics from the drawing plane to the window via the rendering process. Because the window lives on hardware that has physical constraints, the rendering process is forced to compromise when it draws the graphics on the window. The actual visual appearance of the window is only an approximation of the idealized drawing plane.
Rendering from Drawing Plane to Window shows the conceptual model of the drawing functions sending graphical output to the drawing plane, and the graphics being transferred to a screen by rendering. The distinction between the idealized drawing plane and the real window enables you to develop programs without considering the constraints of a real window or other specific output device. This distinction makes CLIM's drawing model highly portable.
CLIM application programs can inquire about the constraints of a device, such as its resolution and other characteristics, and modify the desired visual appearance on that basis. This practice trades portability for a finer degree of control of the appearance on a given device.
When producing graphic output on the drawing plane, you indicate where to place the output with coordinates. Coordinates are a pair of numbers that specify the x and y placement of a point. When a window is first created, the origin (that is, x = 0, y = 0) of the drawing plane is positioned at the top-left corner of the window. X and Y Axes of the Drawing Plane shows the orientation of the drawing plane. X extends toward the right, and Y extends downward.
Each window looks into some rectangular area of its drawing plane. The specific area of the drawing plane that is visible is determined by the window's region and coordinate transformation. As the window scrolls downward, the origin of the drawing plane moves above the top edge of the window. Because windows can be located anywhere in the drawing plane, it may be inconvenient to keep track of the coordinates of the drawing plane, and it can be easier to think in terms of a local coordinate system.
For example, you might want to draw some business graphics as shown in Using a Local Coordinate System. For these graphics, it is more natural to think in terms of the Y axis growing upwards, and to have an origin other than the origin of the drawing plane, which might be very far from where you want the graphics to appear. You can create a local coordinate system in which to produce your graphics. The way you do this is to define a transformation that informs CLIM how to map from the local coordinate system to the coordinates of the drawing plane. For more information, see with-room-for-graphics.
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.
CLIM 2.0 User Guide - 01 Dec 2021 19:38:56