WindowingTransformation.st
author Claus Gittinger <cg@exept.de>
Sat, 27 Apr 1996 19:53:57 +0200
changeset 619 a46cb2ef56bf
parent 611 e0442439a3c6
child 705 e8acdd90a071
permissions -rw-r--r--
examples
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     1
"
48194c26a46c Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1992 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
     3
	      All Rights Reserved
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     4
48194c26a46c Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
48194c26a46c Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
48194c26a46c Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
48194c26a46c Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
48194c26a46c Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
48194c26a46c Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
48194c26a46c Initial revision
claus
parents:
diff changeset
    11
"
48194c26a46c Initial revision
claus
parents:
diff changeset
    12
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    13
Object subclass:#WindowingTransformation
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    14
	instanceVariableNames:'scale translation'
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    15
	classVariableNames:''
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    16
	poolDictionaries:''
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    17
	category:'Graphics-Support'
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    18
!
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    19
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    20
!WindowingTransformation class methodsFor:'instance creation'!
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    21
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    22
identity
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    23
    "returns a windowing transformation with no scaling (1@1) 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    24
     and no translation (0@0)."
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    25
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    26
    ^ self basicNew scale:nil translation:nil 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    27
!
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    28
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    29
scale:aScale translation:aTranslation 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    30
    "returns a windowing transformation with a scale factor of  
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    31
     aScale and a translation offset of aTranslation."
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    32
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    33
    ^ self basicNew scale:aScale translation:aTranslation
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    34
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    35
    "
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    36
     |v|
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    37
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    38
     v := View new realize.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    39
     (Delay forSeconds:3) wait.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    40
     v transformation:(WindowingTransformation scale:2 translation:0).
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    41
     'now, everything is magnfied by 2'.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    42
     v displayLineFrom:10@10 to:30@30 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    43
    "
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    44
    "
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    45
     |v|
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    46
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    47
     v := View new realize.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    48
     (Delay forSeconds:3) wait.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    49
     v transformation:(WindowingTransformation scale:0.5 translation:0).
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    50
     'now, everything is shrunk by 2'.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    51
     v displayLineFrom:10@10 to:30@30 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    52
    "
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    53
!
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    54
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    55
unit:unitSymbol on:device 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    56
    "returns a windowing transformation with scaling 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    57
     for unitSymbol and no translation (0@0).
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    58
     With such a transformation, you can draw in your preferred 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    59
     units.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    60
     UnitSymbol may be #mm, #cm, #inch, #point, #twip or #pixel (default).
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    61
     Twip is 1/20th of a point, point is 1/72th of an inch
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    62
     (i.e. the print-unit which is also used for font sizes etc.) 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    63
     - not to confuse with device pixels."
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    64
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    65
    |pixelPerUnitV pixelPerUnitH|
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
    66
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    67
    unitSymbol == #mm ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    68
	pixelPerUnitV := device verticalPixelPerMillimeter.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    69
	pixelPerUnitH := device horizontalPixelPerMillimeter 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    70
    ] ifFalse:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    71
	unitSymbol == #cm ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    72
	    pixelPerUnitV := device verticalPixelPerMillimeter * 10.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    73
	    pixelPerUnitH := device horizontalPixelPerMillimeter * 10 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    74
	] ifFalse:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    75
	    unitSymbol == #twip ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    76
		pixelPerUnitV := device verticalPixelPerInch / 1440.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    77
		pixelPerUnitH := device horizontalPixelPerInch / 1440 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    78
	    ] ifFalse:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    79
		unitSymbol == #point ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    80
		    pixelPerUnitV := device verticalPixelPerInch / 72.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    81
		    pixelPerUnitH := device horizontalPixelPerInch / 72 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    82
		] ifFalse:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    83
		    unitSymbol == #inch ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    84
			pixelPerUnitV := device verticalPixelPerInch.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    85
			pixelPerUnitH := device horizontalPixelPerInch 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    86
		    ] ifFalse:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    87
			"sorry: unknown unit is taken as pixel"
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    88
			^ self new scale:nil translation:nil
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    89
		    ]
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    90
		]
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    91
	    ]
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    92
	]
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    93
    ].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    94
    ^ self basicNew scale:(pixelPerUnitH @ pixelPerUnitV) translation:nil
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    95
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    96
    "
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    97
     |v|
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    98
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    99
     v := View new realize.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   100
     (Delay forSeconds:3) wait.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   101
     v transformation:(WindowingTransformation unit:#inch on:Display).
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   102
     'now, we can think of drawing in inches ...'.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   103
     v displayLineFrom:0.5@0.5 to:1@1 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   104
    "
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   105
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   106
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   107
window:sourceRectangle viewport:destinationRectangle 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   108
    "returns a windowing transformation with a scale and
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   109
     translation computed from sourceRectangle and destinationRectangle.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   110
     The scale and transformation are computed such that sourceRectangle
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   111
     is transformed to destinationRectangle. Typically sourceRectangle
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   112
     represents the logical coordinateSpace while destinationRectangle 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   113
     represents the device coordinateSpace."
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   114
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   115
    |sX sY tX tY newScale newTranslation|
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   116
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   117
    sX := destinationRectangle width / sourceRectangle width.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   118
    sY := destinationRectangle height / sourceRectangle height.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   119
    tX := destinationRectangle left - sourceRectangle left.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   120
    tY := destinationRectangle top - sourceRectangle top.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   121
    ((tX = 1.0) and:[tY = 1.0]) ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   122
	newTranslation := nil
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   123
    ] ifFalse:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   124
	newTranslation := tX @ tY
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   125
    ].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   126
    ((sX = 1.0) and:[sY = 1.0]) ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   127
	newScale := nil
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   128
    ] ifFalse:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   129
	newScale := sX @ sY
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   130
    ].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   131
    ^ self basicNew scale:newScale translation:newTranslation
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   132
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   133
    "
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   134
     |v|
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   135
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   136
     v := View new realize.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   137
     (Delay forSeconds:3) wait.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   138
     v transformation:(WindowingTransformation 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   139
				window:(0@0 corner:1@1)
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   140
				viewport:(0@0 corner:100@100)).
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   141
     'now, we can think of drawing in 0..1/0..1 coordinates'.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   142
     v displayLineFrom:0.1@0.1 to:0.9@0.9 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   143
    "
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   144
! !
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   145
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   146
!WindowingTransformation class methodsFor:'documentation '!
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   147
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   148
copyright
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   149
"
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   150
 COPYRIGHT (c) 1992 by Claus Gittinger
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   151
	      All Rights Reserved
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   152
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   153
 This software is furnished under a license and may be used
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   154
 only in accordance with the terms of that license and with the
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   155
 inclusion of the above copyright notice.   This software may not
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   156
 be provided or otherwise made available to, or used by, any
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   157
 other person.  No title to or ownership of the software is
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   158
 hereby transferred.
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   159
"
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   160
!
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   161
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   162
documentation
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   163
"
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   164
    instances of WindowingTransformation can be used to scale, translate or
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   165
    generally transform other objects in 2D space. 
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   166
    They can also be set as the translation in a graphic context, 
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   167
    which will then apply this to all of its drawing operations 
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   168
    (see GraphicContext>>transformation:).
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   169
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   170
    All 2-D objects are supposed to be able to be transformed using
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   171
    instances of me.  Multiple instances of me can also be combined to form a
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   172
    single composite transformation.
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   173
611
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   174
    [Instance variables:]
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   175
        scale           <Number> or <Point> representing a linear scaling factor.
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   176
                        nil is interpreted as 1@1
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   177
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   178
        translation     <Number> or <Point> representing a translation in 2-D.
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   179
                        nil is interpreted as 0@0
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   180
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   181
611
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   182
    [author:]
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   183
        Claus Gittinger
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   184
"
611
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   185
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 601
diff changeset
   186
    "Modified: 25.4.1996 / 16:53:07 / cg"
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   187
!
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   188
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   189
examples
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   190
"
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   191
    example (drawing in inches):
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   192
                                                                        [exBegin]
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   193
     |v|
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   194
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   195
     v := View new realize.
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   196
     (Delay forSeconds:3) wait.
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   197
     v transformation:(WindowingTransformation unit:#inch on:Display).
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   198
     'now, we can think of drawing in inches ...'.
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   199
     v displayLineFrom:0.5@0.5 to:1@1 
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   200
                                                                        [exEnd]
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   201
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   202
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   203
    example (drawing in millimeters):
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   204
                                                                        [exBegin]
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   205
     |v|
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   206
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   207
     v := View new realize.
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   208
     (Delay forSeconds:3) wait.
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   209
     v transformation:(WindowingTransformation unit:#mm on:Display).
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   210
     'now, we can think of drawing in millimeters ...'.
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   211
     v displayLineFrom:5@5 to:20@5 
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   212
                                                                        [exEnd]
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   213
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   214
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   215
    example (drawing magnified):
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   216
                                                                        [exBegin]
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   217
     |v|
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   218
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   219
     v := View new realize.
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   220
     (Delay forSeconds:3) wait.
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   221
     v transformation:(WindowingTransformation scale:2 translation:0).
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   222
     'now, everything is magnfied by 2'.
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   223
     v displayLineFrom:10@10 to:30@30 
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   224
                                                                        [exEnd]
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   225
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   226
    example (drawing shrunk):
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   227
                                                                        [exBegin]
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   228
     |v|
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   229
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   230
     v := View new realize.
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   231
     (Delay forSeconds:3) wait.
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   232
     v transformation:(WindowingTransformation scale:0.5 translation:0).
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   233
     'now, everything is shrunk by 2'.
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   234
     v displayLineFrom:10@10 to:30@30 
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   235
                                                                        [exEnd]
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   236
"
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   237
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   238
    "Modified: 27.4.1996 / 19:45:43 / cg"
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   239
!
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   240
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   241
version
619
a46cb2ef56bf examples
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   242
    ^ '$Header: /cvs/stx/stx/libview/WindowingTransformation.st,v 1.13 1996-04-27 17:52:59 cg Exp $'
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   243
! !
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   244
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   245
!WindowingTransformation methodsFor:'accessing'!
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   246
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   247
scale
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   248
    "return a copy of the Point that represents the
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   249
     current scale of the receiver."
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   250
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   251
    scale isNil ifTrue:[^ (1@1) copy].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   252
    ^ scale copy
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   253
!
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   254
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   255
scale:aScale
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   256
    "Set the receiver's scale to aScale, a Point or Number."
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   257
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   258
    aScale isNil ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   259
	scale := aScale
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   260
    ] ifFalse:[
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   261
	scale := aScale asPoint.
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   262
    ].
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   263
!
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   264
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   265
scale:aScale translation:aTranslation
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   266
    "sets the scale to aScale and the translation to aTranslation."
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   267
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   268
    aScale isNil ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   269
	scale := aScale
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   270
    ] ifFalse:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   271
	scale := aScale asPoint.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   272
    ].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   273
    aTranslation isNil ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   274
	translation := aTranslation
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   275
    ] ifFalse:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   276
	translation := aTranslation asPoint
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   277
    ]
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   278
!
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   279
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   280
scaleOfOne
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   281
    "Set the scale of the receiver to the identity scale"
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   282
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   283
    scale := nil
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   284
!
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   285
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   286
translation
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   287
    "return a copy of the receiver's translation."
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   288
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   289
    translation isNil ifTrue:[^ (0@0) copy].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   290
    ^ translation copy
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   291
!
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   292
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   293
translation:aTranslation
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   294
    "Set the receiver's translation to aTranslation, a Point or Number."
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   295
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   296
    aTranslation isNil ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   297
	translation := aTranslation
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   298
    ] ifFalse:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   299
	translation := aTranslation asPoint
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   300
    ]
