--- a/WindowingTransformation.st Sun Dec 21 23:24:09 2014 +0100
+++ b/WindowingTransformation.st Sun Dec 21 23:24:49 2014 +0100
@@ -11,8 +11,8 @@
"
"{ Package: 'stx:libview' }"
-Object subclass:#WindowingTransformation
- instanceVariableNames:'scale translation'
+ScaleTransform variableFloatSubclass:#WindowingTransformation
+ instanceVariableNames:'translation'
classVariableNames:''
poolDictionaries:''
category:'Graphics-Transformations'
@@ -310,30 +310,6 @@
!WindowingTransformation methodsFor:'accessing'!
-scale
- "return a copy of the Point that represents the
- current scale of the receiver."
-
- scale isNil ifTrue:[^ (1@1) copy].
- ^ scale copy
-!
-
-scale:aScale
- "Set the receiver's scale to aScale, a Point or Number."
-
- aScale isNil ifTrue:[
- scale := aScale
- ] ifFalse:[
- aScale = 1 ifTrue:[
- scale := nil
- ] ifFalse:[
- scale := aScale asPoint.
- ]
- ].
-
- "Modified: / 13.6.1998 / 14:04:51 / cg"
-!
-
scale:aScale translation:aTranslation
"sets the scale to aScale and the translation to aTranslation."
@@ -359,34 +335,10 @@
"Modified: / 13.6.1998 / 14:04:42 / cg"
!
-scaleOfOne
- "Set the scale of the receiver to the identity scale"
-
- scale := nil
-!
-
-scaleX
- "return the current x-scale of the receiver."
-
- scale isNil ifTrue:[^ 1].
- ^ scale x
-
- "Created: 21.5.1996 / 21:13:49 / cg"
-!
-
-scaleY
- "return the current x-scale of the receiver."
-
- scale isNil ifTrue:[^ 1].
- ^ scale y
-
- "Created: 21.5.1996 / 21:13:59 / cg"
-!
-
translation
"return a copy of the receiver's translation."
- translation isNil ifTrue:[^ (0@0) copy].
+ translation isNil ifTrue:[^ Point x:0 y:0 ].
^ translation copy
!
@@ -426,20 +378,6 @@
!WindowingTransformation methodsFor:'applying transform'!
-applyInverseScaleX:aNumber
- "apply the scale only (if widths are to be transformed)"
-
- scale isNil ifTrue:[^ aNumber].
- ^ aNumber / scale x
-!
-
-applyInverseScaleY:aNumber
- "apply the scale only (if heights are to be transformed)"
-
- scale isNil ifTrue:[^ aNumber].
- ^ aNumber / scale y
-!
-
applyInverseTo:anObject
"Apply the inverse of the receiver to anObject
and return the result. This can be used to map back from logical
@@ -482,20 +420,6 @@
^ (aNumber - t) / s
!
-applyScaleX:aNumber
- "apply the scale only (if widths are to be transformed)"
-
- scale isNil ifTrue:[^ aNumber].
- ^ aNumber * scale x
-!
-
-applyScaleY:aNumber
- "apply the scale only (if heights are to be transformed)"
-
- scale isNil ifTrue:[^ aNumber].
- ^ aNumber * scale y
-!
-
applyTo:anObject
"Apply the receiver to anObject and return the result."
@@ -573,7 +497,7 @@
!
transformPoint:p
- "Apply the receiver to a point."
+ "Apply the receiver to a point, returning a new point."
scale isNil ifTrue:[
translation isNil ifTrue:[
@@ -602,27 +526,6 @@
!WindowingTransformation methodsFor:'private'!
-checkScale:aScale
- "Converts aScale to the internal format of a floating-point Point."
-
- |checkedScale|
-
- checkedScale := aScale asPoint.
- ^ Point x:checkedScale x asFloat
- y:checkedScale y asFloat
-!
-
-inverseScale
- "return with a Point representing the inverse of my
- scale."
-
- |newScale|
-
- newScale := self checkScale:scale.
- ^ Point x:(1.0 / newScale x)
- y:(1.0 / newScale y)
-!
-
inverseTranslation
"return with a Point representing the inverse of my
translation."
@@ -630,8 +533,7 @@
|trans|
trans := translation asPoint.
- ^ Point x:trans x negated
- y:trans y negated
+ ^ Point x:(trans x negated) y:trans y negated
! !
!WindowingTransformation methodsFor:'testing'!
@@ -642,29 +544,6 @@
^ (scale isNil or:[scale x = 1 and:[scale y = 1]])
and:[translation isNil or:[translation x = 0 and:[translation y = 0]]]
-!
-
-isNoScale
- "return true if the identity scale is in effect (i.e. saleFactor is 1);
- return false, otherwise."
-
- scale isNil ifTrue:[^ true].
- ^ scale x = 1 and:[scale y = 1]
-
- "Modified: 21.5.1996 / 21:15:21 / cg"
-!
-
-noScale
- <resource: #obsolete>
-
- "return true if the identity scale is in effect (i.e. saleFactor is 1);
- return false, otherwise.
- Obsolete: use isNoScale"
-
- scale isNil ifTrue:[^ true].
- ^ scale x = 1 and:[scale y = 1]
-
- "Modified: 21.5.1996 / 21:15:21 / cg"
! !
!WindowingTransformation methodsFor:'transformations'!
@@ -744,6 +623,10 @@
!WindowingTransformation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/WindowingTransformation.st,v 1.25 2014-12-21 21:24:21 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/WindowingTransformation.st,v 1.26 2014-12-21 22:24:49 cg Exp $'
+!
+
+version_CVS
+ ^ '$Header: /cvs/stx/stx/libview/WindowingTransformation.st,v 1.26 2014-12-21 22:24:49 cg Exp $'
! !