Search processing.org:

Reference for Processing (BETA) version 0135+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Name

### PGraphics

Examples

    PGraphics pg;

    void setup() {
      size(100, 100);
      pg = createGraphics(80, 80, P3D);
    }

    void draw() {
      pg.beginDraw();
      pg.background(102);
      pg.stroke(255);
      pg.line(40, 40, mouseX, mouseY);
      pg.endDraw();
      image(pg, 10, 10);
    }

Description

Main graphics and rendering context, as well as the base API implementation for processing "core". Use this class if you need to draw into an off-screen graphics buffer. A PGraphics object can be constructed with the createGraphics() function. The beginDraw() and endDraw() methods (see above example) are necessary to set up the buffer and to finalize it. The fields and methods for this class are extensive; for a complete list visit the developer's reference: http://dev.processing.org/reference/core/

Methods

beginDraw() | Sets up the rendering context
endDraw() | Finalizes the renderering context

Constructor

    PGraphics()
    PGraphics(width, height)
    PGraphics(width, height, applet)

Parameters

width | int: width in pixels
height | int: height in pixels
applet | PApplet

Usage | Web & Application
Related | createGraphics()

Updated on February 09, 2008 04:38:52pm PST