2.1.3 Coordinates

When producing graphic output on the drawing plane, you indicate where to place the output with coordinates. Coordinates are a pair of numbers that specify the x and y placement of a point. When a window is first created, the origin (that is, x = 0, y = 0) of the drawing plane is positioned at the top-left corner of the window. Figure 6. shows the orientation of the drawing plane. X extends toward the right, and Y extends downward.


Figure 6. X and Y Axes of the Drawing Plane

Each window looks into some rectangular area of its drawing plane. The specific area of the drawing plane that is visible is determined by the window's region and coordinate transformation. As the window scrolls downward, the origin of the drawing plane moves above the top edge of the window. Because windows can be located anywhere in the drawing plane, it may be inconvenient to keep track of the coordinates of the drawing plane, and it can be easier to think in terms of a local coordinate system .


Figure 7. Using a Local Coordinate System

For example, you might want to draw some business graphics as shown in Figure 7.. For these graphics, it is more natural to think in terms of the Y axis growing upwards, and to have an origin other than the origin of the drawing plane, which might be very far from where you want the graphics to appear. You can create a local coordinate system in which to produce your graphics. The way you do this is to define a transformation that informs CLIM how to map from the local coordinate system to the coordinates of the drawing plane. For more information, see with-room-for-graphics .

CommonLisp Interface Manager 2.0 User's Guide - 18 Mar 2005