46
7b331e9012fd *** empty log message ***
claus
parents: 5
diff changeset
   301
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   302
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   303
!WindowingTransformation methodsFor:'applying transform'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   304
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   305
applyInverseScaleX:aNumber
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   306
    "apply the scale only (if widths are to be transformed)"
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   307
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   308
    scale isNil ifTrue:[^ aNumber].
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   309
    ^ aNumber / scale x
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   310
!
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   311
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   312
applyInverseScaleY:aNumber
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   313
    "apply the scale only (if heights are to be transformed)"
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   314
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   315
    scale isNil ifTrue:[^ aNumber].
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   316
    ^ aNumber / scale y
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   317
!
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   318
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   319
applyInverseTo:anObject 
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   320
    "Apply the inverse of the receiver to anObject
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   321
     and return the result. This can be used to map back from logical
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   322
     to physical coordinates, for example."
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   323
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   324
    |transformedObject|
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   325
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   326
    translation isNil ifTrue:[
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   327
	scale isNil ifTrue:[
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   328
	    ^ anObject
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   329
	].
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   330
	^ anObject scaledBy:self inverseScale 
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   331
    ].
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   332
    transformedObject := anObject translatedBy:(self inverseTranslation).
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   333
    scale notNil ifTrue:[
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   334
	transformedObject scaleBy:(self inverseScale).
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   335
    ].
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   336
    ^ transformedObject
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   337
!
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   338
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   339
applyInverseToX:aNumber
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   340
    "Apply the receiver to a number representing an x-coordinate
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   341
     and return the result."
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   342
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   343
    |t s|
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   344
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   345
    scale isNil ifTrue:[s := 1] ifFalse:[s := scale x].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   346
    translation isNil ifTrue:[t := 0] ifFalse:[t := translation x].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   347
    ^ (aNumber - t) / s
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   348
!
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   349
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   350
applyInverseToY:aNumber
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   351
    "Apply the receiver to a number representing an y-coordinate
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   352
     and return the result."
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   353
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   354
    |t s|
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   355
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   356
    scale isNil ifTrue:[s := 1] ifFalse:[s := scale y].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   357
    translation isNil ifTrue:[t := 0] ifFalse:[t := translation y].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   358
    ^ (aNumber - t) / s
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   359
!
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   360
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   361
applyScaleX:aNumber
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   362
    "apply the scale only (if widths are to be transformed)"
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   363
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   364
    scale isNil ifTrue:[^ aNumber].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   365
    ^ aNumber * scale x
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   366
!
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   367
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   368
applyScaleY:aNumber
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   369
    "apply the scale only (if heights are to be transformed)"
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   370
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   371
    scale isNil ifTrue:[^ aNumber].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   372
    ^ aNumber * scale y
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   373
!
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   374
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   375
applyTo:anObject 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   376
    "Apply the receiver to anObject and return the result."
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   377
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   378
    |transformedObject|
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   379
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   380
    scale isNil ifTrue:[
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   381
	translation isNil ifTrue:[
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   382
	    ^ anObject
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   383
	].
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   384
	^ anObject translatedBy:translation 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   385
    ].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   386
    transformedObject := anObject scaledBy:scale.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   387
    translation notNil ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   388
	transformedObject translateBy:translation.
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   389
    ].
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   390
    ^ transformedObject
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   391
!
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   392
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   393
applyToX:aNumber
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   394
    "Apply the receiver to a number representing an x-coordinate
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   395
     and return the result."
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   396
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   397
    |t s|
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   398
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   399
    scale isNil ifTrue:[s := 1] ifFalse:[s := scale x].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   400
    translation isNil ifTrue:[t := 0] ifFalse:[t := translation x].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   401
    ^ aNumber * s + t
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   402
!
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   403
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   404
applyToY:aNumber
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   405
    "Apply the receiver to a number representing an y-coordinate
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   406
     and return the result."
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   407
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   408
    |t s|
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   409
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   410
    scale isNil ifTrue:[s := 1] ifFalse:[s := scale y].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   411
    translation isNil ifTrue:[t := 0] ifFalse:[t := translation y].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   412
    ^ aNumber * s + t
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   413
!
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   414
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   415
compose:aTransformation 
48194c26a46c Initial revision
claus
parents:
diff changeset
   416
    "return a new WindowingTransformation that is the
