equal
deleted
inserted
replaced
8 be provided or otherwise made available to, or used by, any |
8 be provided or otherwise made available to, or used by, any |
9 other person. No title to or ownership of the software is |
9 other person. No title to or ownership of the software is |
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 "{ Package: 'stx:libbasic' }" |
12 "{ Package: 'stx:libbasic' }" |
|
13 |
|
14 "{ NameSpace: Smalltalk }" |
13 |
15 |
14 Geometric subclass:#Rectangle |
16 Geometric subclass:#Rectangle |
15 instanceVariableNames:'left top width height' |
17 instanceVariableNames:'left top width height' |
16 classVariableNames:'' |
18 classVariableNames:'' |
17 poolDictionaries:'' |
19 poolDictionaries:'' |
283 |
285 |
284 " |
286 " |
285 Rectangle originFromUser:50@50 |
287 Rectangle originFromUser:50@50 |
286 " |
288 " |
287 ! ! |
289 ! ! |
288 |
|
289 |
|
290 |
290 |
291 !Rectangle methodsFor:'Compatibility-Squeak'! |
291 !Rectangle methodsFor:'Compatibility-Squeak'! |
292 |
292 |
293 amountToTranslateWithin: aRectangle |
293 amountToTranslateWithin: aRectangle |
294 "Answer a Point, delta, such that self + delta is forced within aRectangle." |
294 "Answer a Point, delta, such that self + delta is forced within aRectangle." |
1777 "return a new rectangle which is the receiver |
1777 "return a new rectangle which is the receiver |
1778 scaled by scale" |
1778 scaled by scale" |
1779 |
1779 |
1780 |scalePoint sx sy| |
1780 |scalePoint sx sy| |
1781 |
1781 |
|
1782 (scale isMemberOf:SmallInteger) ifTrue:[ |
|
1783 "/ this is an stc optimization |
|
1784 ^ Rectangle left:left * scale |
|
1785 top:top * scale |
|
1786 width:width * scale |
|
1787 height:height * scale |
|
1788 ]. |
|
1789 |
1782 scalePoint := scale asPoint. |
1790 scalePoint := scale asPoint. |
1783 sx := scalePoint x. |
1791 sx := scalePoint x. |
1784 sy := scalePoint y. |
1792 sy := scalePoint y. |
1785 ^ Rectangle left:left * sx |
1793 ^ Rectangle left:left * sx |
1786 top:top * sy |
1794 top:top * sy |
1787 width:(width * sx) |
1795 width:width * sx |
1788 height:(height * sy) |
1796 height:height * sy |
1789 " |
1797 " |
1790 (Rectangle origin:10@10 corner:50@50) scaledBy:2 |
1798 (Rectangle origin:10@10 corner:50@50) scaledBy:2 |
1791 " |
1799 " |
1792 |
1800 |
1793 "its NOT destructive:" |
1801 "its NOT destructive:" |
1894 ! ! |
1902 ! ! |
1895 |
1903 |
1896 !Rectangle class methodsFor:'documentation'! |
1904 !Rectangle class methodsFor:'documentation'! |
1897 |
1905 |
1898 version |
1906 version |
1899 ^ '$Header: /cvs/stx/stx/libbasic/Rectangle.st,v 1.90 2014-12-21 22:41:28 cg Exp $' |
1907 ^ '$Header$' |
1900 ! |
1908 ! |
1901 |
1909 |
1902 version_CVS |
1910 version_CVS |
1903 ^ '$Header: /cvs/stx/stx/libbasic/Rectangle.st,v 1.90 2014-12-21 22:41:28 cg Exp $' |
1911 ^ '$Header$' |
1904 ! ! |
1912 ! ! |
1905 |
1913 |