/** * @param v1 red or hue value (depending on the current color mode) * @param v2 green or saturation value (depending on the current color mode) * @param v3 blue or brightness value (depending on the current color mode) */ public void background(float v1, float v2, float v3) { if (recorder != null) recorder.background(v1, v2, v3); g.background(v1, v2, v3); }
public void background(float gray, float alpha) { if (format == RGB) { background(gray); // ignore alpha for main drawing surface } else { colorCalc(gray, alpha); backgroundFromCalc(); // backgroundImpl(); } }
public void background(float gray, float alpha) { if (recorder != null) recorder.background(gray, alpha); g.background(gray, alpha); }
/** * See notes about alpha in background(x, y, z, a). */ public void background(float gray, float alpha) { if (format == RGB) { background(gray); // ignore alpha for main drawing surface } else { colorCalc(gray, alpha); backgroundFromCalc(); // backgroundImpl(); } }
/** * @param alpha opacity of the background */ public void background(int rgb, float alpha) { if (recorder != null) recorder.background(rgb, alpha); g.background(rgb, alpha); }
/** * @webref color:setting */ public void clear() { background(0, 0, 0, 0); }
/** * @param gray specifies a value between white and black */ public void background(float gray) { if (recorder != null) recorder.background(gray); g.background(gray); }
/** * Set the background to a grayscale value, based on the * current colorMode. */ public void background(float gray) { g.background(gray); }
/** * Set the background to an r, g, b or h, s, b value, * based on the current colorMode. */ public void background(float x, float y, float z) { g.background(x, y, z); }
/** * See notes about alpha in background(x, y, z, a). */ public void background(int rgb, float alpha) { g.background(rgb, alpha); }
/** * See notes about alpha in background(x, y, z, a). */ public void background(float gray, float alpha) { g.background(gray, alpha); }
public void background(float v1, float v2, float v3, float alpha) { if (recorder != null) recorder.background(v1, v2, v3, alpha); g.background(v1, v2, v3, alpha); }
public void clear() { background(0, 0, 0, 0); }
/** * Set the background to a gray or ARGB color. * <p/> * For the main drawing surface, the alpha value will be ignored. However, * alpha can be used on PGraphics objects from createGraphics(). This is * the only way to set all the pixels partially transparent, for instance. * <p/> * Note that background() should be called before any transformations occur, * because some implementations may require the current transformation matrix * to be identity before drawing. */ public void background(int rgb) { g.background(rgb); }
/** * Clear the background with a color that includes an alpha value. This can * only be used with objects created by createGraphics(), because the main * drawing surface cannot be set transparent. * <p/> * It might be tempting to use this function to partially clear the screen * on each frame, however that's not how this function works. When calling * background(), the pixels will be replaced with pixels that have that level * of transparency. To do a semi-transparent overlay, use fill() with alpha * and draw a rectangle. */ public void background(float x, float y, float z, float a) { g.background(x, y, z, a); }
PGraphics matteImage = new PGraphics(size, size, render);// matteImage.background(black); matteImage.fill(255); matteImage.text("A", x,y); matteImage.loadPixels(); for(i; i < matteImage.length;i++) { color c = matteImage.pixels[i]; if ( c == white) { doDrawEllipses(); } }
PGraphics canvas; size(400,400); //create a PGrahpics layer canvas = createGraphics(width,height); //intialize drawing canvas.beginDraw(); //draw something, pretty similar you'd draw in Processing canvas.background(255); canvas.rect(200,200,150,100); //finish drawing canvas.endDraw(); //PGraphics extends PImage, hence it can drawn as one image(canvas,0,0);
/** * Clear a pass (black with alpha). * * @param pass Pass to clear. */ @Override public void clearPass(PGraphics pass) { // clear pass buffer pass.beginDraw(); pass.background(0, 0); pass.resetShader(); pass.endDraw(); }
/** * Called in Automatic mode to display the image. */ public void draw() { parent.g.background(30, 30, 30); drawScreensOver(); parent.noStroke(); parent.g.image(this.render(), 0, 0, this.drawingSizeX, this.drawingSizeY); // pxCopy = getPixelsCopy(); }
PGraphics pg; void setup() { size(200, 200, P2D); pg = createGraphics(100, 100, P3D); } void draw() { pg.beginDraw(); pg.background(0); pg.noStroke(); pg.translate(pg.width*0.5, pg.height*0.5); pg.lights(); pg.sphere(25); pg.endDraw(); background(0, 0, 255); image(pg, 50, 50); }