48194c26a46c Initial revision
claus
parents:
diff changeset
   417
     composition of the receiver and aTransformation.
48194c26a46c Initial revision
claus
parents:
diff changeset
   418
     The effect of applying the resulting WindowingTransformation
48194c26a46c Initial revision
claus
parents:
diff changeset
   419
     to an object is the same as that of first applying
48194c26a46c Initial revision
claus
parents:
diff changeset
   420
     aTransformation to the object and then applying the 
48194c26a46c Initial revision
claus
parents:
diff changeset
   421
     receiver to its result."
48194c26a46c Initial revision
claus
parents:
diff changeset
   422
48194c26a46c Initial revision
claus
parents:
diff changeset
   423
    |aTransformationScale newScale newTranslation|
48194c26a46c Initial revision
claus
parents:
diff changeset
   424
48194c26a46c Initial revision
claus
parents:
diff changeset
   425
    aTransformationScale := aTransformation scale.
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   426
    scale isNil ifTrue:[
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   427
	aTransformation noScale ifTrue:[
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   428
	    newScale := nil
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   429
	] ifFalse:[
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   430
	    newScale := aTransformationScale
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   431
	].
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   432
	newTranslation := translation + aTransformation translation
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   433
    ] ifFalse:[
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   434
	aTransformation noScale ifTrue:[
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   435
	    newScale := scale
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   436
	] ifFalse:[
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   437
	    newScale := scale * aTransformationScale
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   438
	].
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   439
	newTranslation := translation
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   440
			  + (scale * aTransformation translation)
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   441
    ].
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   442
    ^ (self class) 
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   443
	  scale:newScale
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   444
	  translation:newTranslation
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   445
!
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   446
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   447
transformPoint:p 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   448
    "Apply the receiver to a point.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   449
     This is destructive in that the point is being modified,
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   450
     not a copy."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   451
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   452
    scale isNil ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   453
	translation isNil ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   454
	    ^ p
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   455
	].
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   456
	^ p + translation
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   457
    ].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   458
    translation isNil ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   459
	^ p * scale
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   460
    ].
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   461
    ^ (p * scale + translation)
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   462
! !
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   463
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   464
!WindowingTransformation methodsFor:'printing'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   465
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   466
printOn:aStream
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   467
    aStream nextPutAll:self class name.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   468
    aStream nextPutAll:' scale: '.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   469
    scale printOn:aStream.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   470
    aStream nextPutAll:' translation: '.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   471
    translation printOn:aStream
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   472
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   473
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   474
!WindowingTransformation methodsFor:'private'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   475
48194c26a46c Initial revision
claus
parents:
diff changeset
   476
