Generic FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.0
Unrevised from 9.0 to 10.0.
9.0 version

stream-units-per-inch

Arguments: stream

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.

See also points-to-pixels and pixels-to-points.

GTK Note

The class scaling-stream and the function (setf stream-units-per-inch) have not yet been implemented on the GTK platform.


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

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