Squeak Class Documentation category index | class index  
 
WindowingTransformation
  category: ST80-Framework
  superclass: Object
  subclasses:

My instances are used to transform objects from a source coordinate system to a destination coordinate system. Each instance contains a scale and a translation which can be applied to objects that respond to scaleBy: and translateBy:. It can be created with a default identity scale and translation, or with a specified scale and translation, or with a scale and translation computed from a window (a Rectangle in the source coordinate system) and a viewport (a Rectangle in the destination coordinate system). In applying a WindowingTransformation to an object, the object is first scaled (around the origin of the source coordinate system) and then translated. WindowingTransformations can be composed to form a single compound transformation.

instance methods
  applying transform
  applyInverseTo:
applyTo:
compose:

  printing
  printOn:

  private
  checkScale:
setScale:translation:

  scrolling
  scrollBy:

  transforming
  align:with:
noScale
scale
scaleBy:
translateBy:
translation

class methods
  instance creation
  identity
scale:translation:
window:viewport:

instance methods
  applying transform top  
 

applyInverseTo:

Apply the inverse of the receiver to anObject and answer the result.
Used to map some object in destination coordinates to one in source
coordinates.


 

applyTo:

Apply the receiver to anObject and answer the result. Used to map some
object in source coordinates to one in destination coordinates.


 

compose:

Answer a WindowingTransformation that is the composition of the
receiver and aTransformation. The effect of applying the resulting
WindowingTransformation to an object is the same as that of first
applying aTransformation to the object and then applying the receiver to
its result.


  printing top  
 

printOn:

Refer to the comment in Object|printOn:.


  private top  
 

checkScale:

Convert aScale to the internal format of a floating-point Point.


 

setScale:translation:

Sets the scale to aScale and the translation to aTranslation.


  scrolling top  
 

scrollBy:

Answer a WindowingTransformation with the same scale as the receiver
and with a translation of the current translation plus aPoint scaled by
the current scale. It is used when the translation is known in source
coordinates, rather than scaled source coordinates (see
WindowingTransformation|translateBy:). An example is that of scrolling
objects with respect to a stationary window in the source coordinate
system. If no scaling is in effect (scale = nil), then
WindowingTransformation|translateBy: and
WindowingTransformation|scrollBy: are equivalent.


  transforming top  
 

align:with:

Answer a WindowingTransformation with the same scale as the receiver
and with a translation of (aPoint2 - aPoint1). It is normally used when
the source and destination coordinate systems are scaled the same (that
is, there is no scaling between them), and is then a convenient way of
specifying a translation, given two points that are intended to coincide.


 

noScale

Answer true if the identity scale is in effect; answer false, otherwise.


 

scale

Answer a copy of the point that represents the current scale of the
receiver.


 

scaleBy:

Answer a WindowingTransformation with the scale and translation of
the receiver both scaled by aScale.


 

translateBy:

Answer a WindowingTransformation with the same scale as the receiver
and with a translation of the current translation plus aPoint. It is used
when the translation is known in scaled source coordinates, rather than
source coordinates (see WindowingTransformation|scrollBy:). If no scaling
is in effect (scale = nil), then WindowingTransformation|translateBy: and
WindowingTransformation|scrollBy: are equivalent.


 

translation

Answer a copy of the receiver's translation.


class methods
  instance creation top  
 

identity

Answer an instance of me with no scaling (nil) and no translation
(0@0).


 

scale:translation:

Answer an instance of me with a scale factor of aScale and a translation
offset of aTranslation. When the transformation is applied (see
WindowingTransformation|apply:), the scale is applied first, followed by
the translation.


 

window:viewport:

Answer an instance of me with a scale and translation based on
aWindow and aViewport. The scale and translation are computed such
that aWindow, when transformed, coincides with aViewport.