checkScale:aScale
48194c26a46c Initial revision
claus
parents:
diff changeset
   477
    "Converts aScale to the internal format of a floating-point Point."
48194c26a46c Initial revision
claus
parents:
diff changeset
   478
48194c26a46c Initial revision
claus
parents:
diff changeset
   479
    |checkedScale|
48194c26a46c Initial revision
claus
parents:
diff changeset
   480
48194c26a46c Initial revision
claus
parents:
diff changeset
   481
    checkedScale := aScale asPoint.
48194c26a46c Initial revision
claus
parents:
diff changeset
   482
    ^ Point x:checkedScale x asFloat
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   483
	    y:checkedScale y asFloat
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   484
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   485
48194c26a46c Initial revision
claus
parents:
diff changeset
   486
inverseScale
48194c26a46c Initial revision
claus
parents:
diff changeset
   487
    "return with a Point representing the inverse of my
48194c26a46c Initial revision
claus
parents:
diff changeset
   488
     scale."
48194c26a46c Initial revision
claus
parents:
diff changeset
   489
48194c26a46c Initial revision
claus
parents:
diff changeset
   490
    |newScale|
48194c26a46c Initial revision
claus
parents:
diff changeset
   491
48194c26a46c Initial revision
claus
parents:
diff changeset
   492
    newScale := self checkScale:scale.
