Squeak Class Documentation category index | class index  
 
MatrixTransform2x3
  category: Graphics-Transformations
  superclass: DisplayTransform
  subclasses:

This class represents a transformation for points, that is a combination of scale, offset, and rotation. It is implemented as a 2x3 matrix containing the transformation from the local coordinate system in the global coordinate system. Thus, transforming points from local to global coordinates is fast and cheap whereas transformations from global to local coordinate systems are relatively expensive.

Implementation Note: It is assumed that the transformation deals with Integer points. All transformations will return Integer coordinates (even though float points may be passed in here).

instance methods
  accessing
  at:
at:put:
inverseTransformation
offset
offset:

  comparing
  =
hash

  composing
  composedWithLocal:
composedWithLocal:into:

  converting
  asMatrixTransform2x3

  element access
  a11
a11:
a12
a12:
a13
a13:
a21
a21:
a22
a22:
a23
a23:

  encoding
  encodeForRemoteCanvas

  initialize
  setIdentiy

  objects from disk
  writeOn:

  printing
  encodePostscriptOn:
printOn:

  private
  setAngle:
setOffset:
setScale:

  testing
  isIdentity
isMatrixTransform2x3
isPureTranslation

  transforming points
  globalPointToLocal:
invertPoint:
localPointToGlobal:
transformDirection:
transformPoint:

  transforming rects
  globalBounds:toLocal:
globalBoundsToLocal:
localBounds:toGlobal:
localBoundsToGlobal:

class methods
  instance creation
  fromRemoteCanvasEncoding:
identity
new
newFromStream:
transformFromLocal:toGlobal:
withAngle:
withOffset:
withRotation:
withScale:

instance methods
  accessing top  
 

at:

Primitive. Assumes receiver is indexable. Answer the value of an
indexable element in the receiver. Fail if the argument index is not an
Integer or is out of bounds. Essential. See Object documentation
whatIsAPrimitive.


 

at:put:

Primitive. Assumes receiver is indexable. Store the argument value in
the indexable element of the receiver indicated by index. Fail if the
index is not an Integer or is out of bounds. Or fail if the value is not of
the right type for this kind of collection. Answer the value that was
stored. Essential. See Object documentation whatIsAPrimitive.


 

inverseTransformation

Return the inverse transformation of the receiver.
The inverse transformation is computed by first calculating
the inverse offset and then computing transformations
for the two identity vectors (1@0) and (0@1)


 

offset


 

offset:


  comparing top  
 

=

Answer whether the receiver and the argument represent the same
object. If = is redefined in any subclass, consider also redefining the
message hash.


 

hash

Answer a SmallInteger whose value is related to the receiver's identity.
May be overridden, and should be overridden in any classes that define =


  composing top  
 

composedWithLocal:

Return the composition of the receiver and the local transformation passed in


 

composedWithLocal:into:

Return the composition of the receiver and the local transformation passed in.
Store the composed matrix into result.


  converting top  
 

asMatrixTransform2x3

Represent the receiver as a 2x3 matrix transformation


  element access top  
 

a11


 

a11:


 

a12


 

a12:


 

a13


 

a13:


 

a21


 

a21:


 

a22


 

a22:


 

a23


 

a23:


  encoding top  
 

encodeForRemoteCanvas

encode this transform into a string for use by a RemoteCanvas


  initialize top  
 

setIdentiy

Initialize the receiver to the identity transformation (e.g., not affecting points)


  objects from disk top  
 

writeOn:


  printing top  
 

encodePostscriptOn:


 

printOn:

Append to the argument, aStream, a sequence of characters that
identifies the receiver.


  private top  
 

setAngle:

Set the raw rotation angle in the receiver


 

setOffset:

Set the raw offset in the receiver


 

setScale:

Set the raw scale in the receiver


  testing top  
 

isIdentity

Return true if the receiver is the identity transform; that is, if applying to a point returns the point itself.


 

isMatrixTransform2x3

Return true if the receiver is 2x3 matrix transformation


 

isPureTranslation

Return true if the receiver specifies no rotation or scaling.


  transforming points top  
 

globalPointToLocal:

Transform aPoint from global coordinates into local coordinates


 

invertPoint:

Transform aPoint from global coordinates into local coordinates


 

localPointToGlobal:

Transform aPoint from local coordinates into global coordinates


 

transformDirection:

Transform aPoint from local coordinates into global coordinates


 

transformPoint:

Transform aPoint from local coordinates into global coordinates


  transforming rects top  
 

globalBounds:toLocal:

Transform aRectangle from global coordinates into local coordinates


 

globalBoundsToLocal:

Transform aRectangle from global coordinates into local coordinates


 

localBounds:toGlobal:

Transform aRectangle from local coordinates into global coordinates


 

localBoundsToGlobal:

Transform aRectangle from local coordinates into global coordinates


class methods
  instance creation top  
 

fromRemoteCanvasEncoding:

DisplayTransform fromRemoteCanvasEncoding: 'Matrix,1065353216,0,1137541120,0,1065353216,1131610112,'


 

identity


 

new

Answer a new instance of the receiver (which is a class) with no indexable variables. Fail if the class is indexable.


 

newFromStream:

Only meant for my subclasses that are raw bits and word-like. For quick unpack form the disk.


 

transformFromLocal:toGlobal:


 

withAngle:


 

withOffset:


 

withRotation:


 

withScale: