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

Function parseFilterArgs

src/image/pixels.js:560–589  ·  view source on GitHub ↗
(...args)

Source from the content-addressed store, hash-verified

558 };
559
560 function parseFilterArgs(...args) {
561 // args could be:
562 // - operation, value, [useWebGL]
563 // - operation, [useWebGL]
564 // - shader
565
566 let result = {
567 shader: undefined,
568 operation: undefined,
569 value: undefined,
570 useWebGL: true
571 };
572
573 if (args[0] instanceof p5.Shader) {
574 result.shader = args[0];
575 return result;
576 }
577 else {
578 result.operation = args[0];
579 }
580
581 if (args.length > 1 && typeof args[1] === 'number') {
582 result.value = args[1];
583 }
584
585 if (args[args.length-1] === false) {
586 result.useWebGL = false;
587 }
588 return result;
589 }
590
591 /**
592 * Gets a pixel or a region of pixels from the canvas.

Callers 1

pixelsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected