Gets a pixel or a region of pixels from the framebuffer.
myBuffer.get()
is easy to use but it's not as fast as myBuffer.pixels. Use myBuffer.pixels to read many pixel values.
The version of myBuffer.get()
with no parameters returns the entire framebuffer as a a p5.Image object.
The version of myBuffer.get()
with two parameters interprets them as coordinates. It returns an array with the [R, G, B, A]
values of the pixel at the given point.
The version of myBuffer.get()
with four parameters interprets them as coordinates and dimensions. It returns a subsection of the framebuffer as a p5.Image object. The first two parameters are the coordinates for the upper-left corner of the subsection. The last two parameters are the width and height of the subsection.
Syntax
get(x, y, w, h)
get()
get(x, y)
Parameters
x-coordinate of the pixel. Defaults to 0.
y-coordinate of the pixel. Defaults to 0.
width of the subsection to be returned.
height of the subsection to be returned.