MCPcopy
hub / github.com/processing/p5.js / mask

Function mask

test/unit/webgl/p5.RendererGL.js:2534–2541  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2532
2533 test('It can mask in a shape', function() {
2534 const mask = () => {
2535 myp5.background(255);
2536 myp5.noStroke();
2537 myp5.clip(() => myp5.rect(10, 10, 30, 30));
2538 myp5.fill('red');
2539 myp5.rect(5, 5, 40, 40);
2540 // console.log(myp5._renderer.canvas.toDataURL());
2541 };
2542 const pixels = getClippedPixels(myp5.WEBGL, mask);
2543
2544 // Regions where nothing is drawn should be white

Callers 1

getClippedPixelsFunction · 0.85

Calls 11

noStrokeMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
imageMethod · 0.80
backgroundMethod · 0.45
rectMethod · 0.45
fillMethod · 0.45
createFramebufferMethod · 0.45
clearMethod · 0.45
translateMethod · 0.45
loadPixelsMethod · 0.45

Tested by

no test coverage detected