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