public void rect(float a, float b, float c, float d, float tl, float tr, float br, float bl) { g.rect(a, b, c, d, tl, tr, br, bl); }
/** * @param tl radius for top-left corner * @param tr radius for top-right corner * @param br radius for bottom-right corner * @param bl radius for bottom-left corner */ public void rect(float a, float b, float c, float d, float tl, float tr, float br, float bl) { if (recorder != null) recorder.rect(a, b, c, d, tl, tr, br, bl); g.rect(a, b, c, d, tl, tr, br, bl); }
/** * @param r radii for all four corners */ public void rect(float a, float b, float c, float d, float r) { rect(a, b, c, d, r, r, r, r); }
public void rect(float a, float b, float c, float d, float r) { rect(a, b, c, d, r, r, r, r); }
public void rect(float a, float b, float c, float d) { g.rect(a, b, c, d); }
public void rect(float a, float b, float c, float d, float r) { g.rect(a, b, c, d, r); }
/** * ( begin auto-generated from rect.xml ) * * Draws a rectangle to the screen. A rectangle is a four-sided shape with * every angle at ninety degrees. By default, the first two parameters set * the location of the upper-left corner, the third sets the width, and the * fourth sets the height. These parameters may be changed with the * <b>rectMode()</b> function. * * ( end auto-generated ) * * @webref shape:2d_primitives * @param a x-coordinate of the rectangle by default * @param b y-coordinate of the rectangle by default * @param c width of the rectangle by default * @param d height of the rectangle by default * @see PGraphics#rectMode(int) * @see PGraphics#quad(float, float, float, float, float, float, float, float) */ public void rect(float a, float b, float c, float d) { if (recorder != null) recorder.rect(a, b, c, d); g.rect(a, b, c, d); }
protected void drawBoxplot(PGraphics pg) { float x0 = 0; for (int bx = 0; bx < binCountX; bx++) { float dx = pg.width * marginalDensity[bx]; pg.noStroke(); float y0 = pg.height * (1 - perc75[bx]); float dy = pg.height * (perc75[bx] - perc25[bx]); // Q1 - Q3 box pg.fill(mixColors(WHITE, COLOR, 1)); pg.rect(x0, y0, dx, dy); pg.fill(mixColors(WHITE, COLOR, 0.5f)); // Q0 - Q1 box y0 = pg.height * (1 - perc25[bx]); dy = pg.height * (perc25[bx] - perc09[bx]); pg.rect(x0, y0, dx, dy); // Q3 - Q4 box y0 = pg.height * (1 - perc91[bx]); dy = pg.height * (perc91[bx] - perc75[bx]); pg.rect(x0, y0, dx, dy); x0 += dx; } }
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);
protected void drawEikosogram(PGraphics pg) { pg.noStroke(); float x0 = 0; for (int bx = 0; bx < binCountX; bx++) { float dx = pg.width * marginalDensity[bx]; float y0 = pg.height; for (int by = 0; by < binCountY; by++) { float pxy = logY ? logDensity[bx][by] : density[bx][by]; float dy = pg.width * pg.height * pxy / dx; float f = PApplet.map(by, 0, binCountY - 1, 1, 0); pg.fill(mixColors(WHITE, COLOR, f)); pg.rect(x0, y0, dx, -dy); y0 -= dy; } x0 += dx; } }
void drawChessBoard(PGraphics pg, int amount) { float blockX = pg.width / (float) amount; float blockY = pg.height / (float) amount; for (int i = 0; i < amount; i++) { for (int j = 0; j < amount; j++) { if ((i + j + 1) % 2 == 0) { pg.fill(255, 255, 255); // white } else { pg.fill(0, 0, 0); // black } pg.rect(i * blockX, j * blockY, (i + 1) * blockX, (j + 1) * blockY); } } } }
/** * Actual implementation of clearing the background, now that the * internal variables for background color have been set. Called by the * backgroundFromCalc() method, which is what all the other background() * methods call once the work is done. */ protected void backgroundImpl() { pushStyle(); pushMatrix(); resetMatrix(); fill(backgroundColor); rect(0, 0, width, height); popMatrix(); popStyle(); }
/** * Actual implementation of clearing the background, now that the * internal variables for background color have been set. Called by the * backgroundFromCalc() method, which is what all the other background() * methods call once the work is done. */ protected void backgroundImpl() { pushStyle(); pushMatrix(); resetMatrix(); fill(backgroundColor); rect(0, 0, width, height); popMatrix(); popStyle(); }
public void draw(PGraphics pg, boolean pdf) { pg.beginDraw(); pg.background(WHITE); if (canDraw()) { pg.noStroke(); float rad = 0; int a; int count = PApplet.min(500, points.size()); rad = PApplet.map(count, 0, 500, 0.05f, 0.01f); a = (int) PApplet.map(count, 0, 500, 70, 10); pg.fill(pg.red(COLOR), pg.green(COLOR), pg.blue(COLOR), a); for (Value2D pt : points) { float px = pg.width * (float) pt.x; float py = pg.height * (float) (1 - pt.y); float pw = pg.width * rad; float ph = pg.height * rad; if (50000 < points.size()) pg.rect(px - pw / 2, py - ph / 2, pw, ph); else pg.ellipse(px, py, pw, ph); } } else { drawCross(pg); } if (pdf) pg.dispose(); pg.endDraw(); }
public void draw(PGraphics pg, boolean pdf) { pg.beginDraw(); pg.background(WHITE); if (canDraw()) { float binw = (float)pg.width / binCount; pg.noStroke(); for (int bx = 0; bx < binCount; bx++) { float p = density[bx]; float h = PApplet.map(p, 0, maxProb, 0, 0.5f); // float p = density[bx]; pg.fill(hColor); pg.rect(binw * bx, pg.height * (1 - h), binw, pg.height * h); } } else { drawCross(pg); } if (pdf) pg.dispose(); pg.endDraw(); }
public void draw(PGraphics pg, boolean pdf) { pg.beginDraw(); pg.background(WHITE); if (canDraw()) { float binw = (float)pg.width / binCountX; float binh = (float)pg.height / binCountY; pg.noStroke(); for (int bx = 0; bx < binCountX; bx++) { for (int by = 0; by < binCountY; by++) { float p = PApplet.map(density[bx][by], 0, maxProb, 0, 1); pg.fill(mixColors(WHITE, COLOR, p)); pg.rect(binw * bx, pg.height - binh * by, binw, -binh); } } } else { drawCross(pg); } if (pdf) pg.dispose(); pg.endDraw(); }
pg.noFill(); pg.strokeWeight(0.5); pg.rect (0,0,100,100); pg.endDraw();
gfx.rect(0,0,width,height); gfx.fill(255); gfx.ellipse(mouseX,mouseY,10,10);
PShape createTextGraphics(String s) { PGraphics buffer = createGraphics(width/2, height); buffer.beginDraw(); buffer.strokeWeight(8.0f); buffer.background(color(0,128,0)); buffer.stroke(0xff, 0, 0); buffer.text(s, 0, height / 4); buffer.stroke(255); buffer.textSize(64f); buffer.text(s, 0, height / 3); buffer.stroke(0x0000FF); buffer.textSize(128); buffer.text(s, 0, height / 2 + height / 4); buffer.fill(color(128, 0, 128)); buffer.rect(400, 200, 400, 400); buffer.stroke(128); buffer.line(0, 0, width / 2, height); buffer.endDraw(); PShape face = createShape(); face.beginShape(QUAD); face.noStroke(); face.textureMode(NORMAL); face.texture(buffer); face.vertex(-1, -1, 0, 0, 0); face.vertex(1, -1, 0, 1, 0); face.vertex(1, 1, 0, 1, 1); face.vertex(-1, 1, 0, 0, 1); face.endShape(); return face; }