stream-units-per-mm

Generic Function

Package: common-graphics

Arguments: stream

Returns two values; the number of stream units per mm horizontally and the number of stream units per mm vertically. stream may not be a text-edit-window or a text-edit-pane.

setf can be used with this function to change the scale at which drawing is done on certain streams (see below). Initial stream units are in pixels, so, for example, drawing a line from (0,0) to (0, 100) draws a line 100 pixels long. Changing the value returned by this function will make a line of length 100 stream units something other than 100 pixels long.

This makes it possible to redirect output that is usually drawn in a window so that it is drawn on a printer instead without having to scale the drawing coordinates in your own code. Suppose, for example, your monitor has 4 pixels per mm. Then

(setf (stream-units-per-inch my-printer-stream) 4)

allows drawing on the printer stream with the same coordinates as drawing in the window and getting an image the same size.

Only streams that have scaling-stream mixin can have their stream-units-per-mm modified. scaling-stream is the parent of the printer class but not of any of the built-in window classes. To make a scalable window, you must create a class with scaling-stream and some window class as superclasses.

Common Graphics and IDE documentation is described in About Common Graphics and IDE documentation in cgide.htm.

The documentation is described in introduction.htm and the index is in index.htm.

Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.

Created 2000.10.5.