Atkinson dither algorithm & 'for each' loop

Alejandro Tejada capellan2000 at gmail.com
Thu Oct 12 16:37:00 EDT 2017


Hi Hermann,

Hermann Hoch wrote:
> So all considerations to improve the LCS script are,
> TMHO, of rather theoretical value. Here are some more:
> The Atkinson algorithm uses multiples of 1/8 = 0.125 for
> the diffusion-error, the Floyd-Steinberg algorithm uses
> multiples of 1/16 = 0.0625.
> And have this in mind:
> Whenever you use numToChar(Number) in your script you
> are wrong by Number - round(Number) of the accumulated
> pixel value ...

This is correct, for this reason, in the most recent version of
this handler, I am using 2 chars to store the new pixel value.
first char is a whole number from 0 to 255 and the second
char represent a decimal part from 0 to 99.

I will test if using 5 chars for storing the new pixel value.
In this way, the new pixel could store values of
0000.000000 that should be enough for this task...

After reading Mark's answer, I learned that using a numerical
ordered array to store pixel values could be really fast too.
This is another path to explore.

Al



More information about the use-livecode mailing list