48194c26a46c Initial revision
claus
parents:
diff changeset
   493
    ^ Point x:(1.0 / newScale x)
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   494
	    y:(1.0 / newScale y)
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   495
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   496
48194c26a46c Initial revision
claus
parents:
diff changeset
   497
inverseTranslation
48194c26a46c Initial revision
claus
parents:
diff changeset
   498
    "return with a Point representing the inverse of my
48194c26a46c Initial revision
claus
parents:
diff changeset
   499
     translation."
48194c26a46c Initial revision
claus
parents:
diff changeset
   500
48194c26a46c Initial revision
claus
parents:
diff changeset
   501
    |trans|
48194c26a46c Initial revision
claus
parents:
diff changeset
   502
48194c26a46c Initial revision
claus
parents:
diff changeset
   503
    trans := translation asPoint.
48194c26a46c Initial revision
claus
parents:
diff changeset
   504
    ^ Point x:trans x negated
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   505
	    y:trans y negated
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   506
! !
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   507
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   508
!WindowingTransformation methodsFor:'testing'!
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   509
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   510
noScale
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   511
    "return true if the identity scale is in effect;
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   512
     return false, otherwise."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   513
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   514
    ^ scale == nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   515
! !
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   516
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   517
!WindowingTransformation methodsFor:'transforming'!
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   518
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   519
scaleBy:aScale 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   520
    "scale the receiver.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   521
     This is a destructive operation, modifying the transformation
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   522
     represented by the receiver"
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   523
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   524
    |newScale|
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   525
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   526
    aScale isNil ifTrue:[^ self].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   527
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   528
    scale isNil ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   529
	newScale := aScale asPoint
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   530
    ] ifFalse:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   531
	newScale := scale * aScale
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   532
    ].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   533
    translation notNil ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   534
	translation := translation * aScale.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   535
    ].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   536
    scale := newScale.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   537
