DisplayTransform.st
author matilk
Wed, 13 Sep 2017 09:40:34 +0200
changeset 8174 2704c965b97b
parent 7951 b1387707d27d
child 8384 c473ce4aa06a
permissions -rw-r--r--
#BUGFIX by Maren class: DeviceGraphicsContext changed: #displayDeviceOpaqueForm:x:y: nil check
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7951
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
     1
"
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
     2
 COPYRIGHT (c) 1992 by Claus Gittinger
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
     3
              All Rights Reserved
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
     4
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
     5
 This software is furnished under a license and may be used
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
     6
 only in accordance with the terms of that license and with the
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
     8
 be provided or otherwise made available to, or used by, any
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
     9
 other person.  No title to or ownership of the software is
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    10
 hereby transferred.
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    11
"
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libview' }"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
7414
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
    14
"{ NameSpace: Smalltalk }"
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
    15
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
Object subclass:#DisplayTransform
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:''
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	category:'Graphics-Transformations'
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
DisplayTransform comment:'This class represents a base for generic transformations of 2D points between different coordinate systems (including scaling and rotation). The transformations map objects between one coordinate system and another where it is assumed that a nested hierarchy of transformations can be defined.
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
It is assumed that transformations deal with Integer points. All transformations should return Integer coordinates (even though float points may be passed in as argument).
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
Compositions of transformations MUST work in the following order. A ''global'' transformation (the argument in #composedWithGlobal:) is defined as a transformation that takes place between the receiver (the ''local'') transformation and any ''global'' point computations, whereas a ''local'' transformation (e.g., the argument in #composedWithLocal:) takes place between the receiver (''global'') and any ''local'' points. For the transformation methods this means that combining a global and a local transformation will result in the following order:
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
		globalPointToLocal: globalPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
			"globalPoint -> globalTransform -> localTransform -> locaPoint"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
			^localTransform globalPointToLocal:
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
				(globalTransform globalPointToLocal: globalPoint)
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
		localPointToGlobal: localPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
			"localPoint -> localTransform -> globalTransform -> globalPoint"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
			^globalTransform localPointToGlobal:
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
				(localTransform localPointToGlobal: localPoint)
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
'
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
7951
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    42
!DisplayTransform class methodsFor:'documentation'!
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    43
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    44
copyright
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    45
"
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    46
 COPYRIGHT (c) 1992 by Claus Gittinger
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    47
              All Rights Reserved
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    48
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    49
 This software is furnished under a license and may be used
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    50
 only in accordance with the terms of that license and with the
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    51
 inclusion of the above copyright notice.   This software may not
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    52
 be provided or otherwise made available to, or used by, any
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    53
 other person.  No title to or ownership of the software is
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    54
 hereby transferred.
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    55
"
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    56
! !
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
!DisplayTransform class methodsFor:'instance creation'!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
identity
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
	^self new setIdentity
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
! !
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
7858
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    64
!DisplayTransform class methodsFor:'queries'!
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    65
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    66
isAbstract
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    67
    "Return if this class is an abstract class.
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    68
     True is returned here for myself only; false for subclasses.
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    69
     Abstract subclasses must redefine this again."
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    70
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    71
    ^ self == DisplayTransform.
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    72
! !
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    73
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
!DisplayTransform methodsFor:'accessing'!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
inverseTransformation
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
	"Return the inverse transformation of the receiver"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
	^self subclassResponsibility
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
! !
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
!DisplayTransform methodsFor:'composing'!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
composedWithGlobal: aTransformation
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
	"Return the composition of the receiver and the global transformation passed in.
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
	A 'global' transformation is defined as a transformation that takes place
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
	between the receiver (the 'local') transformation and any 'global' point
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
	computations, e.g., for the methods
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
		globalPointToLocal: globalPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
			globalPoint -> globalTransform -> localTransform -> locaPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
		localPointToGlobal: localPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
			localPoint -> localTransform -> globalTransform -> globalPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
		"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
	^aTransformation composedWithLocal: self
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
composedWithLocal: aTransformation
7414
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   100
        "Return the composition of the receiver and the local transformation passed in.
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   101
        A 'local' transformation is defined as a transformation that takes place
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   102
        between the receiver (the 'global') transformation and any 'local' point
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   103
        computations, e.g., for the methods
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
7414
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   105
                globalPointToLocal: globalPoint
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   106
                        globalPoint -> globalTransform -> localTransform -> locaPoint
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
7414
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   108
                localPointToGlobal: localPoint
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   109
                        localPoint -> localTransform -> globalTransform -> globalPoint
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
7414
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   111
                "
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   112
        self isIdentity ifTrue:[^ aTransformation].
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   113
        aTransformation isIdentityTransformation ifTrue:[^ self].
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   114
        ^ CompositeTransform new globalTransform: self
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   115
                                                        localTransform: aTransformation
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
! !
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
!DisplayTransform methodsFor:'converting'!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
asCompositeTransform
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
	"Represent the receiver as a composite transformation"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
	^CompositeTransform new
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
		globalTransform: self
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
		localTransform: self species identity
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
asMatrixTransform2x3
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
	"Represent the receiver as a 2x3 matrix transformation"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
	^self subclassResponsibility
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
! !
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
!DisplayTransform methodsFor:'initialize'!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
setIdentity
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
    "Initialize the receiver to the identity transformation (e.g., not affecting points)"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
    ^self subclassResponsibility
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
! !
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
!DisplayTransform methodsFor:'testing'!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
isCompositeTransform
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
	"Return true if the receiver is a composite transformation.
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
	Composite transformations may have impact on the accuracy."
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
	^false
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
7414
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   148
isIdentityTransformation
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   149
    "Return true if the receiver is the identity transform; that is, if applying to a point returns the point itself."
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   150
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   151
    ^ self subclassResponsibility
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
isMatrixTransform2x3
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
	"Return true if the receiver is 2x3 matrix transformation"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
	^false
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
isMorphicTransform
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
	"Return true if the receiver is a MorphicTransform, that is specifies the transformation values explicitly."
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
	^false
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
isNoScale
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
    "return true if the identity scale is in effect (i.e. saleFactor is 1);
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
     return false, otherwise."
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
7414
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   168
    ^ self subclassResponsibility
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
noScale
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
    "return true if the identity scale is in effect (i.e. saleFactor is 1);
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
     return false, otherwise.
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
     Obsolete: use isNoScale"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
    <resource: #obsolete>
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
    ^ self isNoScale
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
! !
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
!DisplayTransform methodsFor:'transforming points'!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
applyInverseTo:aPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
    ^ self invertPoint: aPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
applyScaleX:aNumber
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
    ^ (self transformPoint: aNumber @ 0) x
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
applyScaleY:aNumber
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
    ^ (self transformPoint: 0 @ aNumber) y
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
applyTo:aPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
    ^ self transformPoint: aPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
globalPointToLocal: aPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
	"Transform aPoint from global coordinates into local coordinates"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
	^self subclassResponsibility
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
globalPointsToLocal: inArray
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
	"Transform all the points of inArray from global into local coordinates"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
	^inArray collect:[:pt| self globalPointToLocal: pt]
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
localPointToGlobal: aPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
	"Transform aPoint from local coordinates into global coordinates"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
	^self subclassResponsibility
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
localPointsToGlobal: inArray
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
	"Transform all the points of inArray from local into global coordinates"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
	^inArray collect:[:pt| self localPointToGlobal: pt]
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
! !
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
!DisplayTransform methodsFor:'transforming rects'!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
globalBoundsToLocal: aRectangle
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
	"Transform aRectangle from global coordinates into local coordinates"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
	^Rectangle encompassing: (self globalPointsToLocal: aRectangle corners)
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
localBoundsToGlobal: aRectangle
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
	"Transform aRectangle from local coordinates into global coordinates"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
	^Rectangle encompassing: (self localPointsToGlobal: aRectangle corners)
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
! !
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
!DisplayTransform class methodsFor:'documentation'!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
version
7414
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   234
    ^ '$Header$'
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
version_CVS
7414
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   238
    ^ '$Header$'
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
! !
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240