Atkinson dither algorithm

Alejandro Tejada capellan2000 at gmail.com
Mon Oct 16 20:54:19 EDT 2017


Hi Alex,

This is Amazing! :-D
Alex, your function saved another 34%
in the running time of this handler!

In retrospect, only now it seems very obvious
that merging two functions could save more
running time in this handler... but
I just keep wondering: How far can we go
merging functions to save milliseconds
in our LiveCode handlers? This is an interesting
question that could be answered exactly
in milliseconds.

By the way, I have to add a try structure to dismiss
an error message:

Function ImgToChToArrayNum2 tImageData, tChannel
-- extract a single channel's data, and convert
-- to sequential array of numbers by Alex Tweedly

put tImageData into tempVar
    delete byte 1 to tChannel of tempVar
    put empty into tResult
put 0 into tCounter
    repeat with i = 1 to the number of bytes in tempVar step 4
       add 1 to tCounter
       try
          put bytetonum(byte i of tempVar) into tResult[tCounter]
          end try
    end repeat
    return tResult
end ImgTochToArrayNum2

Alex Tweedly wrote:
> I haven't tackled the second half (i.e. the actual dithering bit yet -
> maybe tomorrow).

Excellent! Thanks a lot for your time, Alex.

Al



More information about the use-livecode mailing list