# [Pkg] The Trunk: Graphics-mt.353.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Jul 13 10:16:37 UTC 2016

```Marcel Taeumel uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-mt.353.mcz

==================== Summary ====================

Name: Graphics-mt.353
Author: mt
Time: 13 July 2016, 12:15:51.812029 pm
UUID: ecba04a2-359a-9242-a453-713066ae433d
Ancestors: Graphics-mt.352

Clean-up some dependencies between Graphics, Morphic, and TrueType.

=============== Diff against Graphics-mt.352 ===============

+ ----- Method: Point>>ceiling (in category 'truncation and round off') -----
+ ceiling
+
+ 	(x isInteger and: [y isInteger]) ifTrue: [^ self].
+ 	^ x ceiling @ y ceiling
+ !

+ ----- Method: Point>>floor (in category 'truncation and round off') -----
+ floor
+
+ 	(x isInteger and: [y isInteger]) ifTrue: [^ self].
+ 	^ x floor @ y floor
+ !

+ ----- Method: Point>>guarded (in category 'extent functions') -----
+ guarded
+ 	"Return a positive nonzero extent."
+ 	^ self max: 1 at 1!

+ ----- Method: Point>>isIntegerPoint (in category 'truncation and round off') -----
+ isIntegerPoint
+ ^ x isInteger and: [ y isInteger ] !

+ ----- Method: Point>>roundDownTo: (in category 'truncation and round off') -----
+ roundDownTo: grid
+ 	"Answer a Point that is the receiver's x and y rounded to grid x and
+ 	grid y by lower value (toward negative infinity)."
+
+ 	| gridPoint |
+ 	gridPoint := grid asPoint.
+ 	^(x roundDownTo: gridPoint x) @ (y roundDownTo: gridPoint y)!

+ ----- Method: Point>>roundUpTo: (in category 'truncation and round off') -----
+ roundUpTo: grid
+ 	"Answer a Point that is the receiver's x and y rounded to grid x and
+ 	grid y by upper value (toward infinity)."
+
+ 	| gridPoint |
+ 	gridPoint := grid asPoint.
+ 	^(x roundUpTo: gridPoint x) @ (y roundUpTo: gridPoint y)!

+ ----- Method: Point>>scaleTo: (in category 'extent functions') -----
+ scaleTo: anExtent
+ 	"Return a Point scalefactor for shrinking a thumbnail of the receiver's extent to fit within anExtent. self and anExtent are expected to have positive nonZero x and y."
+
+ 	|  factor  sX sY |
+ 	factor :=  3.0  reciprocal .
+ 	sX := anExtent x / self  x asFloat  .
+ 	sY :=  anExtent y / self  y asFloat  .
+ 	sX = sY ifTrue: [ ^ sX @ sY ] . "Same aspect ratio"
+ 	^ sX < sY ifTrue: [   sX @ (sX max: sY * factor) ]
+ 		ifFalse: [  (sY max: sX * factor ) @ sY  ] !

+ ----- Method: Rectangle>>ceiling (in category 'truncation and round off') -----
+ ceiling
+ 	Return reciever if it already and integerRectange."
+
+ 	self isIntegerRectangle ifTrue: [ ^ self ] .
+
+ 	^origin ceiling corner: corner ceiling!

+ ----- Method: Rectangle>>compressTo: (in category 'truncation and round off') -----
+ compressTo: grid
+ 	"Answer a Rectangle whose origin and corner are rounded to grid x and grid y.
+ 	Rounding is done by upper value on origin and lower value on corner so that
+ 	rounded rectangle is inside self."
+
+ 	^Rectangle origin: (origin roundUpTo: grid)
+ 				corner: (corner roundDownTo: grid)!

+ ----- Method: Rectangle>>compressed (in category 'truncation and round off') -----
+ compressed
+ 	"Answer a Rectangle whose origin and corner are rounded to integers.
+ 	Rounding is done by upper value on origin and lower value on corner so that
+ 	rounded rectangle is inside self."
+
+ 	^Rectangle origin: origin ceiling corner: corner floor!

+ ----- Method: Rectangle>>expandTo: (in category 'truncation and round off') -----
+ expandTo: grid
+ 	"Answer a Rectangle whose origin and corner are rounded to grid x and grid y.
+ 	Rounding is done by upper value on origin and lower value on corner so that
+ 	self is inside rounded rectangle."
+
+ 	^Rectangle origin: (origin roundDownTo: grid)
+ 				corner: (corner roundUpTo: grid)!

+ ----- Method: Rectangle>>expanded (in category 'truncation and round off') -----
+ expanded
+ 	"Answer a Rectangle whose origin and corner are rounded to integers.
+ 	Rounding is done by upper value on origin and lower value on corner so that
+ 	self is inside rounded rectangle."
+
+ 	^Rectangle origin: origin floor corner: corner ceiling!

+ ----- Method: Rectangle>>floor (in category 'truncation and round off') -----
+ floor
+ 	Return reciever if it already and integerRectange."
+
+ 	self isIntegerRectangle ifTrue: [ ^ self ] .
+
+ 	^origin floor corner: corner floor!

+ ----- Method: Rectangle>>isIntegerRectangle (in category 'truncation and round off') -----
+ isIntegerRectangle
+
+ 	^origin isIntegerPoint and: [ corner isIntegerPoint ]!