Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #39540

Re: Picture colors decreasing script.

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Picture colors decreasing script.
Date 2021-03-02 13:42 +0100
Organization PointedEars Software (PES)
Message-ID <5440012.DvuYhMxLoT@PointedEars.de> (permalink)
References <7fbf64ec-ed11-4ee7-b530-459e5681651en@googlegroups.com> <91fc5c33-11cc-480d-8703-272e7d161849n@googlegroups.com>

Show all headers | View raw


Michael Haufe (TNO) wrote:

> Also for readability the following:
> 
> ```
> var a1=imgData.data[i];
> var a2=imgData.data[i+1];
> var a3=imgData.data[i+2];
> var a4=imgData.data[i+3];
> ```
> 
> I think can be replaced with:
> 
> ```
> let {data} = imgData
> let [r,g,b,a] = [data[i], data[i+1], data[i+2], data[i+3]]
> ```

let [r,g,b,a] = data.slice(i, i + 4);

:)

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Picture colors decreasing script. Kristjan Robam <kristjanrobam01@mail.ee> - 2021-02-28 22:33 -0800
  Re: Picture colors decreasing script. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-03-01 11:56 -0800
    Re: Picture colors decreasing script. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-03-02 13:42 +0100
      Re: Picture colors decreasing script. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-03-03 07:02 -0800
        Re: Picture colors decreasing script. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-03-03 19:47 +0100
          Re: Picture colors decreasing script. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-03-03 11:37 -0800
            Re: Picture colors decreasing script. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-03-03 21:33 +0100
              Re: Picture colors decreasing script. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-03-03 12:38 -0800
                Re: Picture colors decreasing script. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-03-03 21:53 +0100
                Re: Picture colors decreasing script. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-03-03 16:36 -0800
                Re: Picture colors decreasing script. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-03-04 02:07 +0000
          Re: Picture colors decreasing script. John G Harris <niam@jghnorth.org.uk.invalid> - 2021-03-04 09:40 +0000

csiph-web