MCPcopy Index your code
hub / github.com/processing/processing / get

Method get

core/src/processing/opengl/Texture.java:440–467  ·  view source on GitHub ↗

Copy texture to pixels. Involves video memory to main memory transfer (slow).

(int[] pixels)

Source from the content-addressed store, hash-verified

438 * Copy texture to pixels. Involves video memory to main memory transfer (slow).
439 */
440 public void get(int[] pixels) {
441 if (pixels == null) {
442 throw new RuntimeException("Trying to copy texture to null pixels array");
443 }
444 if (pixels.length != width * height) {
445 throw new RuntimeException("Trying to copy texture to pixels array of " +
446 "wrong size");
447 }
448
449 if (tempFbo == null) {
450 tempFbo = new FrameBuffer(pg, glWidth, glHeight);
451 }
452
453 // Attaching the texture to the color buffer of a FBO, binding the FBO and
454 // reading the pixels from the current draw buffer (which is the color
455 // buffer of the FBO).
456 tempFbo.setColorBuffer(this);
457 pg.pushFramebuffer();
458 pg.setFramebuffer(tempFbo);
459 tempFbo.readPixels();
460 pg.popFramebuffer();
461
462 tempFbo.getPixels(pixels);
463 convertToARGB(pixels);
464
465 if (invertedX) flipArrayOnX(pixels, 1);
466 if (invertedY) flipArrayOnY(pixels, 1);
467 }
468
469
470 ////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 9

convertToARGBMethod · 0.95
flipArrayOnXMethod · 0.95
flipArrayOnYMethod · 0.95
setColorBufferMethod · 0.80
pushFramebufferMethod · 0.80
setFramebufferMethod · 0.80
popFramebufferMethod · 0.80
getPixelsMethod · 0.80
readPixelsMethod · 0.45

Tested by

no test coverage detected