|
Class: ScaleTransform
Object
|
+--DisplayTransform
|
+--ScaleTransform
|
+--WindowingTransformation
- Package:
- stx:libview
- Category:
- Graphics-Transformations
- Version:
- rev:
1.10
date: 2023/11/21 14:45:39
- user: stefan
- file: ScaleTransform.st directory: libview
- module: stx stc-classLibrary: libview
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
copyrightCOPYRIGHT (c) 1992 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
instance creation
-
scale: scaleFactor
-
-
withScale: scaleFactor
-
accessing
-
inverseTransformation
-
Return the inverse transformation of the receiver
-
scale
-
return a copy of the Point that represents the
current scale of the receiver.
-
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
-
scale the receiver.
This is a destructive operation, modifying the transformation
represented by the receiver
-
scaledBy: aScale
-
return a new WindowingTransformation with the scale and translation of
the receiver both scaled by aScale.
-
translateBy: aTranslation
-
translate the receiver.
This is a destructive operation, modifying the transformation
represented by the receiver
-
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.
example :
|v|
v := View new extent:200@200; openAndWaitUntilVisible.
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.
|
|