Generic FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 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-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version