The Trunk: Graphics-nice.145.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-nice.145.mcz

commits-2
Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-nice.145.mcz

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

Name: Graphics-nice.145
Author: nice
Time: 25 July 2010, 2:24:08.202 pm
UUID: 81bcb012-b80d-4074-898f-4f9cb77a4534
Ancestors: Graphics-ar.144, Graphics-nice.139

Merge Graphics-nice.139:

Change behaviour of empty Rectangle:
- don't let an empty Rectangle #intersects:
- let #flipBy:centerAt: and #rotateBy:centerAt: preserve a Rectangle emptyness

=============== Diff against Graphics-ar.144 ===============

Item was changed:
  ----- Method: Rectangle>>intersects: (in category 'testing') -----
  intersects: aRectangle
  "Answer whether aRectangle intersects the receiver anywhere."
  "Optimized; old code answered:
  (origin max: aRectangle origin) < (corner min: aRectangle corner)"
 
  | rOrigin rCorner |
  rOrigin := aRectangle origin.
  rCorner := aRectangle corner.
  rCorner x <= origin x ifTrue: [^ false].
  rCorner y <= origin y ifTrue: [^ false].
  rOrigin x >= corner x ifTrue: [^ false].
  rOrigin y >= corner y ifTrue: [^ false].
+ "None of the two rectangle shall be empty"
+ corner x <= origin x ifTrue: [^ false].
+ corner y <= origin y ifTrue: [^ false].
+ rCorner x <= rOrigin x ifTrue: [^ false].
+ rCorner y <= rOrigin y ifTrue: [^ false].
  ^ true
  !

Item was changed:
  ----- Method: Rectangle>>rotateBy:centerAt: (in category 'transforming') -----
  rotateBy: direction centerAt: aPoint
  "Return a copy rotated #right, #left, or #pi about aPoint"
+ | futureOrigin futureCorner |
+ direction == #pi
+ ifTrue:
+ [futureOrigin := self corner.
+ futureCorner := self origin]
+ ifFalse: [direction == #left
+ ifTrue:
+ [futureOrigin := self topRight.
+ futureCorner := self bottomLeft]
+ ifFalse: [direction == #right
+ ifTrue:
+ [futureOrigin := self bottomLeft.
+ futureCorner := self topRight]
+ ifFalse: [self error: 'unrecognizable direction']]].
+ ^ (futureOrigin rotateBy: direction centerAt: aPoint)
+ corner: (futureCorner rotateBy: direction centerAt: aPoint)!
- ^ (origin rotateBy: direction centerAt: aPoint)
- rect: (corner rotateBy: direction centerAt: aPoint)!

Item was changed:
  ----- Method: Rectangle>>flipBy:centerAt: (in category 'transforming') -----
  flipBy: direction centerAt: aPoint
  "Return a copy flipped #vertical or #horizontal, about aPoint."
+ | futureOrigin futureCorner |
+ direction == #horizontal
+ ifTrue:
+ [futureOrigin := self topRight.
+ futureCorner := self bottomLeft]
+ ifFalse: [direction == #vertical
+ ifTrue:
+ [futureOrigin := self bottomLeft.
+ futureCorner := self topRight]
+ ifFalse: [self error: 'unrecognizable direction']].
+ ^ (futureOrigin flipBy: direction centerAt: aPoint)
+ corner: (futureCorner flipBy: direction centerAt: aPoint)!
- ^ (origin flipBy: direction centerAt: aPoint)
- rect: (corner flipBy: direction centerAt: aPoint)!