FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version


Arguments: stream

Creates and returns a position object indicating the current origin of stream. The origin is the position on the scrollable page (canvas) of the stream to which the position 0,0 in stream (user) coordinates will map. The origin is specified relative to the upper-left corner of the page. stream should be a cg-stream.

(setf stream-origin) may be called to set the origin to a new position relative to the upper-left corner of the page.

A stream's origin is initially 0,0, meaning that something drawn on the stream at 0,0 will be placed at the top-left of the stream's scrollable page (or simply at the stream's upper-left corner if it is not scrollable).

As an example,

(setf (stream-origin my-stream) (make-position 30 80))

would move the origin so that drawing something on the stream at 0, 0 will place it 30 pixels rightward and 80 pixels downward from the upper-left corner of the stream's page. The leftmost and topmost position that may be drawn to would then be the position -30, -80.

It is typically most straightforward to leave the origin of a stream at its initial 0, 0 position, and draw everything at positive coordinates relative to that. One handy use of the origin, however, is to draw a polygon (with draw-polygon) at different locations on the page by setting the stream's origin differently for each location, rather than changing all of the vertices of the polygon.

For a scaling-stream, the stream-origin position is still measured in pixels (device units) rather than in arbitrarily-scaled stream units as other user-level coordinates are.

See also nstream-origin, move-stream-origin, and cg-coordinates.htm (especially the section Coordinate System Location of Origin).

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.

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