390 |
392 |
391 corner |
393 corner |
392 "return the corner" |
394 "return the corner" |
393 |
395 |
394 %{ /* NOCONTEXT */ |
396 %{ /* NOCONTEXT */ |
395 if (self == @global(Rectangle)) { |
397 if (__qClass(self) == @global(Rectangle)) { |
396 OBJ _tleft = __INST(left); |
398 OBJ _tleft = __INST(left); |
397 OBJ _ttop = __INST(top); |
399 OBJ _ttop = __INST(top); |
398 OBJ _twidth = __INST(width); |
400 OBJ _twidth = __INST(width); |
399 OBJ _theight = __INST(height); |
401 OBJ _theight = __INST(height); |
400 |
402 |
401 if (__bothSmallInteger(_tleft, _ttop) |
403 if (__bothSmallInteger(_tleft, _ttop) |
402 && __bothSmallInteger(_twidth, _theight)) { |
404 && __bothSmallInteger(_twidth, _theight)) { |
403 if (__CanDoQuickNew(sizeof(struct __Point))) { /* OBJECT ALLOCATION */ |
405 if (__CanDoQuickNew(sizeof(struct __Point))) { /* OBJECT ALLOCATION */ |
404 OBJ newPoint; |
406 OBJ newPoint; |
405 int spc; |
407 int spc; |
406 int cX = __intVal(_tleft) + __intVal(_twidth); |
408 int cX = __intVal(_tleft) + __intVal(_twidth); |
407 int cY = __intVal(_ttop) + __intVal(_theight); |
409 int cY = __intVal(_ttop) + __intVal(_theight); |
408 |
410 |
409 if (__ISVALIDINTEGER(cX) && __ISVALIDINTEGER(cY)) { |
411 if (__ISVALIDINTEGER(cX) && __ISVALIDINTEGER(cY)) { |
410 __qCheckedNew(newPoint, sizeof(struct __Point)); |
412 __qCheckedNew(newPoint, sizeof(struct __Point)); |
411 __InstPtr(newPoint)->o_class = self; __qSTORE(newPoint, self); |
413 __InstPtr(newPoint)->o_class = @global(Point); __qSTORE(newPoint, @global(Point)); |
412 __PointInstPtr(newPoint)->p_x = __MKSMALLINT(cX); |
414 __PointInstPtr(newPoint)->p_x = __MKSMALLINT(cX); |
413 __PointInstPtr(newPoint)->p_y = __MKSMALLINT(cY); |
415 __PointInstPtr(newPoint)->p_y = __MKSMALLINT(cY); |
414 RETURN ( newPoint ); |
416 RETURN ( newPoint ); |
415 } |
417 } |
416 } |
418 } |
417 } |
419 } |
418 } |
420 } |
419 %}. |
421 %}. |
420 ^ (left + width) @ (top + height) |
422 ^ (left + width) @ (top + height) |
|
423 |
|
424 " |
|
425 (self origin:0@0 corner:100@100) corner |
|
426 (self origin:0@0 corner:100@100) origin |
|
427 (self origin:5@5 corner:100@100) extent |
|
428 " |
421 ! |
429 ! |
422 |
430 |
423 corner:aPoint |
431 corner:aPoint |
424 "set the bottom-right corner - warning: destructive" |
432 "set the bottom-right corner - warning: destructive" |
425 |
433 |
431 "return the extent" |
439 "return the extent" |
432 |
440 |
433 %{ /* NOCONTEXT */ |
441 %{ /* NOCONTEXT */ |
434 |
442 |
435 if (__CanDoQuickNew(sizeof(struct __Point))) { /* OBJECT ALLOCATION */ |
443 if (__CanDoQuickNew(sizeof(struct __Point))) { /* OBJECT ALLOCATION */ |
436 if (self == @global(Rectangle)) { |
444 if (__qClass(self) == @global(Rectangle)) { |
437 OBJ newPoint; |
445 OBJ newPoint; |
438 int spc; |
446 int spc; |
439 OBJ newX = __INST(width); |
447 OBJ newX = __INST(width); |
440 OBJ newY = __INST(height); |
448 OBJ newY = __INST(height); |
441 |
449 |
442 __qCheckedNew(newPoint, sizeof(struct __Point)); |
450 __qCheckedNew(newPoint, sizeof(struct __Point)); |
443 __InstPtr(newPoint)->o_class = self; __qSTORE(newPoint, self); |
451 __InstPtr(newPoint)->o_class = @global(Point); __qSTORE(newPoint, @global(Point)); |
444 __PointInstPtr(newPoint)->p_x = newX; |
452 __PointInstPtr(newPoint)->p_x = newX; |
445 __PointInstPtr(newPoint)->p_y = newY; |
453 __PointInstPtr(newPoint)->p_y = newY; |
446 if (! __bothSmallInteger(newX, newY)) { |
454 if (! __bothSmallInteger(newX, newY)) { |
447 spc = __qSpace(newPoint); |
455 spc = __qSpace(newPoint); |
448 __STORE_SPC(newPoint, newX, spc); |
456 __STORE_SPC(newPoint, newX, spc); |
449 __STORE_SPC(newPoint, newY, spc); |
457 __STORE_SPC(newPoint, newY, spc); |
450 } |
458 } |
451 RETURN ( newPoint ); |
459 RETURN ( newPoint ); |
452 } |
460 } |
453 } |
461 } |
454 %}. |
462 %}. |
455 ^ Point x:width y:height |
463 ^ Point x:width y:height |
456 ! |
464 ! |
457 |
465 |
555 |
563 |
556 /* |
564 /* |
557 * claus: I am no longer certain, if this primitive is worth the effort |
565 * claus: I am no longer certain, if this primitive is worth the effort |
558 */ |
566 */ |
559 if (__CanDoQuickNew(sizeof(struct __Point))) { /* OBJECT ALLOCATION */ |
567 if (__CanDoQuickNew(sizeof(struct __Point))) { /* OBJECT ALLOCATION */ |
560 if (self == @global(Rectangle)) { |
568 if (__qClass(self) == @global(Rectangle)) { |
561 OBJ newPoint; |
569 OBJ newPoint; |
562 int spc; |
570 int spc; |
563 OBJ newX = __INST(left); |
571 OBJ newX = __INST(left); |
564 OBJ newY = __INST(top); |
572 OBJ newY = __INST(top); |
565 |
573 |
566 __qCheckedNew(newPoint, sizeof(struct __Point)); |
574 __qCheckedNew(newPoint, sizeof(struct __Point)); |
567 __InstPtr(newPoint)->o_class = self; __qSTORE(newPoint, self); |
575 __InstPtr(newPoint)->o_class = @global(Point); __qSTORE(newPoint, @global(Point)); |
568 __PointInstPtr(newPoint)->p_x = newX; |
576 __PointInstPtr(newPoint)->p_x = newX; |
569 __PointInstPtr(newPoint)->p_y = newY; |
577 __PointInstPtr(newPoint)->p_y = newY; |
570 if (! __bothSmallInteger(newX, newY)) { |
578 if (! __bothSmallInteger(newX, newY)) { |
571 spc = __qSpace(newPoint); |
579 spc = __qSpace(newPoint); |
572 __STORE_SPC(newPoint, newX, spc); |
580 __STORE_SPC(newPoint, newX, spc); |
573 __STORE_SPC(newPoint, newY, spc); |
581 __STORE_SPC(newPoint, newY, spc); |
574 } |
582 } |
575 RETURN ( newPoint ); |
583 RETURN ( newPoint ); |
576 } |
584 } |
577 } |
585 } |
578 %}. |
586 %}. |
579 ^ Point x:left y:top |
587 ^ Point x:left y:top |
580 ! |
588 ! |
581 |
589 |
705 topLeft:aPoint |
713 topLeft:aPoint |
706 "Set the top and left edges. |
714 "Set the top and left edges. |
707 The bottom right remains unchanged. |
715 The bottom right remains unchanged. |
708 warning: destructive" |
716 warning: destructive" |
709 |
717 |
|
718 |newTop newLeft| |
|
719 |
|
720 newTop := aPoint y. |
|
721 height := height + (top - newTop). |
|
722 top := newTop. |
|
723 newLeft := aPoint x. |
|
724 width := width + (left - newLeft). |
|
725 left := newLeft. |
|
726 |
|
727 " |
|
728 ((self origin:0@0 corner:100@100) topLeft:(10@20)) |
|
729 corner |
|
730 " |
|
731 ! |
|
732 |
|
733 topRight |
|
734 "return the top-right point" |
|
735 |
|
736 ^ (left + width) @ top |
|
737 ! |
|
738 |
|
739 topRight:aPoint |
|
740 "Set the top and right edges. |
|
741 The bottom left remains unchanged. |
|
742 warning: destructive" |
|
743 |
710 |newTop| |
744 |newTop| |
711 |
745 |
712 newTop := aPoint y. |
746 newTop := aPoint y. |
713 height := height + (top - newTop). |
747 height := height + (top - newTop). |
714 top := newTop. |
748 top := newTop. |
715 width := aPoint x - left |
749 width := aPoint x - left |
716 ! |
750 |
717 |
751 " |
718 topRight |
752 ((self origin:0@0 corner:100@100) topRight:(10@20)) |
719 "return the top-right point" |
753 corner |
720 |
754 " |
721 ^ (left + width) @ top |
|
722 ! |
|
723 |
|
724 topRight:aPoint |
|
725 "Set the top and right edges. |
|
726 The bottom left remains unchanged. |
|
727 warning: destructive" |
|
728 |
|
729 |newTop| |
|
730 |
|
731 newTop := aPoint y. |
|
732 height := height + (top - newTop). |
|
733 top := newTop. |
|
734 width := aPoint x - left |
|
735 ! |
755 ! |
736 |
756 |
737 vertices |
757 vertices |
738 "return the array containing my points as a closed polygon (for Polygon compatibility)" |
758 "return the array containing my points as a closed polygon (for Polygon compatibility)" |
739 |
759 |
817 asFractionalLayout |
837 asFractionalLayout |
818 "return a layoutFrame in which fractions (top, left, bottom, right) |
838 "return a layoutFrame in which fractions (top, left, bottom, right) |
819 are taken from corresponding edges of the receiver. |
839 are taken from corresponding edges of the receiver. |
820 You have to make certain that those are in 0..1." |
840 You have to make certain that those are in 0..1." |
821 |
841 |
822 |l| |
842 ^ LayoutFrame new |
823 |
|
824 l := LayoutFrame new. |
|
825 l |
|
826 leftFraction:(self left); |
843 leftFraction:(self left); |
827 rightFraction:(self right); |
844 rightFraction:(self right); |
828 topFraction:(self top); |
845 topFraction:(self top); |
829 bottomFraction:(self bottom). |
846 bottomFraction:(self bottom); |
830 ^ l |
847 yourself. |
831 |
848 |
832 " |
849 " |
833 (0.5@0.5 corner:0.75@0.75) asFractionalLayout |
850 (0.5@0.5 corner:0.75@0.75) asFractionalLayout |
834 (0.5@0.5 corner:0.75@0.75) asOffsetLayout |
851 (0.5@0.5 corner:0.75@0.75) asOffsetLayout |
835 (0.5@0.5 corner:0.75@0.75) asLayout |
852 (0.5@0.5 corner:0.75@0.75) asLayout |
885 asOffsetLayout |
902 asOffsetLayout |
886 "return a layoutFrame in which offsets (top, left, bottom, right) |
903 "return a layoutFrame in which offsets (top, left, bottom, right) |
887 are taken from corresponding edges of the receiver. |
904 are taken from corresponding edges of the receiver. |
888 You have to make certain that those are in 0..1." |
905 You have to make certain that those are in 0..1." |
889 |
906 |
890 |newLayout| |
907 ^ LayoutFrame new |
891 |
908 leftOffset:(self left); |
892 newLayout := LayoutFrame new. |
909 rightFraction:0 offset:(self right); |
893 newLayout |
910 topOffset:(self top); |
894 leftOffset:(self left); |
911 bottomFraction:0 offset:(self bottom); |
895 rightFraction:0 offset:(self right); |
912 yourself. |
896 topOffset:(self top); |
|
897 bottomFraction:0 offset:(self bottom). |
|
898 ^ newLayout |
|
899 |
913 |
900 " |
914 " |
901 (0.5@0.5 corner:0.75@0.75) asFractionalLayout |
915 (0.5@0.5 corner:0.75@0.75) asFractionalLayout |
902 (0.5@0.5 corner:0.75@0.75) asOffsetLayout |
916 (0.5@0.5 corner:0.75@0.75) asOffsetLayout |
903 (0.5@0.5 corner:0.75@0.75) asLayout |
917 (0.5@0.5 corner:0.75@0.75) asLayout |
904 |
918 |
905 (10@10 corner:20@20) asFractionalLayout |
919 (10@10 corner:20@20) asFractionalLayout |
906 (10@10 corner:20@20) asOffsetLayout |
920 (10@10 corner:20@20) asOffsetLayout |
907 (10@10 corner:20@20) asLayout |
921 (10@10 corner:20@20) asLayout |
908 " |
922 " |
909 |
|
910 ! |
923 ! |
911 |
924 |
912 asPointArray |
925 asPointArray |
913 "return an array containing my corners (clockwise) and |
926 "return an array containing my corners (clockwise) and |
914 the origin again as 5th element. Can be used to convert |
927 the origin again as 5th element. Can be used to convert |
935 " |
948 " |
936 (10@10 corner:100@100) asPolygon |
949 (10@10 corner:100@100) asPolygon |
937 " |
950 " |
938 |
951 |
939 "Modified: 8.5.1996 / 20:14:44 / cg" |
952 "Modified: 8.5.1996 / 20:14:44 / cg" |
|
953 ! |
|
954 |
|
955 asRectangle |
|
956 ^ self |
940 ! |
957 ! |
941 |
958 |
942 fromLiteralArrayEncoding:encoding |
959 fromLiteralArrayEncoding:encoding |
943 "read my values from an encoding. |
960 "read my values from an encoding. |
944 The encoding is supposed to be of the form: (Rectangle orgX orgY cornX cornY)" |
961 The encoding is supposed to be of the form: (Rectangle orgX orgY cornX cornY)" |
1131 |
1148 |
1132 "Modified (comment): / 27-11-2017 / 10:43:12 / cg" |
1149 "Modified (comment): / 27-11-2017 / 10:43:12 / cg" |
1133 ! ! |
1150 ! ! |
1134 |
1151 |
1135 !Rectangle methodsFor:'displaying'! |
1152 !Rectangle methodsFor:'displaying'! |
|
1153 |
|
1154 ascentOn:aGC |
|
1155 "displayOn: does draw above baseline" |
|
1156 |
|
1157 ^ aGC fontAscent |
|
1158 ! |
1136 |
1159 |
1137 displayFilledOn:aGC |
1160 displayFilledOn:aGC |
1138 "display a filled rectangle as represented by the receiver in |
1161 "display a filled rectangle as represented by the receiver in |
1139 the graphicsContext, aGC" |
1162 the graphicsContext, aGC" |
1140 |
1163 |
1702 ! |
1725 ! |
1703 |
1726 |
1704 encompass:aPoint |
1727 encompass:aPoint |
1705 "return a Rectangle that contains both the receiver and aPoint." |
1728 "return a Rectangle that contains both the receiver and aPoint." |
1706 |
1729 |
1707 ^ Rectangle |
1730 ^ self class |
1708 origin: (self origin min: aPoint) |
1731 origin: (self origin min: aPoint) |
1709 corner: (self corner max: aPoint) |
1732 corner: (self corner max: aPoint) |
1710 |
|
1711 ! |
1733 ! |
1712 |
1734 |
1713 expandedBy:delta |
1735 expandedBy:delta |
1714 "return a new rectangle which is expanded in all directions |
1736 "return a new rectangle which is expanded in all directions |
1715 by amount, a Point, Rectangle or Number" |
1737 by amount, a Point, Rectangle or Number" |
1768 |
1790 |
1769 insetOriginBy:originDelta cornerBy:cornerDelta |
1791 insetOriginBy:originDelta cornerBy:cornerDelta |
1770 "return a new rectangle which is inset by originDelta |
1792 "return a new rectangle which is inset by originDelta |
1771 and cornerDelta; both may be instances of Point or Number" |
1793 and cornerDelta; both may be instances of Point or Number" |
1772 |
1794 |
1773 ^ Rectangle |
1795 ^ self class |
1774 origin:(left @ top) + originDelta asPoint |
1796 origin:(left @ top) + originDelta asPoint |
1775 corner:(self corner - cornerDelta asPoint) |
1797 corner:(self corner - cornerDelta asPoint) |
1776 " |
1798 " |
1777 |r| |
1799 |r| |
1778 r := Rectangle origin:10@10 corner:100@100. |
1800 r := Rectangle origin:10@10 corner:100@100. |
1779 r insetOriginBy:5 cornerBy:10. |
1801 r insetOriginBy:5 cornerBy:10. |
1780 r insetOriginBy:10@5 cornerBy:10. |
1802 r insetOriginBy:10@5 cornerBy:10. |
1786 intersect:aRectangle |
1808 intersect:aRectangle |
1787 "return a new rectangle covering the intersection of the receiver |
1809 "return a new rectangle covering the intersection of the receiver |
1788 and the argument, aRectangle (i.e. the area covered by both). |
1810 and the argument, aRectangle (i.e. the area covered by both). |
1789 the rectangles must intersect for a valid return" |
1811 the rectangles must intersect for a valid return" |
1790 |
1812 |
1791 ^ Rectangle |
1813 ^ self class |
1792 left:(left max:(aRectangle left)) |
1814 left:(left max:(aRectangle left)) |
1793 right:((left + width) min:(aRectangle right)) |
1815 right:((left + width) min:(aRectangle right)) |
1794 top:(top max:(aRectangle top)) |
1816 top:(top max:(aRectangle top)) |
1795 bottom:((top + height) min:(aRectangle bottom)) |
1817 bottom:((top + height) min:(aRectangle bottom)) |
1796 |
1818 |
1807 |
1829 |
1808 merge:aRectangle |
1830 merge:aRectangle |
1809 "return a new rectangle covering both the receiver |
1831 "return a new rectangle covering both the receiver |
1810 and the argument, aRectangle" |
1832 and the argument, aRectangle" |
1811 |
1833 |
1812 ^ Rectangle |
1834 ^ self class |
1813 left:(left min:(aRectangle left)) |
1835 left:(left min:(aRectangle left)) |
1814 right:((left + width) max:(aRectangle right)) |
1836 right:((left + width) max:(aRectangle right)) |
1815 top:(top min:(aRectangle top)) |
1837 top:(top min:(aRectangle top)) |
1816 bottom:((top + height) max:(aRectangle bottom)) |
1838 bottom:((top + height) max:(aRectangle bottom)) |
1817 |
1839 |
1854 rTop < minY ifTrue: [useRcvr := false. minY := rTop]. |
1876 rTop < minY ifTrue: [useRcvr := false. minY := rTop]. |
1855 maxY := self bottom. |
1877 maxY := self bottom. |
1856 rBottom > maxY ifTrue: [useRcvr := false. maxY := rBottom]. |
1878 rBottom > maxY ifTrue: [useRcvr := false. maxY := rBottom]. |
1857 |
1879 |
1858 useRcvr ifTrue: [ |
1880 useRcvr ifTrue: [ |
1859 ^ self |
1881 ^ self |
1860 ]. |
1882 ]. |
1861 |
1883 |
1862 minX = rLeft ifTrue:[ |
1884 minX = rLeft ifTrue:[ |
1863 maxX = rRight ifTrue:[ |
1885 maxX = rRight ifTrue:[ |
1864 minY = rTop ifTrue:[ |
1886 minY = rTop ifTrue:[ |
1865 maxY = rBottom ifTrue:[ |
1887 maxY = rBottom ifTrue:[ |
1866 ^ aRectangle |
1888 ^ aRectangle |
1867 ]. |
1889 ]. |
1868 ]. |
1890 ]. |
1869 ]. |
1891 ]. |
1870 ]. |
1892 ]. |
1871 |
1893 |
1872 ^ Rectangle left:minX top:minY right:maxX bottom:maxY. |
1894 ^ self class left:minX top:minY right:maxX bottom:maxY. |
1873 |
1895 |
1874 " |
1896 " |
1875 (Rectangle origin:10@10 corner:100@100) |
1897 (Rectangle origin:10@10 corner:100@100) |
1876 quickMerge:(Rectangle origin:20@20 corner:110@110) |
1898 quickMerge:(Rectangle origin:20@20 corner:110@110) |
1877 |
1899 |
1878 (Rectangle origin:10@10 corner:100@100) |
1900 (Rectangle origin:10@10 corner:100@100) |
1879 quickMerge:(Rectangle origin:20@20 corner:100@100) |
1901 quickMerge:(Rectangle origin:20@20 corner:100@100) |
1880 " |
1902 " |
1881 ! |
1903 ! |
1882 |
1904 |
1883 scaledBy:scale |
1905 scaledBy:scale |
1884 "return a new rectangle which is the receiver |
1906 "return a new rectangle which is the receiver |
1886 |
1908 |
1887 |scalePoint sx sy| |
1909 |scalePoint sx sy| |
1888 |
1910 |
1889 (scale isMemberOf:SmallInteger) ifTrue:[ |
1911 (scale isMemberOf:SmallInteger) ifTrue:[ |
1890 "/ this is an stc optimization (a hint to inline) |
1912 "/ this is an stc optimization (a hint to inline) |
1891 ^ Rectangle |
1913 ^ self class |
1892 left:(left * scale) top:(top * scale) |
1914 left:(left * scale) top:(top * scale) |
1893 width:(width * scale) height:(height * scale) |
1915 width:(width * scale) height:(height * scale) |
1894 ]. |
1916 ]. |
1895 |
1917 |
1896 scalePoint := scale asPoint. |
1918 scalePoint := scale asPoint. |
1897 sx := scalePoint x. |
1919 sx := scalePoint x. |
1898 sy := scalePoint y. |
1920 sy := scalePoint y. |
1899 ^ Rectangle |
1921 ^ self class |
1900 left:(left * sx) top:(top * sy) |
1922 left:(left * sx) top:(top * sy) |
1901 width:(width * sx) height:(height * sy) |
1923 width:(width * sx) height:(height * sy) |
1902 " |
1924 " |
1903 (Rectangle origin:10@10 corner:50@50) scaledBy:2 |
1925 (Rectangle origin:10@10 corner:50@50) scaledBy:2 |
1904 " |
1926 " |
1974 |
1996 |
1975 |amountPoint| |
1997 |amountPoint| |
1976 |
1998 |
1977 (amount isMemberOf:SmallInteger) ifTrue:[ |
1999 (amount isMemberOf:SmallInteger) ifTrue:[ |
1978 "/ this is an stc optimization (a hint to inline) |
2000 "/ this is an stc optimization (a hint to inline) |
1979 ^ Rectangle |
2001 ^ self class |
1980 left:(left + amount) top:(top + amount) |
2002 left:(left + amount) top:(top + amount) |
1981 width:width height:height |
2003 width:width height:height |
1982 ]. |
2004 ]. |
1983 |
2005 |
1984 amountPoint := amount asPoint. |
2006 amountPoint := amount asPoint. |
1985 ^ Rectangle |
2007 ^ self class |
1986 left:(left + amountPoint x) top:(top + amountPoint y) |
2008 left:(left + amountPoint x) top:(top + amountPoint y) |
1987 width:width height:height |
2009 width:width height:height |
1988 " |
2010 " |
1989 (Rectangle origin:10@10 corner:50@50) translatedBy:10 |
2011 (Rectangle origin:10@10 corner:50@50) translatedBy:10 |
1990 " |
2012 " |
2022 |
2044 |
2023 align:offset with:someCoordinate |
2045 align:offset with:someCoordinate |
2024 "return a new rectangle which is translated (i.e. moved) |
2046 "return a new rectangle which is translated (i.e. moved) |
2025 such that the point offset in mySelf is placed on someCoordinate." |
2047 such that the point offset in mySelf is placed on someCoordinate." |
2026 |
2048 |
2027 ^ Rectangle origin:(someCoordinate - offset + self origin) |
2049 ^ self class origin:(someCoordinate - offset + self origin) |
2028 extent:(self extent) |
2050 extent:(self extent) |
2029 " |
2051 " |
2030 |r| |
2052 |r| |
2031 |
2053 |
2032 r := Rectangle origin:10@10 corner:50@50. |
2054 r := Rectangle origin:10@10 corner:50@50. |
2033 r align:(r center) with:100@100. |
2055 r align:(r center) with:100@100. |
2042 |
2064 |
2043 (left isInteger |
2065 (left isInteger |
2044 and:[top isInteger |
2066 and:[top isInteger |
2045 and:[width isInteger |
2067 and:[width isInteger |
2046 and:[height isInteger]]]) |
2068 and:[height isInteger]]]) |
2047 ifTrue: [^ self]. |
2069 ifTrue: [^ self]. |
2048 |
2070 |
2049 ^ Rectangle left:(left rounded) |
2071 ^ self class left:(left rounded) |
2050 top:(top rounded) |
2072 top:(top rounded) |
2051 width:(width rounded) |
2073 width:(width rounded) |
2052 height:(height rounded) |
2074 height:(height rounded) |
2053 ! |
2075 ! |
2054 |
2076 |
2055 truncated |
2077 truncated |
2056 "return a Rectangle whose origin and corner have any fractional parts removed. |
2078 "return a Rectangle whose origin and corner have any fractional parts removed. |
2057 Return the receiver if its coordinates are already integral." |
2079 Return the receiver if its coordinates are already integral." |
2058 |
2080 |
2059 (left isInteger |
2081 (left isInteger |
2060 and:[top isInteger |
2082 and:[top isInteger |
2061 and:[width isInteger |
2083 and:[width isInteger |
2062 and:[height isInteger]]]) |
2084 and:[height isInteger]]]) |
2063 ifTrue: [^ self]. |
2085 ifTrue: [^ self]. |
2064 |
2086 |
2065 ^ Rectangle |
2087 ^ self class |
2066 left:left truncated |
2088 left:left truncated |
2067 top:top truncated |
2089 top:top truncated |
2068 width:width truncated |
2090 width:width truncated |
2069 height:height truncated. |
2091 height:height truncated. |
2070 ! ! |
2092 ! ! |
2071 |
2093 |
2072 !Rectangle class methodsFor:'documentation'! |
2094 !Rectangle class methodsFor:'documentation'! |
2073 |
2095 |
2074 version |
2096 version |