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

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. __

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

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