Common Lisp Streams Contents Index Changes from CLIM 1.0




35 Suggested Extensions to CLIM

This appendix describes some suggested extensions to CLIM. Conforming CLIM implementations need not implement any of these extensions. However, if a CLIM implementation chooses to implement any of this functionality, it is suggested that is conform to the suggested API.

All of the symbols documented in this appendix should be accessible as external symbols in the clim package.

35.1 Support for PostScript Output

CLIM implementations may choose to implement a PostScript back-end. Such a back-end must include a medium that supports CLIM's medium protocol, and should support CLIM's output stream protocol as well.

with-output-to-postscript-stream(stream-var file-stream &key device-type multi-page scale-to-fit orientation header-comments) &body body[Macro]
Within body , stream-var is bound to a stream that produces PostScript code. This stream is suitable as a stream or medium argument to any CLIM output utility, such as draw-line* or write-string . A PostScript program describing the output to the stream-var stream will be written to file-stream . stream-var must be a symbol. file-stream is a stream.

device-type is a symbol that names some sort of PostScript display device. Its default value is unspecified, but must be a useful display device type for the CLIM implementation.

multi-page is a boolean that specifies whether or not the output should be broken into multiple pages if it is larger than one page. How the output is broken into multiple pages, and how these multiple pages should be pieced together is unspecified. The default is nil .

scale-to-fit is a boolean that specifies whether or not the output should be scaled to fit on a single page if it is larger than one page. The default is nil . It is an error if multi-page and scale-to-fit are both supplied as true .

orientation may be one of :portrait (the default) or :landscape . It specifies how the output should be oriented.

header-comments allows the programmer to specify some PostScript header comment fields for the resulting PostScript output. The value of header-comments is a list consisting of alternating keyword and value pairs. These are the supported keywords:

new-pagestream[Function]
Give a PostScript stream stream , new-page sends all of the currently collected output to the related file stream (by emitting a PostScript showpage command), and resets the PostScript stream to have no output.

35.2 Support for Reading Bitmap Files

CLIM implementations may supply some functions that read standard bitmap and pixmaps files. The following is the suggested API for such functionality.

read-bitmap-filetype pathname &key [Generic function]
Reads a bitmap file of type type from the file named by pathname . type is a symbol that indicates what type of bitmap file is to be read. read-bitmap-file can eql -specialize on type .

read-bitmap-file may take keyword arguments to provide further information to the method decoding the bitmap file.

For example, a CLIM implementation might support an :x11 type. read-bitmap-file could take a format keyword argument, whose value can be either :bitmap or :pixmap .

read-bitmap-file will return two values. The first is a 2-dimensional array of ``pixel'' values. The second is a sequence of CLIM colors (or nil if the result is a monochrome image).

make-pattern-from-bitmap-filepathname &key type designs &allow-other-keys [Function]
Reads the contents of the bitmap file pathname and creates a CLIM pattern object that represents the file. type is as for read-bitmap-file .

designs is a sequence of CLIM designs (typically color objects) that will be used as the second argument in a call to make-pattern . designs must be supplied if no second value will be returned from read-bitmap-file .

make-pattern-from-bitmap-file will pass any additional keyword arguments along to read-bitmap-file .



Common Lisp Streams Contents Index Changes from CLIM 1.0