The Trunk: Graphics-ar.123.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-ar.123.mcz

commits-2
Andreas Raab uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-ar.123.mcz

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

Name: Graphics-ar.123
Author: ar
Time: 22 March 2010, 10:43:52.545 pm
UUID: ff442413-fdb2-9844-a96c-b4a5995aa46f
Ancestors: Graphics-ar.122

Form>>flipVertically provides an efficient way to flip the rows in a form.

=============== Diff against Graphics-ar.122 ===============

Item was added:
+ ----- Method: Form>>flipVertically (in category 'converting') -----
+ flipVertically
+ "Flip the image along the y axis"
+ | rowLen row topIndex botIndex |
+ self unhibernate.
+ rowLen := bits size // height.
+ row := Bitmap new: rowLen.
+ topIndex := 1.
+ botIndex := bits size - rowLen + 1.
+ 1 to: height // 2 do: [:i |
+ self assert:[topIndex+rowLen <= botIndex].
+ row replaceFrom: 1 to: rowLen with: bits startingAt: topIndex.
+ bits replaceFrom: topIndex to: topIndex+rowLen-1 with: bits startingAt: botIndex.
+ bits replaceFrom: botIndex to: botIndex+rowLen-1 with: row startingAt: 1.
+ topIndex := topIndex + rowLen.
+ botIndex := botIndex - rowLen.
+ ].
+ !