Common Lisp Interface Manager 2.0 User's Guide > Chapter 3 The CLIM Drawing Environment > 3.5 The Transformations Used by CLIM

Transforming a region applies a coordinate transformation to that region, thus moving its position on the drawing plane, rotating it, or scaling it. Note that transforming a region does not affect the *
region*
argument; it is free to either create a new region or return an existing (cached) region.

These generic functions are implemented for all classes of transformations. Furthermore, all subclasses of
region
and
ink
implement methods for
transform-region
and
untransform-region
. That is, methods for the following generic functions will typically specialize both the *
transformation*
and *
region*
arguments.

transform-region [Generic Function]

Arguments: transformation region

Summary: Applies *
transformation*
to the region *
region*
, and returns the transformed region.

untransform-region [Generic Function]

Arguments: transformation region

Summary: This is exactly equivalent to :

(transform-region (invert-transformation ```
transformation
```

) ```
region
```

)

CLIM provides a default method for untransform-region on the transformation protocol class that does exactly this.

transform-position [Generic Function]

Summary: Applies the transformation *
transformation*
to the point whose coordinates are the real numbers *
x*
and *
y*
, and returns two values, the transformed *
x*
coordinate and the transformed *
y*
coordinate.

transform-position is the spread version of transform-region in the case where the region is a point.

untransform-position [Generic Function]

Summary: This is exactly equivalent to:

(transform-position (invert-transformation ```
transformation
```

) ```
x
```

*
*
```
y
```

)

CLIM provides a default method for untransform-position on the transformation protocol class that does exactly this.

transform-distance [Generic Function]

Arguments: transformation dx dy

Summary: Applies the transformation *
transformation*
to the distance represented by the real numbers *
dx*
and *
dy*
, and returns two values, the transformed *
dx*
and the transformed *
dy*
.

A distance represents the difference between two points. It does *
not*
transform like a point.

untransform-distance [Generic Function]

Arguments: transformation dx dy

Summary: This is exactly equivalent to:

(transform-distance (invert-transformation ```
transformation
```

) ```
dx
```

*
*
```
dy
```

)

CLIM provides a default method for untransform-distance on the transformation protocol class that does exactly this.

transform-rectangle* [Generic Function]

Arguments: transformation x1 y1 x2 y2

Summary: Applies the transformation *
transformation t*
o the rectangle specified by the four coordinate arguments, which are real numbers. The arguments *
x1*
, *
y1*
, *
x2*
, and *
y*
2 are canonicalized in the same way as for
make-bounding-rectangle
. Returns four values that specify the minimum and maximum points of the transformed rectangle in the order *
min-x*
, *
min-y*
, *
max-x*
, and *
max-y*
.

It is an error if *
transformation*
does not satisfy
rectilinear-transformation-p
.

transform-rectangle* is the spread version of transform-region in the case where the transformation is rectilinear and the region is a rectangle.

untransform-rectangle* [Generic Function]

Arguments: transformation x1 y1 x2 y2

Summary: This is exactly equivalent to:

(transform-rectangle* (invert-transformation ```
transformation
```

) ```
x1
```

```
y1
```

```
x2
```

```
y2
```

)

CLIM provides a default method for untransform-rectangle* on the transformation protocol class that does exactly this.

Common Lisp Interface Manager 2.0 User's Guide - 22 Dec 2009