stream-units-per-inch

Generic Function

Package: common-graphics

Arguments: windows-screen-device

Returns two values; the number of stream units per inch horizontally and the number of stream units per inch 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 90 pixels per inch. Then

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

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-inch 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.

Note: incompatible change in release 6.0: in releases prior to 6.0, when a frame-with-single-child instance was passed to this operator, the operator was actually applied to the child (the result of applying frame-child to the frame-with-single-child instance). In release 6.0, this redirection no longer occurs. If you intend this operator to apply to the frame-child, pass that to this operator rather than the parent. This is a non-backward-compatible-change. See the release notes for more information.

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.