MCPcopy Index your code
hub / github.com/processing/p5.js / getClippedPixels

Function getClippedPixels

test/unit/webgl/p5.RendererGL.js:2509–2526  ·  view source on GitHub ↗
(mode, mask)

Source from the content-addressed store, hash-verified

2507 suite('clip()', function() {
2508 //let myp5;
2509 function getClippedPixels(mode, mask) {
2510 // Clean up the last myp5 instance, since this may be called more than
2511 // once per test
2512 myp5.remove();
2513 myp5 = new p5(function(p) {
2514 p.setup = function() {};
2515 p.draw = function() {};
2516 });
2517
2518 myp5.createCanvas(50, 50, mode);
2519 myp5.pixelDensity(1);
2520 if (mode === myp5.WEBGL) {
2521 myp5.translate(-myp5.width / 2, -myp5.height / 2);
2522 }
2523 mask();
2524 myp5.loadPixels();
2525 return [...myp5.pixels];
2526 }
2527
2528 function getPixel(pixels, x, y) {
2529 const start = (y * myp5.width + x) * 4;

Callers 1

p5.RendererGL.jsFile · 0.85

Calls 5

maskFunction · 0.85
removeMethod · 0.45
pixelDensityMethod · 0.45
translateMethod · 0.45
loadPixelsMethod · 0.45

Tested by

no test coverage detected