GSDP:GAM100/CProcessing/readFrameBuffer()
From Inside
< GSDP:GAM100 | CProcessing
readFrameBuffer()
Description
Returns a PImage of a section of the last frame's frame buffer (what was drawn to the screen).
Parameters
readFrameBuffer(int x, int y, int w, int h)
- x - (int) X coordinate of the top left corner of the pixel to start from.
- y - (int) Y coordinate of the top left corner of the pixel to start from.
- w - (int) Width of the sub image in pixels.
- h - (int) Height of the sub image in pixels.
Example
PImage justin_face;
int x_size, y_size;
void init()
{
justin_face = loadImage("./Assets/justin1.png");
x_size = imageWidth(justin_face);
y_size = imageHeight(justin_face);
}
PImage frame_buffer;
void update()
{
freeImage(&frame_buffer);
frame_buffer = readFrameBuffer(0, 0, canvasWidth, canvasHeight);
background(color(255, 255, 255, 255));
image(frame_buffer, mouseX, mouseY, canvasWidth / 2, canvasHeight / 2, 255);
image(justin_face, canvasWidth/2, canvasHeight/2, x_size, y_size, 255);
}
Related
- Main Page
- loadImage()
- loadImageAdvanced()
- image()
- imageRotated()
- imageSize()
- imageMode()
- createImage()
- createImageAdvanced()
- freeImage()
- imageWidth()
- imageHeight()
- imagePixel()
- imageCreateSubimage()
- imageCreateSubimageAdvanced()
- imageCreateTint()
- imageCreateTintAdvanced()
- imageData()
- imageUpdate()
- readFrameBuffer()
- readFrameBufferAdvanced()