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

Function getColors

test/unit/webgl/p5.RendererGL.js:237–254  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

235
236 test('coplanar strokes match 2D', function() {
237 const getColors = function(mode) {
238 myp5.createCanvas(20, 20, mode);
239 myp5.pixelDensity(1);
240 myp5.background(255);
241 myp5.strokeCap(myp5.SQUARE);
242 myp5.strokeJoin(myp5.MITER);
243 if (mode === myp5.WEBGL) {
244 myp5.translate(-myp5.width/2, -myp5.height/2);
245 }
246 myp5.stroke('black');
247 myp5.strokeWeight(4);
248 myp5.fill('red');
249 myp5.rect(10, 10, 15, 15);
250 myp5.fill('blue');
251 myp5.rect(0, 0, 15, 15);
252 myp5.loadPixels();
253 return [...myp5.pixels];
254 };
255
256 const getPixel = (colors, x, y) => {
257 const idx = (y * 20 + x) * 4;

Callers 1

p5.RendererGL.jsFile · 0.85

Calls 15

pixelDensityMethod · 0.45
backgroundMethod · 0.45
strokeCapMethod · 0.45
strokeJoinMethod · 0.45
translateMethod · 0.45
strokeMethod · 0.45
strokeWeightMethod · 0.45
fillMethod · 0.45
rectMethod · 0.45
loadPixelsMethod · 0.45
beginShapeMethod · 0.45
vertexMethod · 0.45

Tested by

no test coverage detected