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.
Examples
Syntax
get(x, y, w, h)
get()
get(x, y)
Parameters
Returns
Related References
textToContours
Returns an array of arrays of points outlining a string of text written using the font.
textToModel
Converts text into a 3D model that can be rendered in WebGL mode.
textToPaths
Returns a flat array of path commands that describe the outlines of a string of text.
textToPoints
Returns an array of points outlining a string of text written using the font.