Documentation
www.exept.de
Everywhere
for:

# Class: ScaleTransform

## Inheritance:

```   Object
|
+--DisplayTransform
|
+--ScaleTransform
|
+--WindowingTransformation
```

Package:
stx:libview
Category:
Graphics-Transformations
Version:
rev: 1.7 date: 2019/06/28 07:19:55
user: cg
file: ScaleTransform.st directory: libview
module: stx stc-classLibrary: libview
Author:
Claus Gittinger

## Description:

```instances of ScaleTransform can be used to scale other objects in 2D space.
This one is used, if only a scale is applied, but no translation.

All 2-D objects are supposed to be able to be transformed using instances of me.
Multiple instances of me can also be combined to form a single composite transformation.

[Instance variables:]
scale           <Number> or <Point> representing a linear scaling factor.
nil is interpreted as 1@1

```

## Class protocol:

instance creation
scale: scaleFactor

withScale: scaleFactor

## Instance protocol:

accessing
inverseTransformation
Return the inverse transformation of the receiver

scale
return a copy of the Point that represents the

scale: aScale
Set the receiver's scale to aScale, a Point or Number.

scaleOfOne
Set the scale of the receiver to the identity scale

scaleX
return the current x-scale of the receiver.

scaleY
return the current x-scale of the receiver.

translation
return a copy of the receiver's translation.

translationX
return the x part of the receiver's translation.

translationY
return the y part of the receiver's translation.

applying transform
applyInverseScaleX: aNumber
apply the scale only (if widths are to be transformed)

applyInverseScaleY: aNumber
apply the scale only (if heights are to be transformed)

applyInverseTo: anObject
Apply the inverse of the receiver to anObject
and return the result. This can be used to map back from logical
to physical coordinates, for example.

applyInverseToX: aNumber
Apply the receiver to a number representing an x-coordinate
and return the result.

applyInverseToY: aNumber
Apply the receiver to a number representing an y-coordinate
and return the result.

applyScaleX: aNumber
apply the scale only (if widths are to be transformed)

applyScaleY: aNumber
apply the scale only (if heights are to be transformed)

transformPoint: p
Apply the receiver to a point, returning a new point.

transformRectangle: aRectangle
Apply the receiver to a rectangle, returning a new rectangle.

printing & storing
printOn: aStream
append a user printed representation of the receiver to aStream.
The format is suitable for a human - not meant to be read back.

private
checkScale: aScale
Converts aScale to the internal format of a floating-point Point.

inverseScale
return with a Point representing the inverse of my
scale.

testing
isIdentityTransformation
return true if this is an identity transformation;
return false, otherwise.

isNoScale
return true if the identity scale is in effect (i.e. saleFactor is 1);
return false, otherwise.

transformations
scaleBy: aScale
This is a destructive operation, modifying the transformation

scaledBy: aScale
return a new WindowingTransformation with the scale and translation of
the receiver both scaled by aScale.

translateBy: aTranslation
This is a destructive operation, modifying the transformation

translatedBy: aPoint
return a new WindowingTransformation with the same scale and
rotations as the receiver and with a translation of the current
translation plus aPoint.

## Examples:

example :
 `````` |v| v := View new extent:200@200; openAndWait. v paint:Color green. v fillRectangle:(10@10 corner:40@40). v displayLineFrom:50@50 to:75@100. v transformation:(ScaleTransform withScale:2). v paint:Color red. v fillRectangle:(10@10 corner:40@40). v displayLineFrom:50@50 to:75@100. ``````

ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Fri, 12 Aug 2022 15:40:10 GMT