Skip to content

Commit 4c452d1

Browse files
author
Lauren McCarthy
committed
update for #1372
1 parent b2e011e commit 4c452d1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/image/pixels.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,12 @@ p5.prototype.filter = function(operation, value) {
364364
* Getting the color of a single pixel with get(x, y) is easy, but not as fast
365365
* as grabbing the data directly from pixels[]. The equivalent statement to
366366
* get(x, y) using pixels[] with pixel density d is
367-
* <code>[pixels[(y*width*d+x*4)*d],
368-
* pixels[(y*width*d+x*4)*d+1],
369-
* pixels[(y*width*d+x*4)*d+2],
370-
* pixels[(y*width*d+x*4)*d+3]]</code>.
367+
* <code>
368+
* var off = (y * width + x) * d * 4;
369+
* [pixels[off],
370+
* pixels[off+1],
371+
* pixels[off+2],
372+
* pixels[off+3]]</code>
371373
* <br><br>
372374
* See the reference for pixels[] for more information.
373375
*

0 commit comments

Comments
 (0)