Graphics

create_graphics()

p5.core.graphics.create_graphics(width, height, renderer='P2D')

Creates and returns a new off-screen graphics buffer that you can draw on

Parameters:
  • width (int) – width of the offscreen graphics buffer in pixels
  • height (int) – height of the offscreen graphics buffer in pixels
  • renderer (constant) – Default P2D, and only available in skia renderer
Returns:

Off screen graphics buffer

Return type:

Graphics

Graphics

class p5.core.graphics.Graphics

Thin wrapper around a renderer, to be used for creating a graphics buffer object. Use this class if you need to draw into an off-screen graphics buffer. The two parameters define the width and height in pixels. The fields and methods for this class are extensive, but mirror the normal drawing API for p5.

Graphics object are not meant to be used directly in sketches. User should always use create_graphics to make an offscreen buffer

__weakref__

list of weak references to the object (if defined)