Next Prev Up Top Contents Index

18.7.1 Mediums and Output Properties

Each sheet retains some output state that logically describes how output is to be rendered on its window. Such information as the foreground and background ink, line thickness, and transformation to be used during drawing are provided by this state. This state may be stored in a medium associated with the sheet itself, may be derived from a parent, or may have some global default, depending on the sheet itself.

If a sheet is mute for output, it is an error to set any of these values.

medium [Protocol Class]	

Summary: The protocol class that corresponds to the output state for some kind of sheet. There is no single advertised standard medium class. If you want to create a new class that behaves like a medium, it should be a subclass of medium . Subclasses of medium must obey the medium protocol.

mediump [Function]	

Arguments: object

Summary: Returns t if object is a medium; otherwise, it returns nil .

basic-medium

Summary: The basic class on which all CLIM mediums are built, a subclass of medium . This class is an abstract class intended only to be subclassed, not instantiated.

The following generic functions comprise the basic medium protocol. All mediums must implement methods for these generic functions. Often, a sheet class that supports the output protocol will implement a "trampoline" method that passes the operation on to sheet-medium of the sheet.

medium-foreground [Generic Function]

Arguments: medium

(setf medium-foreground) [Generic Function]

Arguments: ink medium

Summary: Returns (or sets) the current foreground ink for the medium medium . For details, see 3.1, CLIM Mediums

medium-background [Generic Function]

Arguments: medium

(setf medium-background) [Generic Function]

Arguments: ink medium

Summary: Returns (or sets) the current background ink for the medium medium . This is described in detail in 3.1, CLIM Mediums

medium-ink [Generic Function]

Arguments: medium

(setf medium-ink) [Generic Function]

Arguments: ink medium

Summary: Returns (or sets) the current drawing ink for the medium medium . This is described in detail in 3.1, CLIM Mediums

medium-transformation [Generic Function]

Arguments: medium

(setf medium-transformation) [Generic Function]

Arguments: transformation medium

Summary: Returns (or sets) the user transformation that converts the coordinates presented to the drawing functions by the programmer to the medium medium 's coordinate system. By default, it is the identity transformation. This is described in detail in 3.1, CLIM Mediums

medium-clipping-region [Generic Function]

Arguments: medium

(setf medium-clipping-region) [Generic Function]

Arguments: region medium

Summary: Returns (or sets) the clipping region that encloses all output performed on the medium medium . It is returned and set in user coordinates. That is, to convert the user clipping region to medium coordinates, it must be transformed by the value of medium-transformation . For example, the values returned by:

        (let (cr1 cr2) 
          ;; Ensure that the sheet's clipping region 
          ;; and transformation will be reset: 
          (with-drawing-options 
           (sheet :transformation +identity-transformation+ 
                  :clipping-region +everywhere+) 
           (setf (medium-clipping-region sheet) 
                 (make-rectangle* 0 0 10 10))
           (setf (medium-transformation sheet) 
                 (clim:make-scaling-transformation 2 2)) 
           (setf cr1 (medium-clipping-region sheet)) 
           (setf (medium-clipping-region sheet) 
                 (make-rectangle* 0 0 10 10))
           (setf (medium-transformation sheet) +identity-transformation+)
           (setf cr2 (medium-clipping-region sheet)))
          (values cr1 cr2))

are two rectangles. The first one has edges of (0, 0, 5, 5), while the second one has edges of (0, 0, 20, 20).

By default, the user clipping region is the value of +everywhere+ .

medium-line-style [Generic Function]

Arguments: medium

(setf medium-line-style) [Generic Function]

Arguments: line-style medium

Summary: Returns (or sets) the current line style for the medium medium . This is described in detail in 3.1, CLIM Mediums

medium-text-style [Generic Function]

Arguments: medium

(setf medium-text-style) [Generic Function]

Arguments: text-style medium

Summary: Returns (or sets) the current text style for the medium medium of any textual output that may be displayed on the window. This is described in detail in 3.1, CLIM Mediums

medium-default-text-style [Generic Function]

Arguments: medium

(setf medium-default-text-style) [Generic Function]

Arguments: text-style medium

Summary: Returns (or sets) the default text style for output on the medium medium . This is described in detail in 3.2, Using CLIM Drawing Options

medium-merged-text-style [Generic Function]

Arguments: medium

Summary: Returns the actual text style used in rendering text on the medium medium . It returns the result of:

(merge-text-styles (medium-text-style medium)

(medium-default-text-style medium))

Those components of the current text style that are not nil will replace the defaults from medium's default text style. Unlike the preceding text style function, medium-merged-text-style is read-only.


CommonLisp Interface Manager 2.0 User's Guide - 8 Aug 2003

Next Prev Up Top Contents Index