Generic Function | Package: cg | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version

## stream-units-per-mm

Arguments: stream

Returns two values; the number of stream units per mm horizontally and the number of stream units per millimeter (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-mm 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 (like `bitmap-window`) as superclasses.

Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version