The Trunk: Balloon-nice.31.mcz

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

The Trunk: Balloon-nice.31.mcz

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

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

Name: Balloon-nice.31
Author: nice
Time: 30 November 2017, 11:42:45.358651 pm
UUID: 41218742-19bf-46c7-aa04-25c4775e4549
Ancestors: Balloon-ul.30

Fix ShortRunArray initializedInstance

=============== Diff against Balloon-ul.30 ===============

Item was changed:
+ ----- Method: InterpolatedGradientFillStyle>>computePixelRampOfSize: (in category 'private') -----
- ----- Method: InterpolatedGradientFillStyle>>computePixelRampOfSize: (in category 'as yet unclassified') -----
  computePixelRampOfSize: length
  "Compute the pixel ramp in the receiver."
 
  | bits ramp lastColor lastIndex lastWord |
  ramp := colorRamp sorted:[:a1 :a2| a1 key < a2 key].
  bits := Bitmap new: length.
  lastColor := ramp first value.
  lastWord := lastColor pixelWord32.
  lastIndex := 0.
  ramp do:[:assoc| | distance nextColor theta nextWord nextIndex step |
  nextIndex := (assoc key * length) rounded.
  nextColor := assoc value.
  nextWord := nextColor pixelWord32.
  distance := nextIndex - lastIndex.
  distance = 0 ifTrue: [distance := 1].
  step := 1.0 / distance.
  theta := 0.0.
  lastIndex+1 to: nextIndex do: [:i|
  theta := theta + step.
  bits at: i put: (self interpolatedAlphaMix: theta of: lastWord and: nextWord)].
  lastIndex := nextIndex.
  lastColor := nextColor.
  lastWord := nextWord].
  lastIndex+1 to: length do: [:i| bits at: i put: lastWord].
  ^bits!

Item was changed:
+ ----- Method: InterpolatedGradientFillStyle>>interpolatedAlphaMix:of:and: (in category 'private') -----
- ----- Method: InterpolatedGradientFillStyle>>interpolatedAlphaMix:of:and: (in category 'as yet unclassified') -----
  interpolatedAlphaMix: ratio of: rgba1 and: rgba2
  "Answer a proper interpolated value between two RGBA color words.
  Theta is 0..1.."
 
  | a1 a2 ra ira rgb1 rgb2 alpha br1 br2 bg1 bg2 bb1 bb2 result |
  a1 := rgba1 bitShift: -24. a2 := rgba2 bitShift: -24.
  alpha := ratio * (a2 - a1) + a1.
  ra := ratio * alpha.
  ira := (1.0 - ratio) * alpha.
  rgb1 := rgba1 bitAnd: 16rFFFFFF. rgb2 := rgba2 bitAnd: 16rFFFFFF.
  br1 := (rgb1 bitAnd: 255). br2 := (rgb2 bitAnd: 255).
  bg1 := ((rgb1 bitShift:  -8) bitAnd: 255). bg2 := ((rgb2 bitShift: -8) bitAnd: 255).
  bb1 := ((rgb1 bitShift: -16) bitAnd: 255). bb2 := ((rgb2 bitShift: -16) bitAnd: 255).
  result :=  (ra * br2 + (ira * br1)) rounded // 255.
  result :=  result bitOr: ((ra * bg2 + (ira * bg1)) rounded // 255 bitShift: 8).
  result :=  result bitOr: ((ra * bb2 + (ira * bb1)) rounded // 255 bitShift: 16).
  ^result bitOr: (alpha rounded bitShift: 24)!

Item was added:
+ ----- Method: ShortRunArray class>>new (in category 'instance creation') -----
+ new
+ ^self newFrom: #()!