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.10 date: 2023/11/21 14:45:39
user: stefan
file: ScaleTransform.st directory: libview
module: stx stc-classLibrary: libview

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

copyright

COPYRIGHT (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.

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


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 06:39:52 GMT