The Trunk: Graphics-tbn.157.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-tbn.157.mcz

commits-2
Torsten Bergmann uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-tbn.157.mcz

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

Name: Graphics-tbn.157
Author: tbn
Time: 19 November 2010, 9:24:53.858 pm
UUID: 0e6ea246-6d40-ce4c-a609-ae1e5b4a82c4
Ancestors: Graphics-ul.156

Fix http://code.google.com/p/pharo/issues/detail?id=3225 also in Squeak
Thx to jbaptiste.arnaud:

=============== Diff against Graphics-ul.156 ===============

Item was changed:
  ----- Method: Form>>fadeImage:at:indexAndMaskDo: (in category 'transitions') -----
  fadeImage: otherImage at: topLeft
  indexAndMaskDo: indexAndMaskBlock
+
  "This fade uses halftones as a blending hack.
  Zeros in the halftone produce the original image (self), and
  ones in the halftone produce the 'otherImage'.
  IndexAndMaskBlock gets evaluated prior to each cycle,
  and the resulting boolean determines whether to continue cycling."
+ | index imageRect maskForm resultForm pix returnPix|
- | index imageRect maskForm resultForm |
  imageRect := otherImage boundingBox.
  resultForm := self copy: (topLeft extent: imageRect extent).
  maskForm := Form extent: 32@32.
  index := 0.
+
  [indexAndMaskBlock value: (index := index+1) value: maskForm]
  whileTrue:
  [maskForm reverse.
  resultForm copyBits: imageRect from: resultForm at: 0@0
  clippingBox: imageRect rule: Form over fillColor: maskForm.
  maskForm reverse.
  resultForm copyBits: imageRect from: otherImage at: 0@0
  clippingBox: imageRect rule: Form under fillColor: maskForm.
  self copyBits: imageRect from: resultForm at: topLeft
  clippingBox: self boundingBox rule: Form over fillColor: nil.
  Display forceDisplayUpdate]!

Item was changed:
  ----- Method: Form>>fadeImageCoarse:at: (in category 'transitions') -----
  fadeImageCoarse: otherImage at: topLeft
  "Display fadeImageCoarse: (Form fromDisplay: (40@40 extent: 300@300)) reverse at: 40@40"
+ | d pix|
- | d |
  d := self depth.
  ^ self fadeImage: otherImage at: topLeft indexAndMaskDo:
+ [:i :mask | | j |
- [:i :mask |
- | pix j |
  i=1 ifTrue: [pix := (1 bitShift: d) - 1.
+ 1 to: 8//d-1 do: [:q | pix := pix bitOr: (pix bitShift: d*4)]] .
+ i <= 16 ifTrue:[
+ j := i-1//4+1.
- 1 to: 8//d-1 do: [:q | pix := pix bitOr: (pix bitShift: d*4)]].
- i <= 16 ifTrue:
- [j := i-1//4+1.
  (0 to: 28 by: 4) do: [:k |
  mask bits at: j+k
+ put: (pix bitOr: (mask bits at: j+k))].
+ true]
- put: ((mask bits at: j+k) bitOr: (pix bitShift: i-1\\4*d))].
- "mask display." true]
  ifFalse: [false]]!

Item was changed:
  ----- Method: Form>>fadeImageFine:at: (in category 'transitions') -----
  fadeImageFine: otherImage at: topLeft
  "Display fadeImageFine: (Form fromDisplay: (40@40 extent: 300@300)) reverse at: 40@40"
+ | d pix|
- | d |
  d := self depth.
  ^ self fadeImage: otherImage at: topLeft indexAndMaskDo:
+ [:i :mask | | j ii  |
- [:i :mask |
- | pix j ii  |
  i=1 ifTrue: [pix := (1 bitShift: d) - 1.
  1 to: 8//d-1 do:
  [:q | pix := pix bitOr: (pix bitShift: d*4)]].
  i <= 16 ifTrue:
  [ii := #(0 10 2 8 7 13 5 15 1 11 3 9 6 12 4 14) at: i.
  j := ii//4+1.
  (0 to: 28 by: 4) do:
  [:k | mask bits at: j+k put:
+ ((mask bits at: j+k) bitOr: (pix))].
- ((mask bits at: j+k) bitOr: (pix bitShift: ii\\4*d))].
  true]
  ifFalse: [false]]!

Item was changed:
  ----- Method: Form>>fadeImageSquares:at: (in category 'transitions') -----
  fadeImageSquares: otherImage at: topLeft
  "Display fadeImageSquares: (Form fromDisplay: (40@40 extent: 300@300)) reverse at: 40@40"
  ^ self fadeImage: otherImage at: topLeft indexAndMaskDo:
  [:i :mask |
  mask fill: ((16-i) asPoint extent: (i*2) asPoint) fillColor: Color black.
  i <= 16]!

Item was changed:
  ----- Method: Form>>fadeImageVert:at: (in category 'transitions') -----
  fadeImageVert: otherImage at: topLeft
  "Display fadeImageVert: (Form fromDisplay: (10@10 extent: 300@300)) reverse at: 10@10"
  | d |
  d := self depth.
  ^ self fadeImage: otherImage at: topLeft indexAndMaskDo:
  [:i :mask |
  mask fill: ((mask width//2//d-i*d)@0 extent: i*2*d@mask height) fillColor: Color black.
  i <= (mask width//d)]!