!
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   538
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   539
scaledBy:aScale 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   540
    "return a new WindowingTransformation with the scale and translation of 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   541
     the receiver both scaled by aScale."
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   542
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   543
    |checkedScale newScale newTranslation|
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   544
601
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   545
    aScale isNil ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   546
	newScale := scale.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   547
	newTranslation := translation
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   548
    ] ifFalse:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   549
	checkedScale := self checkScale:aScale.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   550
	scale isNil ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   551
	    newScale := checkedScale
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   552
	] ifFalse:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   553
	    newScale := scale * checkedScale
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   554
	].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   555
	translation notNil ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   556
	    newTranslation := checkedScale * translation
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   557
	]
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   558
    ].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   559
    ^ (self class) 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   560
	  scale:newScale
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   561
	  translation:newTranslation
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   562
!
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   563
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   564
translateBy:aTranslation 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   565
    "translate the receiver.
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   566
     This is a destructive operation, modifying the transformation
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   567
     represented by the receiver"
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   568
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   569
    aTranslation isNil ifTrue:[^ self].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   570
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   571
    translation isNil ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   572
	translation := 0@0
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   573
    ].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   574
    scale isNil ifTrue:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   575
	translation := translation + aTranslation asPoint
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   576
    ] ifFalse:[
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   577
	translation := translation + (scale * aTranslation)
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   578
    ].
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   579
!
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   580
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   581
translatedBy:aPoint 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   582
    "return a new WindowingTransformation with the same scale and 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   583
     rotations as the receiver and with a translation of the current 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   584
     translation plus aPoint."
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   585
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   586
    ^ (self class) 
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   587
	  scale:scale
2c4c1e797909 commentary
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   588
	  translation:(translation + aPoint)
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   589
! !
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   590