use-revolution Digest, Vol 22, Issue 14

Malte Brill revolution at derbrill.de
Mon Jul 4 17:09:25 EDT 2005


Hi Alex,

here is the fastest we have been discussing in chatRev until now.
( chatrev.cjb.net )
Thanks to kWeed, Mark and BvG!

Still room for optimization though.

on mouseUp
   put the milliseconds into gorb
   put 0 into counter
   put 0 into newValue
   put 0 into line 768 of newHistogram
   repeat for each char theChar in the imageData of img 1
     add 1 to counter
     if counter mod 4=0 then
       add charToNum(theChar) to newValue
       if line newValue of newhistoGram is not a number then
         put 1 into line (newValue) of newHistoGram
       else
         add 1 to line (newValue) of newHistogram
       end if
       put 0 into newValue
     else
       add charToNum(theChar) to newValue
     end if
   end repeat
   repeat for each line theLine in newhistogram
     if theLine is a number then
       put theLine&cr after theHistogram
     else
       put 0&cr after theHistogram
     end if
   end repeat
   delete char -1 of theHistogram
   put theHistogram into fld "test"
   --split theHistogram by return if you want an array
   answer the milliseconds-gorb
end mouseUp


Cheers,

malte


More information about the use-livecode mailing list