Re: Atkinson dither algorithm & 'for each' loop

2017-10-13 Thread Lagi Pittas via use-livecode
HI All Hoping I'm not teaching my granny to suck eggs ... Here is a great article I remembered reading from a few years ago. It's easy to find on google so you probably know of it ... http://www.tannerhelland.com/4660/dithering-eleven-algorithms-source-code/ In any case his projects and how he

Atkinson dither algorithm & 'for each' loop

2017-10-13 Thread Alejandro Tejada via use-livecode
After reading Mark Waddingham explanation, now i am using a sequential ordered array for this handler. Check this much shorter and faster version: on mouseUp put the millisecs into startTime set the cursor to busy put the alphadata of img "Image" into tAlphaData put the imagedata of

Re: Atkinson dither algorithm & 'for each' loop

2017-10-12 Thread hh via use-livecode
@Al. For multiples of 1/8 (Atkinson) you need 8*256=2048 integers, that is 11 Bit. For multiples of 1/16 (Floyd-Steinberg) you need 16*256=4096 integers, that is 12 Bit. In 2 chars = 16 Bit fit even multiples of 1/256. No dither-algorithm uses such tiny diffusion-errors. __

Atkinson dither algorithm & 'for each' loop

2017-10-12 Thread Alejandro Tejada via use-livecode
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 h

Re: Atkinson dither algorithm & 'for each' loop

2017-10-12 Thread hh via use-livecode
> Al wrote: > Please, check this new handler in the forum and suggest how to > make this faster and more precise. I already gave you a method that is, with a 500x500 image, at least 1000 (thousand) times faster than your script. Of course this is not due my special skills but the ability of javas

Re: Atkinson dither algorithm & 'for each' loop

2017-10-12 Thread Mark Waddingham via use-livecode
On 2017-10-12 19:35, Alejandro Tejada via use-livecode wrote: Peter Read wrote: One note of caution regarding the use of the "repeat for each" loop, whilst you will get a loop iteration for every value in the collection (fldhexa3 in your example), you are not guaranteed the order in which they w

Atkinson dither algorithm & 'for each' loop

2017-10-12 Thread Alejandro Tejada via use-livecode
A few hours ago, I send a message to the mail list, a message that vanish without trace. Now I am resending parts of that message. The rest of the message is in the forum... Peter Read wrote: > One note of caution regarding the use of the "repeat for each" loop, > whilst you will get a loop iterat

Re: Atkinson dither algorithm & 'for each' loop

2017-10-12 Thread Richard Gaskin via use-livecode
Peter Reid wrote: > One note of caution regarding the use of the "repeat for each" loop, > whilst you will get a loop iteration for every value in the collection > (fldhexa3 in your example), you are not guaranteed the order in which > they will occur. Maybe I misunderstand, but are you thinking

Re: Atkinson dither algorithm & 'for each' loop

2017-10-12 Thread Bob Sneidar via use-livecode
That is correct Ben. It's not the repeat for each that is unreliable (probably a bad word to use here) but it is arrays which do not retain the sequence of key/values in the order they were put in. To get around this, when possible use numbered keys, then: put the keys of aMyArray into tKeyLi

Re: Atkinson dither algorithm & 'for each' loop

2017-10-12 Thread Ben Rubinstein via use-livecode
Hi Peter, One note of caution regarding the use of the "repeat for each" loop, whilst you will get a loop iteration for every value in the collection (fldhexa3 in your example), you are not guaranteed the order in which they will occur. Are you sure? My understanding has always been that chun

Re: Atkinson dither algorithm & 'for each' loop

2017-10-12 Thread Peter Reid via use-livecode
One note of caution regarding the use of the "repeat for each" loop, whilst you will get a loop iteration for every value in the collection (fldhexa3 in your example), you are not guaranteed the order in which they will occur. This doesn't matter in a lot of cases but does matter when the seque