CompositeTransform.st
changeset 1250 76824ea90b46
child 3855 1db7742d33ad
child 3930 1d08dbcfcbf1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CompositeTransform.st	Thu Oct 07 00:23:08 1999 +0200
@@ -0,0 +1,72 @@
+DisplayTransform subclass:#CompositeTransform
+	instanceVariableNames:'globalTransform localTransform'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Graphics-Transformations'
+!
+
+CompositeTransform comment:'A composite transform provides the effect of several levels of coordinate transformations.'!
+
+
+!CompositeTransform methodsFor:'accessing'!
+
+inverseTransformation
+	"Return the inverse transformation of the receiver"
+	^self species new
+		globalTransform: localTransform inverseTransformation
+		localTransform: globalTransform inverseTransformation! !
+
+!CompositeTransform methodsFor:'converting'!
+
+asCompositeTransform
+	^self!
+
+asMatrixTransform2x3
+	^globalTransform asMatrixTransform2x3
+		composedWithLocal: localTransform asMatrixTransform2x3! !
+
+!CompositeTransform methodsFor:'initialization'!
+
+globalTransform: gt localTransform: lt
+	globalTransform _ gt.
+	localTransform _ lt! !
+
+!CompositeTransform methodsFor:'testing'!
+
+isCompositeTransform
+	^true!
+
+isIdentity
+	^ globalTransform isIdentity and: [localTransform isIdentity]!
+
+isPureTranslation
+	^ globalTransform isPureTranslation and: [localTransform isPureTranslation]! !
+
+!CompositeTransform methodsFor:'transformations'!
+
+invert: aPoint
+	^ globalTransform invert: (localTransform invert: aPoint)!
+
+scale
+	^ localTransform scale * globalTransform scale!
+
+transform: aPoint
+	^ localTransform transform: (globalTransform transform: aPoint)! !
+
+!CompositeTransform methodsFor:'transforming points'!
+
+globalPointToLocal: aPoint
+	"Transform aPoint from global coordinates into local coordinates"
+	^localTransform globalPointToLocal:
+		(globalTransform globalPointToLocal: aPoint)!
+
+localPointToGlobal: aPoint
+	"Transform aPoint from global coordinates into local coordinates"
+	^globalTransform localPointToGlobal:
+		(localTransform localPointToGlobal: aPoint)! !
+
+!CompositeTransform class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/libview2/CompositeTransform.st,v 1.1 1999-10-06 22:23:08 cg Exp $'
+! !