We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b2e011e commit 4c452d1Copy full SHA for 4c452d1
src/image/pixels.js
@@ -364,10 +364,12 @@ p5.prototype.filter = function(operation, value) {
364
* Getting the color of a single pixel with get(x, y) is easy, but not as fast
365
* as grabbing the data directly from pixels[]. The equivalent statement to
366
* 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>.
+ * <code>
+ * var off = (y * width + x) * d * 4;
+ * [pixels[off],
+ * pixels[off+1],
371
+ * pixels[off+2],
372
+ * pixels[off+3]]</code>
373
* <br><br>
374
* See the reference for pixels[] for more information.
375
*
0 commit comments