eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ScaleTransform':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

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
o  scale: scaleFactor

o  withScale: scaleFactor


Instance protocol:

accessing
o  inverseTransformation
Return the inverse transformation of the receiver

o  scale
return a copy of the Point that represents the
current scale of the receiver.

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

o  scaleOfOne
Set the scale of the receiver to the identity scale

o  scaleX
return the current x-scale of the receiver.

o  scaleY
return the current x-scale of the receiver.

o  translation
return a copy of the receiver's translation.

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

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

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

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

o  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.

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

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

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

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

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

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

printing & storing
o  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
o  checkScale: aScale
Converts aScale to the internal format of a floating-point Point.

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

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

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

transformations
o  scaleBy: aScale
scale the receiver.
This is a destructive operation, modifying the transformation
represented by the receiver

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

o  translateBy: aTranslation
translate the receiver.
This is a destructive operation, modifying the transformation
represented by the receiver

o  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; Wed, 24 Apr 2024 12:21:21 GMT