The Trunk: Graphics-mt.353.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Graphics-mt.353.mcz

commits-2
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 ===============

Item was added:
+ ----- Method: Point>>ceiling (in category 'truncation and round off') -----
+ ceiling
+ "Answer a Point that is the receiver's x and y ceiling. Answer the receiver if its coordinates are already integral."
+
+ (x isInteger and: [y isInteger]) ifTrue: [^ self].
+ ^ x ceiling @ y ceiling
+ !

Item was added:
+ ----- Method: Point>>floor (in category 'truncation and round off') -----
+ floor
+ "Answer a Point that is the receiver's x and y floor. Answer the receiver if its coordinates are already integral."
+
+ (x isInteger and: [y isInteger]) ifTrue: [^ self].
+ ^ x floor @ y floor
+ !

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

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

Item was added:
+ ----- 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)!

Item was added:
+ ----- 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)!

Item was added:
+ ----- 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  ] !

Item was added:
+ ----- Method: Rectangle>>ceiling (in category 'truncation and round off') -----
+ ceiling
+ "Answer the integer rectange to the bottom right of receiver.
+ Return reciever if it already and integerRectange."
+
+ self isIntegerRectangle ifTrue: [ ^ self ] .
+
+ ^origin ceiling corner: corner ceiling!

Item was added:
+ ----- 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)!

Item was added:
+ ----- 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!

Item was added:
+ ----- 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)!

Item was added:
+ ----- 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!

Item was added:
+ ----- Method: Rectangle>>floor (in category 'truncation and round off') -----
+ floor
+ "Answer the integer rectange to the topleft of receiver.
+ Return reciever if it already and integerRectange."
+
+ self isIntegerRectangle ifTrue: [ ^ self ] .
+
+ ^origin floor corner: corner floor!

Item was added:
+ ----- Method: Rectangle>>isIntegerRectangle (in category 'truncation and round off') -----
+ isIntegerRectangle
+ "Answer true if all component of receiver are integral."
+
+ ^origin isIntegerPoint and: [ corner isIntegerPoint ]!

Item was added:
+ ----- Method: Rectangle>>roundTo: (in category 'truncation and round off') -----
+ roundTo: grid
+ "Answer a Rectangle whose origin and corner are rounded to grid x and grid y."
+
+ ^Rectangle origin: (origin roundTo: grid)
+ corner: (corner roundTo: grid)!