Next Prev Up Top Contents Index

3.2 Using CLIM Drawing Options

Drawing options control various aspects of the drawing process. You can supply drawing options in a number of ways:

The medium (the destination for graphic output) itself has default drawing options. If a drawing option is not supplied elsewhere, the medium supplies the value. See the preceding section, "Components of CLIM Mediums."

You can use with-drawing-options to bind the drawing options of the medium temporarily. In many cases, it is convenient to use with-drawing-options to surround several calls to drawing functions, each using the same options.

You can supply the drawing options as keyword arguments to the drawing functions. These override the drawing options specified by with-drawing-options .

In some cases, it is important to distinguish between drawing options and suboptions. Both text and lines have an option that controls the complete specification of the text and line style, and there are suboptions that can affect one aspect of the text or line style. For example, the value of the :text-style option is a text style object, which describes a complete text style consisting of family, face, and size. There are also suboptions called :text-family , :text-face , and :text-size . Each suboption specifies a single aspect of the text style, while the option specifies the entire text style. Line styles are analogous to text styles; there is a :line-style option and some suboptions.

In a given call to with-drawing-options or a drawing function, you would normally supply either the :text-style option or a text style suboption (or more than one suboption), but not both. If you do supply both, then the text style comes from the result of merging the suboptions with the :text-style option, and then merging that with the prevailing text style.

with-drawing-options [Macro]	

Arguments: (medium &rest drawing-options) &body body

Summary: Binds the state of the medium designated by medium to correspond to the supplied drawing options, and executes the body with the new drawing options specified by drawing-options in effect. Each option causes binding of the corresponding component of the medium for the dynamic extent of the body. The drawing functions effectively do a with-drawing-options when drawing option arguments are supplied to them.

medium can be a medium, a sheet that supports the sheet output protocol, or a stream that outputs to such a sheet. The medium argument is not evaluated, and must be a symbol that is bound to a sheet or medium. If medium is t , *standard- output* is used. body may have zero or more declarations as its first forms.

with-drawing-options expands into a call to invoke-with-drawing-options , supplying a function that executes body as the continuation argument to invoke- with-drawing-options .

invoke-with-drawing-options [Generic Function]

Arguments: medium continuation &rest drawing-options

Summary: Binds the state of the medium medium to correspond to the supplied drawing options, and then calls the function continuation with the new drawing options in effect. continuation is a function of one argument, the medium; it has dynamic extent. drawing-options is a list of alternating keyword-value pairs, and must have even length. Each option in drawing-options causes binding of the corresponding component of the medium for the dynamic extent of the body.

medium can be a medium, a sheet that supports the sheet output protocol, or a stream that outputs to such a sheet. All classes that obey the medium protocol implement a method for invoke-with-drawing-options .

drawing-options can be any of the following, plus any of the suboptions for line and text styles. The default value specified for a drawing option is the value to which the corresponding component of a medium is normally initialized.

3.2.1 Set of CLIM Drawing Options

3.2.2 Using the :filled Option


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

Next Prev Up Top Contents Index