Levente Uzonyi wrote:
On Thu, 15 Apr 2010, Juan Vuletich wrote:
This is an updated version. It includes Levente's suggestion, and Yoshiki's and Andreas' alternatives as well, although disabled. All three options now work for gray level images with other bit depths besides 1 (I only tested 1 and 8). I also fixed transparent pixels for gray level images (it was completely broken).
Nice, I ran the following benchmark with all three (+1) versions:
Smalltalk garbageCollect. (1 to: 5) collect: [ :runs | [ ImageReadWriter formFromFileNamed: 'test.png' ] timeToRun ].
test.png is Ross' test image which is pretty large. The results:
#Andreas -> #(37 35 36 37 36). #Juan -> #(100 99 103 100 101). #Juan2 -> #(75 74 75 75 76). #Yoshiki -> #(38 38 39 38 38).
#Juan used the original method from your changeset, the others used the attached version. It includes three enhancements:
- doesn't create a blitter when it's not necessary, this affects all
benchmarks
- holds the bitmap in a variable instead of accessing via #bits
- uses #bitShift: instead of #<<
Levente
Cool! Will integrate your enh for Cuis asap!
Cheers, Juan Vuletich